Delete record if the message is not sent

P

Pietro

Hi all,
I'm using the below code to send a report according to the value of the
option group [Type] on my form,so once the user selects a value an outlook
new message appears and the report is attached and ready to send ,but if user
closes the Outlook message he gets the error "Run-time error '2501' The
SendObject action was cancelled",what i want to do is: if user does not send
the report,all the record is deleted and to close the form.Can anybody help?

If [Type] = 1 Then DoCmd.SendObject acReport, "Escalation",
"RichTextFormat(*.rtf)", , "", "", ,True, ""
If [Type] = 2 Then DoCmd.SendObject acReport, "SPLA",
"RichTextFormat(*.rtf)", ", "", "", ,, True, ""
If [Type] = 3 Then DoCmd.SendObject acReport, "Escalation",
"RichTextFormat(*.rtf)", ,"", "", , , True, ""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top