I have the following code behind a button on a form that a user clicks on to email the information on the screen via a report. It creates the info in a PDF format, opens outlook and attaches the PDF.
The problem I am having is if a user closes/cancels the email without sending they get a "2501" error. I don't want this error or the pop-up for this error to appear. I just want it to close/cancel the email and go back to the form again.
Here is my code:
Private Sub cmdEmailRpt_Click()
On Error GoTo Err_cmdEmailRpt_Click
Dim stDocName As String
stDocName = "rptAudit_Emails"
DoCmd.SendObject acReport, stDocName, acFormatPDF
'If the user closes the Email screen without sending.
If Err.Number = 2501 Then
What am I doing wrong?