G
Guest
How do I suppress the 'OpenReport action was canceled' message when I set the
cancel = true in the NoData event.
cancel = true in the NoData event.
Wayne Morgan said:You need an error handler in the code that opened the report. The error
number you're looking for is 2501.
Example:
Private Sub cmdMyButton_Click()
On Error GoTo CheckError
DoCmd.OpenReport "rptMyReport, acViewPreview
ExitHere:
Exit Sub
CheckError:
If Err.Number = 2501 Then Resume ExitHere
MsgBox "Error # " & Err.Number & vbCrLf & Err.Description, vbOkOnly +
vbCritical, "Error in cmbMyButton_Click"
End Sub
Wayne said:You need an error handler in the code that opened the report. The
error number you're looking for is 2501.
Example:
Private Sub cmdMyButton_Click()
On Error GoTo CheckError
DoCmd.OpenReport "rptMyReport, acViewPreview
ExitHere:
Exit Sub
CheckError:
If Err.Number = 2501 Then Resume ExitHere
MsgBox "Error # " & Err.Number & vbCrLf & Err.Description, vbOkOnly +
vbCritical, "Error in cmbMyButton_Click"
End Sub