emailing multiple reports

  • Thread starter Thread starter rjpohl
  • Start date Start date
R

rjpohl

I have an access 2003 form with entries that are used to make 2 separate
reports. I want to place a command button on the form to have both reports
attached to one email.

thanks for your help
 
you can do it, but (as far as i know) you cannot use the usual
DoCmd.SendObject

I believe you would need to use DoCmd.OutputTo, and save both reports
to a particular folder location. Then you can build an email in VBA
and attach those 2 documents.

so the OutputTo command would look like this (create the directory
first):

DoCmd.OutputTo acOutputReport, "rptTest", acFormatSNP, "C:\TempDir
\rptTest.snp"
DoCmd.OutputTo acOutputReport, "rptTest2", acFormatSNP, "C:\TempDir
\rptTest2.snp"



Then here is the code for creating the email:

Dim OlApp As Object
Dim OlMail As Object

Set OlApp = CreateObject("Outlook.Application")
Set OlMail = OlApp.createitem(olmailitem)

OlMail.Recipients.Add "(e-mail address removed)"

OlMail.Subject = "Here are your 2 reports"

OlMail.Body = "Please see attachments"

OlMail.Attachments.Add "C:\TempDir\rptTest.snp"
OlMail.Attachments.Add "C:\TempDir\rptTest2.snp"

OlMail.Display 'change this to OlMail.Send if you just want to send it
without previewing it
 
rjpohl said:
I have an access 2003 form with entries that are used to make 2 separate
reports. I want to place a command button on the form to have both
reports
attached to one email.

thanks for your help
 
Back
Top