emailing multiple reports

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
 
G

ghetto_banjo

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
 
D

De Jager

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top