Tip of the Month:  October 2005
Previous Tip's Home Next
 

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.

  1. Open the report in Design view.
  2. In the Properties dialog box for the report, click the Event tab.
  3. Click the On No Data property, choose [Event Procedure] from the drop-down list, and click Build … to launch the Visual Basic Editor.
  4. Enter the following:

    Private Sub Report_NoData(Cancel As Integer)
    MsgBox ("Sorry--this report contains no data. Canceling...")
    Cancel = -1
    End Sub

  5. 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.

Previous Tip's Home Next