L
Little Penny
I'm trying to adapt the following code to filter a user form, but I
keep getting the following error:
Any help would be greatly appreciated.
Runtime error 3075
Syntax error (missing operator) in query expression 'Media Type LIKE
'*P*"
Code:
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True
Then
MsgBox "You must enter a search string."
Else
'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" &
txtSearchString & "*'"
'Filter frmCustomers based on search criteria
Form_frmMonthEndlb.RecordSource = "select * from Reprint
Request where " & GCriteria
Form_frmMonthEndlb.Caption = "Reprint Request (" &
cboSearchField.Value & " contains '*" & txtSearchString & "*')"
'Close frmSearch
DoCmd.Close acForm, "frmSearch"
MsgBox "Results have been filtered."
End If
End Sub
keep getting the following error:
Any help would be greatly appreciated.
Runtime error 3075
Syntax error (missing operator) in query expression 'Media Type LIKE
'*P*"
Code:
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True
Then
MsgBox "You must enter a search string."
Else
'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" &
txtSearchString & "*'"
'Filter frmCustomers based on search criteria
Form_frmMonthEndlb.RecordSource = "select * from Reprint
Request where " & GCriteria
Form_frmMonthEndlb.Caption = "Reprint Request (" &
cboSearchField.Value & " contains '*" & txtSearchString & "*')"
'Close frmSearch
DoCmd.Close acForm, "frmSearch"
MsgBox "Results have been filtered."
End If
End Sub