Cancel printing if a report doesn't contain any records

Microsoft Office Access 2003

Show All Show All

Cancel printing if a report doesn't contain any records

  1. Open the report in Design view.
  2. Double-click the report selector to display the report's property sheet.
  3. Set the OnNoData property to [Event Procedure] or to the name of a macro that cancels previewing or printing the report.
    • If you use an event procedure, use the MsgBox statement to display a message, and set the Cancel argument of the Report_NoData sub procedure to True.
    • If you use a macro, use the MsgBox action to display a message that describes why there is no data for the report, and use the CancelEvent action to cancel printing or previewing the report.

Note  The Employee Sales by Country report in the Northwind sample database uses an event procedure in the OnNoData property. To view this report, open the Northwind database in the Samples subfolder of your Microsoft Office folder, and then open the Employee Sales by Country report in Design view.