I use code below to send email messages.
When canceling sending mail all seems to work.
But if I send mail it doesn't update status, but is goes directly to MsgBox "Can't Create Report"
What did I wrong?
When canceling sending mail all seems to work.
But if I send mail it doesn't update status, but is goes directly to MsgBox "Can't Create Report"
What did I wrong?
Code:
On Error GoTo Err_DblClick_Click
If not IsNull(Me.EmailAddress) Then
DoCmd.SendObject acReport, [Report], "PDFFormat(*.pdf)", [EmailAddress], "", "", "Subject", "", True, ""
MsgBox "Message Send"
Me.Status = Me.Status + 1
Else
DoCmd.CancelEvent
End If
Exit_DblClick_Click:
Exit Sub
Err_DblClick_Click:
If Err.Number = 2501 Then
MsgBox "Send Message is Cancelled"
Resume Exit_DblClick_Click
Else
MsgBox "Can't Create Report"
Exit_DblClick_Click
End If
End Sub