I am still very new at this (first timer actually).. I am also trying (with numerous efforts) to create a search box in a form. I have made a dropdown box and a textbox to enter the searchcriteria. I have copy pasted the folowing code:
I have problems defining:
Me.Filter = GCriteria
Me.FilterOn = True
How do I create this filter, and do I put it in this code, or in a module where I refer to?
Further assistance would be very nice. Thank you!
Code:
Private Sub Find_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 stringtxt."
Else
'Generate search criteria
GCriteria = "[" & cboSearchField.Value & "] LIKE '*" & txtSearchString & "*'"
'Filter frmCustomers based on search criteria
Me.Filter = GCriteria
Me.FilterOn = True
'Close frmSearch
MsgBox "Results have been filtered."
End If
End Sub
Me.Filter = GCriteria
Me.FilterOn = True
How do I create this filter, and do I put it in this code, or in a module where I refer to?
Further assistance would be very nice. Thank you!
Comment