Microsoft
Access: Stop Empty Reports
As long as the report is bound to a table or query, there’s a
quick way to tell Access not to run a report if it contains no data.
- Open the report in Design view.
- In the Properties dialog
box for the report, click the Event tab.
- Click the On No Data property,
choose [Event Procedure] from the drop-down list, and click Build … to
launch the Visual Basic Editor.
- Enter the following:
Private
Sub Report_NoData(Cancel As Integer)
MsgBox ("Sorry--this report contains no data. Canceling...")
Cancel = -1
End Sub
- Save your work. The next time the report is run without
data, the message box will appear.
If you have any questions regarding this tip or need help
implementing it in your own projects, contact Ranelle Maltas, Application
Support Associate, at 472-0585 or e-mail at rmaltas2@unl.edu.

|