test for no data before print view

Mapes

Registered User.
Local time
Today, 06:45
Joined
Nov 14, 2000
Messages
11
We have a report that prompts for query criteria but when there is no data the report preview displays the report headers and labels with a one row '#error' message instead of the data which is ok but not user friendly.

I would like to change the '#error' message to write 'no data meets this criteria' or better yet test the query for data and if there is none to display a form with the appropriate message.

Thanks for your help.
 
I had the same problem. Check out the Modules & VBA forum and look at the message titled "Skip function if table is empty." It would be quite simple to use it on the query that feeds your report rather than a table.
 
Thanks brucesilvers, I found the code which works:

If DCount("*","TableName"or"QueryName")<1 Then Exit Sub
 

Users who are viewing this thread

Back
Top Bottom