Attaching a report to an e-mail

G

Guest

Hello,
I am trying to give an option for the user to send an e-mail thorugh a form.
To send the mail I am using a code which is very familiar to the
sbSendMessage sub given by msdn (can be found at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_ac_olauto.asp).
The problem is I want to attach a report to the e-mail (the report is closed
when the e-mail is to be sent). Is there any way to attach the report as a
word document (or snapshot) to the e-mail using code?
thank you
 
S

Steve Schapel

Dshemesh,

Try it like this...
DoCmd.SendObject acSendReport, "NameOfYourReport", acFormatSNP, strTo

....or, acFormatRTF.
 
T

TomInQ8

Here is one that I use:
Dim stDocName As String

stDocName = "Site Payroll Errors"

DoCmd.SendObject acReport, stDocName, acFormatRTF, "" _
& "(e-mail address removed)", , , "Site Reporting Error for """ _
& [First] & " " & [Last] & " Week Ending: " & [week ending] & "" _
& " Error ID: " & [ErrorID], [Description]

The result is an email created in Outlook related to a field in a my
form. I use a button to do this. It attaches the referenced report in
rtf format, fills in the subject line for me, and takes data from the
form I am working in and puts it in the body of the message. It also
can support To:, Cc:, and Bcc: recipients. The report itself is also
linked to my form record.

-Tom
 

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