Help with search - Open Form & "Like"

  • Thread starter Thread starter doodle
  • Start date Start date
D

doodle

greetings all. I am creating a search form that contains a text box for
the user to enter in a customer name or partial customer name in order
to open a form filtered to matching records. My code only returns
records that start with the text box entry. For instance:

Text Box Entry: heller

will return Heller, Inc. - but not A.B. Heller or AB Heller Inc.

I know I can change the statement to search for beginning, middle or
end of a string, but how do I combine it to return all? Here is a
portion of my code:
********************************************
Case Is = "Customer"
Select Case txtTypeValue
Case Is = ""
MsgBox Prompt:="You must enter text to search for.",
Buttons:=vbOKOnly, _
Title:="Message From Adria"
txtTypeValue.SetFocus
Exit Sub
Case Else
DoCmd.OpenForm "frmEnterPickslips",
WhereCondition:="[Customer] Like """ & [txtTypeValue] & "*"""
Exit Sub
End Select
********************************************

Thanks in advance for your help,

-doodle
 
Put the wildcard character (*) both before *and* after:

DoCmd.OpenForm "frmEnterPickslips", WhereCondition:="[Customer] Like ""*" &
[txtTypeValue] & "*"""
 
Back
Top