System message

  • Thread starter Thread starter Rujie
  • Start date Start date
R

Rujie

I have a macro to display no data message, when a report
is open but no data. Access always displays The
CancelEvent action is canceled. How can I disable this MS
Access message? Docmd.SetWarning False did not work.
Thanks
 
You cannot "cancel" the "CancelEvent" message; but you can trap it and
ignore it, although this must be done in VBA, not in a macro.

On Error Resume Next
DoCmd.OpenReport "reportname"
If Err.Number = 2501 Then
' ignore...this is the cancel event error
ElseIf Err.Number <> 0 Then
MsgBox "An error has occurred: " & Err.Number & " " & Err.Description
End If
 
Back
Top