Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using wildcards in a query referencing a text box

Status
Not open for further replies.

kazaccess

MIS
Aug 8, 2013
4
US
I have a form that opens up a query. The form has a text box where the user can type a name. If possible in the query editor, how would I go about this? For example, if the user types 'John', I would like the query to return the same as: Select * From Table Where Name Like %'John'%
I have tried several variations of: WHERE Name LIKE %Forms![MyForm]!Name%, but with no luck. Any ideas?
 
I assume "Name" is a place holder and not a real field or control name. "Name" is a reserved word and should never be used to name anything.

SQL:
WHERE [Name] LIKE "*" & Forms![MyForm]![Name] & "*"

Duane
Hook'D on Access
MS Access MVP
 
Perfect!Thank you so much. And, yes, "Name" was just a place holder so I could give a simple example.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top