Results 1 to 3 of 3
  1. #1
    pjtessi9 is offline Novice
    Windows 10 Office 365
    Join Date
    May 2019
    Posts
    12

    Post Send an email from a FORM using Microsoft Outlook

    Hi folks,
    When I am in a FORM, I want to be able to click on a button and send an email using Microsoft Outlook.
    But I also want to include an attachment that is stored in the database and accessible in the FORM (normally the attachment is a .docx file or a PNG file).

    I have found some vba code and everything is working fine except I cannot add the attachment in the email.

    Can some one help me writing the propre vba code to add the attachment in the email.

    I have included a sample database so you can see what I mean and the vba code I found and wrote.

    The form is named frm_McNeil
    The table containing the attachment is McNeil

    Thanks for your help. :-)
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Attachment would have to be saved out to folder location then attached to email using Outlook automation, not DoCmd.SendObject. This is a common topic.

    Example code to save attachment to folder: https://docs.microsoft.com/en-us/off...ile-method-dao

    Example code to automate Outlook and attach a file: https://vbahowto.com/2020/04/28/how-...0automation%29
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 07-12-2018, 05:38 AM
  2. Send Email via Outlook from an Access form
    By ramirezx@ddmfg.com in forum Programming
    Replies: 3
    Last Post: 07-11-2018, 11:22 AM
  3. Send email using VBA and outlook
    By hinchi1 in forum Access
    Replies: 8
    Last Post: 10-17-2017, 12:11 PM
  4. Replies: 13
    Last Post: 10-06-2015, 09:12 AM
  5. Replies: 5
    Last Post: 09-14-2015, 07:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums