Search text

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hi,

I am trying to figure it out but unsuccessful. I am able to get
information by type "Smith" but I couldn't get information if I type "smi"
to pull all "Smith". I should get some information on the screen if I type
either way "smith" or "smi".

I might need your help. I'm not sure if I did the right thing.

Dim stLinkCriteria As String
Dim zLastName As Variant
Dim zSearch As Variant

zSearch = UCase(Me![SearchLastName])

zLastName = DLookup("[LastName]", "Players", "ucase([LastName]) = " &
Chr$(34) & zSearch & Chr$(34))

stLinkCriteria = "ucase(LastName)=" & Chr$(34) & zSearch & Chr$(34)

Thanks
 
Use the Like operator, with a trailing wildard:
zSearch = "[LastName] Like """ & Me.SearchLastName & "*"""
zLastName = DLookup("[LastName]", "Players", zSearch)

BTW, searches are not case sensitive, so the case conversion isn't required.
 
Back
Top