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

What is a good criteria 1

Status
Not open for further replies.

downtime

IS-IT--Management
May 16, 2002
98
US
During a query I want the user to no if there where no records matching the criteria, instead of a blank results.
Any suggestions?
 
Is he running the query directly or is he running a report based on the query? If he's running it directly, what form did you want the notification to take?
 
If he is running it directly and I would like a pop up or just a generic form.
 
If your user is running the query directly (clicking on the query in the database window) then there really isn't anything you can do about the results.

However, a better way would be to set up a form and have the user click a button on the form to run the query. You could then do a preliminary DCount function on the query and check for records. If the Dcount returns zero records then don't run the query. Instead pop-up a msgbox telling the user no records were found.

If Dcount("IDfield","queryname") = 0 then
msgbox "no records"
else
docmd.openquery("queryname")
end if Maq [americanflag]
<insert witty signature here>
 
I've also been looking for this! Maq, where would you put the above function, in the onclick event procedure of the button?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top