Table of contents
Collapse the table of content
Expand the table of content

Close a Report Automatically If It Does Not Contain Any Records

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

The following example shows how to use the NoData event to cancel opening or printing a report when it has no data. A message box notifying the user that the report has no data is also displayed.

Private Sub Report_NoData (Cancel As Integer) 

    ' Display message to user. 
    MsgBox "There are no records to report", vbExclamation, "No Records" 

    ' Close the report. 
    Cancel = True 

End Sub
© 2018 Microsoft