NoData Event — Event Procedures Example
The following example shows how to cancel printing a report when it has no data. A message box notifying the user that the printing has been canceled is also displayed.
To try this example, add the following event procedure to a report. Try running the report when it contains no data.
Private Sub Report_NoData(Cancel As Integer)
MsgBox "The report has no data." _
& chr(13) & "Printing is canceled. " _
& chr(13) & "Check the data source for the " _
& chr(13) & "report. Make sure you entered " _
& chr(13) & "the correct criteria (for " _
& chr(13) & "example, a valid range of " _
& chr(13) & "dates),." vbOKOnly + vbInformation
Cancel = True
End Sub