Do not print report if no results from query???

T

tcek

we run reports every day. the data is based on real time data and some of the
queries that the reports originate from do not have any results. In an effort
to save paper, I would only like to print a report if there are values in the
report. I want to avoid printing a blank report. any ideas would be welcome.
thanks in advance.
 
A

Adam Milligan

In the report's "On No Data" event put something like the following code:

msgbox "The report you are trying to print has no data. Try again later"
cancel=true

hope that helps
 
R

RonaldoOneNil

Reports have a property called On No Data. Set this to [Event procedure]
click on the elipses button and simply put in the code
Cancel = True
 
A

Allen Browne

Cancel the report's NoData event.
Access fires this event if the report's source generates no records.

If you open the report programatically, Access uses error 2501 to notify you
that the report did not open. Use error handling to ignore this error.
Alternatively, use a wrapper function to open the report, and have it handle
the error, like this:
http://allenbrowne.com/AppPrintMgtCode.html#OpenTheReport
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top