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

Search criteria with no text.

Status
Not open for further replies.

kp1279

Programmer
Jan 21, 2005
43
GB
I have created a search criteria in a field, I have used:

' Like "*" & [text] & "*" '

If I put in 'LON' it will return entries that include text like 'LONDON' 'LONGTON' etc.

If I leave the text blank, and just click OK then it will bring back all entries, how can I change it so that if the user doesn't enter a search criteria, then it will not bring back any result, or promt for a criteria?

KP
 
WHERE ...
([yourField] Like '*' & [text] & '*' And Trim([text] & "")<>"") ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Worked great.

Thanks for another solution.

KP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top