When the report's parameter query returns an error because of null

V

vegathena

I have a report that generates mailing labels for birthday mailing
cards. Its record source is a parameter query that asks for the
birthday month numeral.

The problem is that when there aren't any records for a birthday
month, the report opens up with an error. Instead of the report
displaying this error, I would like a message box to pop up that says
"No records found for this month".

How would I go about doing that?

Thanks for your help.
 
A

Allen Browne

Cancel the report's NoData event, and give a MsgBox() instead.

If you fired the report from code/macro, you will then get error 2501 back
in that routine. In code, use error handling to suppress that error.

Any calculated control on the report shows #Error when there is nothing to
calculate. For info on how to deal with that error without suppressing the
report, see:
Avoid #Error in form/report with no records
at:
http://allenbrowne.com/RecordCountError.html
 

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