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

Filter-by-Form: No returns problem 1

Status
Not open for further replies.

Cads

Technical User
Jan 17, 2000
40
GB
Have created a Filter-by-form facility and have successfully restricted the search fields to only those I want the user to be able to search on. (Drop-down combo boxes present user with all values).

This works fine if the user chooses one field on which to search. However, if they choose combinations of fields it is quite likely that no records match the criteria. When this occurs the whole of the Details section of the form is blanked out - I mean all fields completely disappear!. What's more the screen seems to freeze in this condition and I have to close it down and re-open it to return things to normal.

Can anyone tell me what's happening here and can anyone tell me how I can trap this condition in VBA so that I can handle it smoothly? I realise I could try and disable all the other fields when one is chosen so the user can only search on one at a time, but I see logistical problems doing it that way. I just want to trap it, inform them, and let them try again. Ta! [sig]<p>Steve House<br><a href=mailto:shouse@icaew.co.uk>shouse@icaew.co.uk</a><br><a href= Inst of Chartered Accts of England & Wales</a><br> [/sig]
 
In the form where you are receiving the results, place a hidden text box. Set this textbox Control Source to:

=Count(*)

This can be used to evaluate if the query returned any records. You'll have to write a conditional statement so if the textbox = 0 then a message box saying &quot;No Records Returned&quot;......, then another line to the close the form.

HTH
RDH [sig]<p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top