Hi
Im trying to create a form to search a hardware database for items, the form consists of two boxes, a dropdown box and a text box. The user needs to choose a field from the dropdown box and then enter the text the want to search for in the text box and the press search
Its comming up results have been filtered however its not displaying them
Can anyone see any problems with my code
Thanks
Im trying to create a form to search a hardware database for items, the form consists of two boxes, a dropdown box and a text box. The user needs to choose a field from the dropdown box and then enter the text the want to search for in the text box and the press search
Its comming up results have been filtered however its not displaying them
Can anyone see any problems with my code
Thanks
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 stringtxt."
Else
'Generate search criteria
GCriteria = "[" & cboSearchField.Value & "] LIKE '*" & txtSearchString & "*'"
'Filter frmCustomers based on search criteria
Forms_frmHardware.RecordSource = "SELECT * FROM tblHardware WHERE " & GCriteria
Form_frmHardware.Caption = " tblHardware (" & cboSearchField.Value & " contains '*" & txtSearchString & "*')"
'Close frmSearch
MsgBox "Results have been filtered."
End If
End Sub
Comment