Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:10:45+00:00 2026-06-04T07:10:45+00:00

Thanks in advance for any help. I have the following code which when clicked

  • 0

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 🙂

Private Sub emailinvoiceF_Click()
On Error GoTo Err_emailinvoiceF_Click

If MsgBox("Email the invoice?", vbYesNo) = vbYes Then

Dim strMessage
strMessage = "Dear " & First & " " & Last & "," _
& vbCrLf & vbCrLf & "Thank you for your order: (" & DeliveryID & "), please find attached invoice." _
& vbCrLf & vbCrLf & "If you require any further information please do not hesitate to contact us." _
& vbCrLf & vbCrLf & "Kind Regards," _
& vbCrLf & vbCrLf & "SMI Hardwoods" _
& vbCrLf & vbCrLf & "Tel: 01206 396725" _
& vbCrLf & vbCrLf & "www.smi-hardwoods.com" _


    Dim stDocName As String

    stDocName = "InvoiceF"
    DoCmd.SendObject acReport, stDocName, acFormatPDF, [E-mail address], , , "SMI Hardwoods Invoice Ref:" & DeliveryID & ".pdf", strMessage
End If

Exit_emailinvoiceF_Click:
    Exit Sub

Err_emailinvoiceF_Click:
    MsgBox Err.Description
    Resume Exit_emailinvoiceF_Click

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:10:46+00:00Added an answer on June 4, 2026 at 7:10 am

    DoCmd.SendObject command is very limited. It does not allow you attaching files from disk. Because of this limitation you have no control over the file name and number of files to be attached using DoCmd.SendObject.

    You may find this article helpful: http://msdn.microsoft.com/en-us/library/aa167323(v=office.11).aspx.

    I used Outlook.Application object in the past and found it OK. It allows to have some user interaction before sending an email. Also, it goes straight into Outlook so tracking might be easier. This approach has its own cons, though.

    As per your question regarding the Success message, you can add the following to your code:

    ....
        DoCmd.SendObject acReport, stDocName, acFormatPDF, [E-mail address], , , "SMI Hardwoods Invoice Ref:" & DeliveryID & ".pdf", strMessage
    
        'Display success message
        MsgBox("Successfully sent on: " & Date())
    End If
    
    Exit_emailinvoiceF_Click:
        Exit Sub
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using c# .net. Thanks in advance for any help. I have searched
Thanks for any help in advance, I can't wrap my SQL skills around this
thanks in advance for any help. I've spent today battling this and I think
Thanks in advance for your help experts. I want to be able to copy
Thanks in advance. This is my sample code. Whenever i try to run it
Thanks in advance.. I have a windows phone application. In that I am showing
thanks in advance for the replies.... I have started to create a network topology
Win-XP / Excel 2003 / VBA .... I have the following piece of code
I have the following code to encrypt a value (listed below). Now I would
I have written an ASP.NET page for a customer which uses the C# Facebook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.