bonusmarch
MIS
I would like to know how do I perform a search using query (qryserch). I have 3 fields in the query which I want to perform a search. I have 3 checkboxes correspond to each search field. I also have a textbox which allows the user to type in what to search for based on the selected checkbox. When the user click on a search button, it will retrieve the matched records in a subform in datasheet view.
FirstName
LastName
ClassCode
E.g.
Dim strSQL As String
If Forms!Search!FirstName.value
strSQL = "Select FirstName, LastName, ClassCode
From T1
Where FirstName = Like "*" & Forms!Search!FirstName & "*"
DoCmd.RunSQL (strSQL)
End If
This is not the actual code I have, but just to get my idea through. My problem comes when performing the DoCmd.RunSQL, how do I run the sql statement into a specific query(qrySearch)?
FirstName
LastName
ClassCode
E.g.
Dim strSQL As String
If Forms!Search!FirstName.value
strSQL = "Select FirstName, LastName, ClassCode
From T1
Where FirstName = Like "*" & Forms!Search!FirstName & "*"
DoCmd.RunSQL (strSQL)
End If
This is not the actual code I have, but just to get my idea through. My problem comes when performing the DoCmd.RunSQL, how do I run the sql statement into a specific query(qrySearch)?