Override The SendOject Runtime Error

  • Thread starter Thread starter Peter W via AccessMonster.com
  • Start date Start date
P

Peter W via AccessMonster.com

I have an email sendobject routine that sends an email to the user. However,
if the user decides NOT to send the email, they get a runtime error 2501..
"The Sendobject action was canceled" with the END DEBUG buttons.

Is there a way to Override this system error with my own more discriptive
message and error handling if the email is not sent?

Thanks,
Peter
 
Hi Peter,

I had this problem this morning, but realised I hadn't added any error
handling to my code:

Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

**YOUR CODE**

Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click

End Sub

When you cancel out of sending the email, you now just get a msg box
saying "The SendObject action was cancelled".

Hope that helps,

David
 
Back
Top