By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,274 Members | 2,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,274 IT Pros & Developers. It's quick & easy.

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

P: 1
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 REPORTMISSINGDATES 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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command31_Click()
  2.  On Error GoTo Command31_Click_Err
  5. Dim Email As String
  6.  Dim name As Variant
  7.  Dim EMPloy As Variant
  8.  Dim month As Variant
  10. month = MonthName([Forms]![STAFFATTENDANCEMenu]![StaffMonth])
  11.  EMPloy = Forms!staffattendancezone!Staff
  12.  name = DLookup("[STAFFNAME]", "[QRYSTAFFNAME]", "[ASA] = Forms!staffattendancezone!Staff")
  14. Email = (Forms!STAFFATTENDANCEAdjust!Email)
  15.      DoCmd.SendObject acQuery, "STAFFATTENDANCEZONECheckEmployee", "ExcelWorkbook(*.xlsx)", [email], "", "", "" & "Attendance Errors", "THIS IS WHERE I WANT THE REPORT TO GO" _
  17. End Sub
Feb 25 '13 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 5,397
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_GUIDELINES: Please Read Carefully Before Posting to a Forum.
Feb 25 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.