Quick Find: Search for:
Free Resources
from FMS
 

Demos

Email Newsletter

Technical Papers

Tips and Techniques

Links

Book Recommendations

View all FMS products for Microsoft AccessMicrosoft Access Resource Center

 

 

"Thank you! Thank you!
I just finished reading this
document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.
" 
- Darren D.
 
  

 

Add NoData Event to Access Reports

Provided by: FMS Development Team

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.

FMS's Total Access Analyzer performs detailed analysis of your Access database objects and detects this tip, as well as hundreds of others. Find out more!

 

Return to the tips page.

Questions  l   Web questions: Webmaster   l   Copyright © 2008 FMS, Inc.

Celebrating 21 Years of Software Excellence