Hi everybody.... I have built up a MS form that stores various info. but unfortunately I overlooked the issue of how to search these info or records. The search field in the button is rather impractical because it starts to search everything in the page that matches every single character I wrote in the search field. I want to put a VBA code that search for a certain record in specific field not all fields. I have found this code:
Dim strSearch As Variant
Dim strText As Variant
If IsNull(txtSearch) = True Then
MsgBox ("Please enter a keyword")
End If
strText = Me.txtSearch.Value
strSearch = "SELECT * from tblMain where ( [SubjectLetter] like ""*" & strText & "*"")"
Me.RecordSource = strSearch
DoCmd.FindNext
This code is working well, but has the following defects:
1. It does not find the next matching records, or in other words, if there are duplicates, it just find the first and ignore the others.
2. Once the button is clicked, the sequence of the available saved records goes to 1 of 2.
Thanks in advance.