I am trying to create a search field within my database that will open a form to a particular record. Since the search field is for a name, I want it to be able to recognize partial matches (eg. “smit”=”smith”).
I am a real beginner with VBA. I’ve previously used the following program to retrieve a form based on an ID number which only returns exact matches:
Private Sub FindRecord_Click()
On Error GoTo Err_FindRecord_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ContactForm"
stLinkCriteria = "[familyid]=" & "'" & Me![Text0] & "'"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_FindRecord_Click:
Exit Sub
Err_FindRecord_Click:
MsgBox Err.Description
Resume Exit_FindRecord_Click
End Sub
How would I alter this to do a “wildcard” type of search of an unbound text box that will find names or part of names?