Do you want to avoid displaying or printing blank reports? Maybe the data source or filter on your report has no records to print. There's a simple way to trap this and avoid running an empty report by using the report's NoData event.
On the Report Properties form, Events tab, select [Event Procedure] from the drop down list:
Then click the [...] button to open the code editor.
The NoData event is triggered before the report is printed or displayed (for preview). It detects if the report has no records. By setting the variable ‘Cancel’ to True, the report is suppressed:
It is best to provide a prompt to the user outside of the report. If multiple reports are being generated, you do not want each report to stop and wait for the user's intervention to continue.
The following demo offers an example of how to handle the NoData event. Use the form to launch the reports, and see how the report without data is handled.
Our Total Access Analyzer performs detailed analysis of your Microsoft Access database objects and detects this tip, as well as hundreds of others.