Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess - How to return result of a sendmail?
    text
    copied!<p>Thanks in advance for any help. I have the following code which when clicked creates an email, inserts the body and customer email address and attaches a copy of the invoice. I have two questions, one is it possible to change the name of the attached file, at the moment it's just invoiceF.pdf could do with it being the reference of the delivery. AND secondly, is it possible to catch the result of the send mail? I know if the email isn't sent, just closed, access puts an information box up saying "The send object action was cancelled", i want to catch the "successfully sent" confirmation and add today's date to a box [invoiceemailed]. Thanks to anyone in advance of their help :) </p> <pre><code>Private Sub emailinvoiceF_Click() On Error GoTo Err_emailinvoiceF_Click If MsgBox("Email the invoice?", vbYesNo) = vbYes Then Dim strMessage strMessage = "Dear " &amp; First &amp; " " &amp; Last &amp; "," _ &amp; vbCrLf &amp; vbCrLf &amp; "Thank you for your order: (" &amp; DeliveryID &amp; "), please find attached invoice." _ &amp; vbCrLf &amp; vbCrLf &amp; "If you require any further information please do not hesitate to contact us." _ &amp; vbCrLf &amp; vbCrLf &amp; "Kind Regards," _ &amp; vbCrLf &amp; vbCrLf &amp; "SMI Hardwoods" _ &amp; vbCrLf &amp; vbCrLf &amp; "Tel: 01206 396725" _ &amp; vbCrLf &amp; vbCrLf &amp; "www.smi-hardwoods.com" _ Dim stDocName As String stDocName = "InvoiceF" DoCmd.SendObject acReport, stDocName, acFormatPDF, [E-mail address], , , "SMI Hardwoods Invoice Ref:" &amp; DeliveryID &amp; ".pdf", strMessage End If Exit_emailinvoiceF_Click: Exit Sub Err_emailinvoiceF_Click: MsgBox Err.Description Resume Exit_emailinvoiceF_Click End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload