Hello all
I am having some trouble with getting a search box to work on a search form.
Initially, the form was setup with the query on the main form, and the following code below returned the correct search results.
However, i have now put the query as a subform on the main search form.
How do i change the vba code to reference the subform?
I am having some trouble with getting a search box to work on a search form.
Initially, the form was setup with the query on the main form, and the following code below returned the correct search results.
Code:
Dim strsearch As String
Dim Task As String
'Check if a keyword entered or not
If IsNull(Me.txtSearch) Or Me.txtSearch = "" Then
MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
Me.txtSearch.SetFocus
Else
strsearch = Me.txtSearch.Value
Task = "SELECT * FROM qryMemrSearch WHERE ((RequestorsName Like ""*" & strsearch & "*"") OR (Department Like ""*" & strsearch & "*"") OR (Section Like ""*" & strsearch & "*"") or (ContactNumber Like ""*" & strsearch & "*"") OR (JobContactName Like ""*" & strsearch & "*"") OR (JobDescription Like ""*" & strsearch & "*""))"
Me.RecordSource = Task
End If
However, i have now put the query as a subform on the main search form.
How do i change the vba code to reference the subform?