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

    Send Report & table as attachment MS access

    This Below codes is working good for me send PDF Report as attachment. but i want also send table as attachment.

    can any one help me to expand this code.


    Private Sub Command9_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("SM_Email_List", dbOpenDynaset)
    rs.MoveFirst
    Do
    vSMID = rs("SM")


    DoCmd.SetWarnings False
    DoCmd.RunSQL "SELECT [SM_Main_Table].* INTO [SM_Main_Output] FROM [SM_Main_Table] WHERE ((([SM_Main_Table].SM)= '" & vSMID & "'))", -1


    DoCmd.SendObject acSendReport, "SM_SALES_REPORT", acFormatPDF, rs("Email Address"), rs("CC"), "", "SM Sales & Availability Report for " & rs("SM"), "Dear Sales Manager, Please find attached Sales and Availability Report. If you have any query regarding your Structure/Area Please contact your Sales coordination department", 0, False
    DoCmd.SendObject acSendTable, "SM_Main_Output", acFormatXLS, rs("Email Address"), rs("CC"), "", "SM Sales & Availability Report for " & rs("SM"), "Dear Sales Manager, Please find attached Sales and Availability Report. If you have any query regarding your Structure/Area Please contact your Sales coordination department", 0, False

    rs.MoveNext


    Loop Until rs.EOF
    rs.Close
    db.Close


    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Can't use SendObject to include multiple attachments.

    Will have to use email automation, usually with Outlook. This requires first saving the objects as external files then attaching those files to email object. Common topic in forum. Here is one https://www.accessforums.net/program...nts-55289.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. Replies: 2
    Last Post: 09-03-2015, 11:33 AM
  2. Replies: 3
    Last Post: 10-13-2014, 05:48 PM
  3. Send email with Attachment
    By scoe in forum Programming
    Replies: 3
    Last Post: 09-23-2014, 03:02 AM
  4. Replies: 14
    Last Post: 04-16-2014, 11:05 AM
  5. Replies: 1
    Last Post: 02-14-2012, 07:08 PM

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