Jump: Search:

Microsoft Access Developer Center

Table Design

Query Design

Form Design

Form Tips and Mistakes

Form Navigation Caption

Using a RecordsetClone

Synchronize Two Subforms

Late Bind Tab Subforms

Subform Reference to Control Rather than Field

Tab Page Reference


Combo Box Top Tips

Properties and Validation

Select First Item

Cascading Combo Boxes

Zip, City, State AutoFill

Report Design

Suppressing Page Headers and Footers on the First Page of Your Report

Add the NoData Event

Annual Monthly Crosstab Columns

Design Environment

Adding Buttons to the Quick Access Toolbar

Collapsing the Office Ribbon for more space

VBA Programming

Using Nz() to Handle Nulls

Avoiding Exits in the Body of a Procedure

Debugging Keys

Setting Module Options

Math Rounding Issues

Source Code Library

Microsoft Access Module VBA Library

Royalty Free VBA Modules

VBA Error Handling

Error Handling and Debugging Techniques

Error Number and Description Reference

Basic Error Handling

Pinpointing the Error Line

Performance Tips

Linked Database

Subsheet Name

Visual Source Safe

Deployment

Prevent Close Box

Disable Design Changes

Broken References

Simulating Runtime

Missing Package & Deployment Wizard

Microsoft Access Front-End Deployment

System Admin

Disaster Recovery Plan

Compact Database

Compact on Close

Database Corruption

Decompile Database

Bad DLL Calling Convention

Converting ACCDB to MDB

Cloud and Azure

Cloud Implications

MS Access and SQL Azure

Deploying MS Access Linked to SQL Azure

Additional Resources

Microsoft Access Help

MS Access Developer Programming

More Microsoft Access Tips

Technical Papers

Microsoft Access Tools

Connect with Us

Email NewsletterEmail Newsletter

FMS Development Team BlogDeveloper Team Blog

Facebook PageFacebook

Twitter with FMSTwitter

 

 

Add NoData Event to Microsoft 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:

Add No Data Event Procedure from Property Sheet

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:

No Data Event procedure in VBA IDE

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 Microsoft Access database objects and detects this tip, as well as hundreds of others.

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence