I have a form with a button that when pressed brings up a search form. The search form searches a query from which the primary form data is extracted. No errors are being reported with the search, but the search is not functioning properly. I get a message saying the search has filtered the results, but this is not true.
Here is my code:
Any clue what's going on? Any help is appreciated.
Here is my code:
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 search text."
Else
'Generate search criteria
GCriteria = "Replace ([" & cboSearchField.Value & "], chr(39), '')" & " LIKE '*" & Replace(txtSearchString, "'", "") & "*'"
'Filter [TEST Master Form by Ult Parent] based on search criteria
'Form_TEST Master Form by Ult Parent.RecordSource' = "select * from [Ultimate Parent Table Query - Organizational Profile Report] where " & GCriteria
'Form_TEST Master Form by Ult Parent.Caption' = "[Ultimate Parent Table Query - Organizational Profile Report] (" & cboSearchField.Value & " contains '*" & txtSearchString & "*')"""
'Close frmSearch
DoCmd.Close acForm, "frmSearch"
MsgBox "Results have been filtered."
End If
End Sub
Any clue what's going on? Any help is appreciated.