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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Like SQL statement using a text field on a form 1

Status
Not open for further replies.

JaBurd311

MIS
Sep 21, 2001
24
US
I am trying to create a query that uses a Like statement in the criteria field. The users type in the criteria they want to search on in a form and I am trying to get what they type in the text box into the query. Below is the line I have tried to use and alas, does not work.

Like "*[Forms]![MainSearch]![txtSearchCriteria]*"

Most likely I am approaching this problem incorrectly. Does anyone have any ideas?

Thanks for your help.

Jason
 

Like [Forms]![MainSearch]![txtSearchCriteria]& "*"
 
Hello, if you use like in code, you can do this:

If rst.Fields(2) Like "[!c]*" Then
do something
end if

the "!" is like the "not" operator in this case "not like C*"

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top