Results 1 to 3 of 3
  1. #1
    taniko006 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    1

    send an email with 2 attachments pdf and excel

    I am trying to change somebodies code to sent 2 attachments in one email. Before it sent out each attachment in a separate email.
    How would you do it? I was trying to change the DoCmd.SendObject acSendReport to DoCmd.OutputTo acOutputReport,The code looks like this:
    If InStr(1, Me.Email.Value, "@") > 0 Then


    DoCmd.SendObject acSendReport, "RPT_WO_ServPro", acFormatPDF, Me.Email.Value, , , _
    "Open Work Order Report - " & Me.Serv_Pro.Value, _
    Email_Body1, False

    DoCmd.SendObject acSendQuery, "Open Work Orders - Service Provider", acFormatXLS, _
    Me.Email.Value, , , "Open Work Order Report - " & Me.Serv_Pro.Value, _
    Email_Body1, False

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I believe the only way to do this is to automate Outlook and create an Attachments object. So something like this ...
    Code:
    'Reference Microsoft Outlook and
    'use early binding
    Dim objOutlook As New Outlook.Application
    Dim objNewEmail As MailItem
    Dim objAttachReport As Attachments
    'Instantiate your objects
    Set objNewEmail = objOutlook.CreateItem(olMailItem)
    Set objAttachReport = objNewEmail.Attachments

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Can't use SendObject to include multiple attachments. Must use automation code, usually with Outlook objects.

    Common topic, start with:
    https://www.accessforums.net/access/...ail-53868.html
    https://www.accessforums.net/program...ook-21903.html
    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.

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

Similar Threads

  1. Send Multiple csv attachments by email
    By shaunacol in forum Import/Export Data
    Replies: 16
    Last Post: 07-20-2015, 12:22 PM
  2. Replies: 5
    Last Post: 05-07-2014, 09:25 AM
  3. Send email with attachments not empty
    By JJCHCK in forum Programming
    Replies: 3
    Last Post: 09-23-2011, 10:29 AM
  4. Send email with attachments
    By rbiggs in forum Programming
    Replies: 12
    Last Post: 07-23-2011, 12:50 PM
  5. Send Report and Attachments in Email
    By Pimped in forum Programming
    Replies: 1
    Last Post: 06-21-2011, 02:51 AM

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