(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 :
Expand|Select|Wrap|Line Numbers
- Private Sub cmdSearch_Click()
- Dim bkmk As Variant
- Dim strField As String
- Me.RecordsetClone.MoveFirst
- '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"
- Me.txtSearch.SetFocus
- Else
- bkmk = Me.RecordsetClone.Bookmark
- Me.Recordset.Bookmark = bkmk
- End If
- Me.txtSearch = ""
- End Sub
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”
OR
is it possible to do by access Macro with this feature? I tried and three search criteria working but I couldn’t fixed other issue such as “No match found” or “No search item detected”
Can anyone help me please?
Thanks