hi everyone,
i want to create a search option in an access form, the user selects a field from a dropdown(cboSearchField) and enters text into a textbox(txtSearchString). At the moment nothing happens when the button is pressed, but I would like the form(frmCustomers) to open with the search result.
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_frmCustomers.RecordSource = "select * from Customers where " & GCriteria
Form_frmCustomers.Caption = "Customers (" & cboSearchField.Value & " contains '*" & txtSearchString & "*')"
'Close frmSearch
'DoCmd.Close acForm, "frmSearch"
'MsgBox "Results have been filtered."
End If
** Any help please!!