Evening all
Can someone advise me on the following problem, please?
Am using the SendObject method to dispatch attachments within an email (MS Word Output from a report). The process works find UNTIL the user decides to change their mind and not send an e-mail(!), i.e. the message is closed at top right-hand of Outlook form [x].
I get what I can only describe as/or what seems to be like an 'Access' message, (as opposed to 'error-handling' message, - my error-handling code normally display the error number as well as the location from which error is triggered):
" The SendObject action was cancelled..
You used a method of the DoCmd oject ot carry out an action Visual Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked Cancel in the dialog box that asks if you want to save the changes you made to the form."
I then click 'OK' to this message, and the whole form is locked/frozen. (Have to [ctrl]+[alt]+[delete] out of the database system to close & then reopen].
I've been thro' this over & over again, trying to trap the error 2501, debugging, breakpoints, etc. Here is an example of my code:
Private Sub cmdRunCode_Click()
'Open Report then send e-mail.
On Error GoTo cmdRunCodeErr
If IsNull(Me.cboReportSelectionType) Then
MsgBox "Please Select a ReportType", vbOKOnly, "ReportType Needed for Report."
Exit Sub
Else
DoCmd.SendObject acReport, "rptEmailReportByGivenReportType", "RichTextFormat(*.rtf)"
End If
cmdRunCodeExit:
Exit Sub
cmdRunCodeErr:
'This traps the Output to Error message
If Err = 2501 Then
MsgBox "You've chosen not to send this email", vbOKOnly, "Message not sent"
Exit Sub
Else
MsgBox "Error within Private Sub cmdRunCode_Click(). Error No: " & Err.Number & ". Error: " & Err.Description & "."
Resume cmdRunCodeExit
End If
Have searched the forums on this site, etc & have taken note of all the (very useful) advice on error-trapping & so on, but to no avail.
Can anyone help? Many thanks in advance.
Magnetar
Can someone advise me on the following problem, please?
Am using the SendObject method to dispatch attachments within an email (MS Word Output from a report). The process works find UNTIL the user decides to change their mind and not send an e-mail(!), i.e. the message is closed at top right-hand of Outlook form [x].
I get what I can only describe as/or what seems to be like an 'Access' message, (as opposed to 'error-handling' message, - my error-handling code normally display the error number as well as the location from which error is triggered):
" The SendObject action was cancelled..
You used a method of the DoCmd oject ot carry out an action Visual Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked Cancel in the dialog box that asks if you want to save the changes you made to the form."
I then click 'OK' to this message, and the whole form is locked/frozen. (Have to [ctrl]+[alt]+[delete] out of the database system to close & then reopen].
I've been thro' this over & over again, trying to trap the error 2501, debugging, breakpoints, etc. Here is an example of my code:
Private Sub cmdRunCode_Click()
'Open Report then send e-mail.
On Error GoTo cmdRunCodeErr
If IsNull(Me.cboReportSelectionType) Then
MsgBox "Please Select a ReportType", vbOKOnly, "ReportType Needed for Report."
Exit Sub
Else
DoCmd.SendObject acReport, "rptEmailReportByGivenReportType", "RichTextFormat(*.rtf)"
End If
cmdRunCodeExit:
Exit Sub
cmdRunCodeErr:
'This traps the Output to Error message
If Err = 2501 Then
MsgBox "You've chosen not to send this email", vbOKOnly, "Message not sent"
Exit Sub
Else
MsgBox "Error within Private Sub cmdRunCode_Click(). Error No: " & Err.Number & ". Error: " & Err.Description & "."
Resume cmdRunCodeExit
End If
Have searched the forums on this site, etc & have taken note of all the (very useful) advice on error-trapping & so on, but to no avail.
Can anyone help? Many thanks in advance.
Magnetar