I am using a Combo box to limit a search of my data. So far if I change strSQL = strSQL1 & Me!cboCOMPANY.Value to strSQL = strSQL1 & "Me!cboCOMPANY.Value" and let it prompt me for the choice made in the event cboCOMPANY.Value the event works correctly. Otherwise it returns a blank screen.
Here is the code I have so far
Option Compare Database
Option Explicit
Const strSQL1 = "SELECT [qrySEARCH].[COMPANY NAME],[qrySEARCH].[TYPE],[qrySEARCH].[SERIAL_NUMBER],[qrySEARCH].[ORDERID],[qrySEARCH].[PO_NUMBER] FROM [qrySEARCH] WHERE [qrySEARCH].[COMPANY NAME] ='"
Private strSQL As String
Const strMsg1 = "Click below to display updated search information"
Const strMsg2 = "Select Company Name from List"
Const strMsg3 = "Select Serial Number from List"
Const strMsg4 = "Select PO number from List"
Private Sub cboCOMPANY_AfterUpdate()
If Me!cboCOMPANY.Value <> "" Then
Me!lblLIST.Caption = strMsg1
Else
Me!lblLIST.Caption = strMsg2
End If
End Sub
Private Sub MAINLST_GotFocus()
If Me!cboCOMPANY.Value <> "" Then
strSQL = strSQL1 & Me!cboCOMPANY.Value
Me!MAINLST.RowSource = strSQL
Me!MAINLST.Requery
Me!lblLIST.Caption = "WORK ORDERS for " & Me!cboCOMPANY.Value
End If
End Sub
Any help you can offer would be appreciated...I am stumped
Here is the code I have so far
Option Compare Database
Option Explicit
Const strSQL1 = "SELECT [qrySEARCH].[COMPANY NAME],[qrySEARCH].[TYPE],[qrySEARCH].[SERIAL_NUMBER],[qrySEARCH].[ORDERID],[qrySEARCH].[PO_NUMBER] FROM [qrySEARCH] WHERE [qrySEARCH].[COMPANY NAME] ='"
Private strSQL As String
Const strMsg1 = "Click below to display updated search information"
Const strMsg2 = "Select Company Name from List"
Const strMsg3 = "Select Serial Number from List"
Const strMsg4 = "Select PO number from List"
Private Sub cboCOMPANY_AfterUpdate()
If Me!cboCOMPANY.Value <> "" Then
Me!lblLIST.Caption = strMsg1
Else
Me!lblLIST.Caption = strMsg2
End If
End Sub
Private Sub MAINLST_GotFocus()
If Me!cboCOMPANY.Value <> "" Then
strSQL = strSQL1 & Me!cboCOMPANY.Value
Me!MAINLST.RowSource = strSQL
Me!MAINLST.Requery
Me!lblLIST.Caption = "WORK ORDERS for " & Me!cboCOMPANY.Value
End If
End Sub
Any help you can offer would be appreciated...I am stumped