I was trying to add a On No Data event to my report with this snippet of code.
Code:
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this Trans Type and Date Range."
Cancel = True
End Sub
The report is called by this standard command which worked just fine till I tried to add the On No Data Event.
Code:
DoCmd.OpenReport strReportName, acViewPreview
Specifically I get this error (see picture below) on the Cancel = True line.
I have many other reports that use this method. Any ideas what's causing this?