plbobadilla
Technical User
Hello,
My name is Pablo and I am trying to set-up a form that can be filtered, but I keep having the issue where it only filters 1 record even though there should be multiple records that meet the filter criteria. Any help would be appreciated.
Here is the code for the Form:
Private Sub cmdsearch_WD_Click()
If Len(cbosearchcriteria_WD) = 0 Or IsNull(cbosearchcriteria_WD) = True Then
MsgBox "You must select criteria to search."
ElseIf Len(Txtsearchstring1_WD) = 0 Or IsNull(Txtsearchstring1_WD) = True Then
MsgBox "You must enter a search text."
Else
'Generate search criteria
WD_Criteria = cbosearchcriteria_WD.Value & " LIKE '*" & Txtsearchstring1_WD & "*'"
'Filter form based on search criteria
Form_Frm_Wire_Drawing.RecordSource = "select * from Wire_Drawing where " & WD_Criteria
Form_Frm_Wire_Drawing.Caption = "Wire_Drawing (" & cbosearchcriteria_WD.Value & " contains '*" & Txtsearchstring1_WD & "*')"
MsgBox "Results have been filtered."
End If
End Sub
Here is the code for the module:
Option Compare Database
'Global variable used to store search criteria
Global WD_Criteria As String
Thanks,
Pablo