VBA to send email from Access, adding report to body of email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acerimmer
    New Member
    • Feb 2013
    • 1

    #1

    VBA to send email from Access, adding report to body of email

    Access 2010 - add report to body of an email

    good morning,

    i have VBA code to create an email and attach an excel file,

    what i would like is code to add a report called REPORTMISSINGDA TES to the body of the email,

    this is the code i have so far, which works and adds everythng i wqant except the main body of the email

    Code:
    Private Sub Command31_Click()
     On Error GoTo Command31_Click_Err
     
    
    Dim Email As String
     Dim name As Variant
     Dim EMPloy As Variant
     Dim month As Variant
     
    month = MonthName([Forms]![STAFFATTENDANCEMenu]![StaffMonth])
     EMPloy = Forms!staffattendancezone!Staff
     name = DLookup("[STAFFNAME]", "[QRYSTAFFNAME]", "[ASA] = Forms!staffattendancezone!Staff")
     
    Email = (Forms!STAFFATTENDANCEAdjust!Email)
         DoCmd.SendObject acQuery, "STAFFATTENDANCEZONECheckEmployee", "ExcelWorkbook(*.xlsx)", [Email], "", "", "" & "Attendance Errors", "THIS IS WHERE I WANT THE REPORT TO GO" _
    
    End Sub
    Last edited by zmbd; Feb 25 '13, 11:43 AM. Reason: [Z{Please use the <CODE/> formatting button to format your posted code and SQL}]
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Please go to the bottom of this page.
    Click on the Microsoft Access/VBA Insights Sitemap
    Scroll down to article number 159
    This contains the basics for Outlook automation.

    Please keep in the following in mind:
    Out right requests for full code are against site policy.
    Bytes is not a code nor homework service. Please read the FAQ and posting guidelines before re-posting your question.
    >> Before Posting (VBA or SQL) Code.
    >> How to ask "good" questions -- READ BEFORE SUBMITTING A QUESTION!.
    >> POSTING_GUIDELI NES: Please Read Carefully Before Posting to a Forum.

    Comment

    Working...