March 1st, 2014, 09:51 PM
Join Date: Sep 2013
Time spent in forums: 22 m 11 sec
Reputation Power: 0
Microsoft Access Searchbox Help
(1) I have a Table called Account table [ ID, ACCode, ACName, Date]
(2) a form called Account form
(3) a sub-form called Account subform –Record Source to Account Table
(4) Account form is single form with Account subform
In Account Form
I have a Search box - txtSearch
A command button cmdSearch
cmdSearch – onclick event got the following code :
Private Sub cmdSearch_Click()
Dim bkmk As Variant
Dim strField As String
'Find the first record that matches what
'is in the search text box.
Me.RecordsetClone.FindFirst "ACName Like " & Chr(34) & Me.txtSearch & "*" & Chr(34)
If Me.RecordsetClone.NoMatch Then
MsgBox " Sorry! No match found for [" & Me.txtSearch & "], Try another ", vbOKOnly + vbInformation, "Sorry"
bkmk = Me.RecordsetClone.Bookmark
Me.Recordset.Bookmark = bkmk
Me.txtSearch = ""
This code works to fine search single record. I can find any single item either ID, or ACCode or Date. Message also works if no match found. Even just put one word, two word …or whole word.
But I want to search multiple records from the same box (txtSearch).
(1) Actually I want to put multiple criteria in here - Me.RecordsetClone.FindFirst "ACName Like " & Chr(34) & Me.txtSearch & "*" & Chr(34) So that it can find either ID or ACCode or ACName
(2) Another thing is –If no item put the search box it will show a message “No search item has detected”
Can anyone help me please?