Name search to read exact? (1 Viewer)

mrrayj60

Registered User.
Local time
Today, 14:51
Joined
Sep 3, 2009
Messages
103
My screen lets the user type in a name to find residents but they want it to be a closer exact. Now if your type James you'll get people with the first name of James included but they just want the last name. The field is last, first. Thanks, Ray

Private Sub txtSearchReg_Change()
Dim strFilter As String
strFilter = "[name] Like " & Chr(34) & "*" & Me.txtSearchReg.Text & "*" & Chr(34)
Me.frmresname2.Form.Filter = ""
Me.frmresname2.Form.Filter = strFilter
Me.frmresname2.Form.FilterOn = True

End Sub
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 04:51
Joined
Jan 20, 2009
Messages
12,852
This will give records that start with the value in txtSearchReg. So James will pull Jameson.
strFilter = "[name] Like " & Chr(34) & Me.txtSearchReg.Text & "*" & Chr(34)

This will find anything starting with "James " (note space)
strFilter = "[name] Like " & Chr(34) & " " & Me.txtSearchReg.Text & "*" & Chr(34)
 

mrrayj60

Registered User.
Local time
Today, 14:51
Joined
Sep 3, 2009
Messages
103
This will give records that start with the value in txtSearchReg. So James will pull Jameson.
strFilter = "[name] Like " & Chr(34) & Me.txtSearchReg.Text & "*" & Chr(34)

This will find anything starting with "James " (note space)
strFilter = "[name] Like " & Chr(34) & " " & Me.txtSearchReg.Text & "*" & Chr(34)


Thanks, I'll try this..Ray
 

Users who are viewing this thread

Top Bottom