Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stop the "OpenReport Action cancelled" error message 1

Status
Not open for further replies.

BradCollins

Technical User
Sep 2, 2003
116
AU
I have created a macro that runs "on no data", the macro provides a msgbox with an error, then cancels the report open function.

My problem is that when this occurs, access then gives an additional error of "The OpenReport action was cancelled", as I alreday know this, and this is what I wanted to happen, is there a way of stopping this from popping up

Regards,
Brad
 
Brad
If you add the action CancelEvent, following your MsgBox action, to your Macro, does that do it?

Tom
 
You need to add error handling in the procedure that opens the report. Something like:

On Error Goto ErrHandler

DoCmd.OpenReport....

ExitHandler:
Exit Sub

ErrHandler:
Select Case Err
Case 2501 'canceled
Resume ExitHandler
Case Else
'what ever
End Select
End Sub

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top