Search form returns first record if the data was not found???

Jasontm01

Registered User.
Local time
Today, 13:59
Joined
Feb 1, 2004
Messages
21
Hi all. I have a search form that looks up a field in a table and returns some info. The problem I have is, if someone puts in a value that does not exist in the table it just returns the data for the first records information or stays on whatever record is already open.

This can be confusing as they dont know if what they found is valid or not.

Is there a way I can make the search return no records at all (blank record) or at least select a specific record I setup that tells them their entry was not found??

Thanks
 
Jason,

Need more info here. How are you searching? Are you using
filters, queries? Is the form bound? A sample?

Wayne
 
Its just a combo box lookup type of search right now. They type the value such as "214" and hit enter and it brings up the record with that number in it.

I am open to changing how the search is done if its not possible to prevent this problem using the combo box lookup but I'm not entirely sure how to do it with code.
 
Jason,

You can restrict the combo to only display data that will be in
the form. Look for Limit to List in the combo's property sheet.

I take it that your form is based on a query and the combo
is "unbound".

Wayne
 
Yes, that is how I am doing it right now. I tried using the limit to List property, which works because it gives an error about the item not being in the list.. However once they do that it Opens the combo box (which I dont want it to do) and they have to hit ESC a few times to clear the field before they can proceed.
 
Try putting this in the On Error part...

Code:
Me.txtSearchBox = ""
Me.listSearchResults.SetFocus
________
CHEAP VAPORIZER
 
Last edited:

Users who are viewing this thread

Back
Top Bottom