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!

How can I trap an error when using a query to search ?

Status
Not open for further replies.

testkitt2

Technical User
Apr 28, 2004
193
US
Good eve to all...

I have a query that uses the following criteria:
Code:
Like [Enter the first few characters to search by: ] & "*"
the above allows the user the flexibility of searching with only the first few characters. But if you enter invalid characters the query will return a page with blank results.
In a report you could trap this error with the following event.

On No Data (event)
Code:
MsgBox "There is no data for this category,.... Canceling report..."
    Cancel = -1
with the above the user will be alerted of his error.

Sorry for being long winded.... What I need if possible is something I could use to trap a wild card search error in a query. So that when a user enters an invalid wild card he/she will presented with a msg and the search cancelled.

Any help will be greatly appreciated.

Thank you
JZ


Testkitt2
 
If you are entering the search criteria into a field on a form then you can control the key strokes as you wish. See thread700-1090566 for a sample code.

________________________________________
Zameer Abdulla
Visit Me
If you have never been hated by your child, you have never been a parent.[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top