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

    Lightbulb Send Report as PDF Attachment & Pasted in to Body of Email

    hi

    i want to know how i can expand below code to send report also pasted into the body of email.

    This Code is working good but this is only send as PDF attachment.

    Please help

    Option Compare Database


    Private Sub Command0_Click()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim eml As String
    Dim vOfficeID As String


    Set db = CurrentDb
    Set rs = db.OpenRecordset("SDE_Email_List", dbOpenDynaset)
    rs.MoveFirst
    Do


    vOfficeID = rs("OfficeID")


    DoCmd.SetWarnings False
    DoCmd.RunSQL "SELECT [MDO_Sales_Table].* INTO [SDE_Output_table] FROM [MDO_Sales_Table] WHERE ((([MDO_Sales_Table].OfficeID)= '" & vOfficeID & "'))", -1
    DoCmd.SendObject acSendReport, "Report Name", acFormatPDF, rs("Email Address"), rs("CC"), "", "Subject", "Please find attached file", 0, False

    rs.MoveNext


    Loop Until rs.EOF
    rs.Close
    db.Close
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you dont need both. Now you are doubling the email by sending 2 documents.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why are you saving records into a table? Why not just apply filter to report?

    If you want data in body of email, don't use report. Loop through recordset and concatenate data into a string that can be used in place of "Please find attached file".
    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 email with Attachment
    By scoe in forum Programming
    Replies: 3
    Last Post: 09-23-2014, 03:02 AM
  2. How to send email without attachment
    By behnam in forum Programming
    Replies: 3
    Last Post: 07-30-2014, 08:24 AM
  3. send email with attached image in body
    By trevor40 in forum Programming
    Replies: 5
    Last Post: 02-14-2014, 01:17 AM
  4. Send Report as body of email
    By chris.williams in forum Reports
    Replies: 3
    Last Post: 09-15-2012, 09:43 AM
  5. Send in Email Body vice Attachment
    By cassidym in forum Programming
    Replies: 2
    Last Post: 10-20-2010, 06:21 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