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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I handle errors from User's responses

Status
Not open for further replies.

mundia22

ISP
Apr 23, 2002
17
0
0
GB
Hi Guys, I have a button that brings up the New Email Message, when I cancel the operation I get runtime err 2501'the sendobject action was cancelled' debug or end dialogue box, how do I tell access to resume without this msg
 
If you used the Command button wizard, you would have (by default) had an error handler created as part of the button's "On Click" event.

All that you need to do now is check the source error number and, if its 2501, no nothing but exit the subroutine.

All other errors, however, would still be processed by displaying the error description to the user.

Private Sub cmdMailReport_Click()

On Error GoTo Err_cmdMailReport_Click

Dim stDocName As String

stDocName = "YourReportName"
DoCmd.SendObject acReport, stDocName

Exit_cmdMailReport_Click:
Exit Sub

Err_cmdMailReport_Click:
Select Case Err.Number
Case 2501
Case Else
MsgBox Err.Description
End Select
Resume Exit_cmdMailReport_Click

End Sub

Hope this helps,

00001111s
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top