M
Matthew
I have a report that I have set the "On No Data" value to run the following
macro:
Private Sub Report_NoData(Cancel As Integer)
MsgBox ("Sorry, no records were found with the result you have
selected.")
Cancel = True
End Sub
This somehow is a problem when I use another macro to call the report:
Function PrintReport()
DoCmd.OpenReport "NewCatalog", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPrintAll, , , , 1, True
DoCmd.Close acReport, "NewCatalog", acSaveNo
End Function
The error is:
Run-time error '2501':
The OpenReport action was canceled.
Is there a way to suppress this error, or is there a better way to cancel
the printing of the report if there is no data?
Matthew
macro:
Private Sub Report_NoData(Cancel As Integer)
MsgBox ("Sorry, no records were found with the result you have
selected.")
Cancel = True
End Sub
This somehow is a problem when I use another macro to call the report:
Function PrintReport()
DoCmd.OpenReport "NewCatalog", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPrintAll, , , , 1, True
DoCmd.Close acReport, "NewCatalog", acSaveNo
End Function
The error is:
Run-time error '2501':
The OpenReport action was canceled.
Is there a way to suppress this error, or is there a better way to cancel
the printing of the report if there is no data?
Matthew