Email a Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When i run a report, i would like it to automatically create an email (using
Outlook 2003) that includes the report (either as a PDF attachment or in the
body of the email) and also includes a predetermined message.

How do I do this?
 
bbddvv said:
When i run a report, i would like it to automatically create an email
(using
Outlook 2003) that includes the report (either as a PDF attachment or in
the
body of the email) and also includes a predetermined message.

How do I do this?


Maybe a button (called 'EmailWordCurrentReport') which runs a VBA 'Event
Procedure' (subroutine) like this ???

Private Sub EmailWordCurrentReport_Click()
Dim DocName As String
DocName = "My Report Name"
DoCmd.SendObject acReport, stDocName, "RichTextFormat(*.rtf)", , , ,
"Please Find Attached Report.", _
"Dear " _
& (Chr(13)) _
& (Chr(13)) & "Please find attached a summary report of blah, blah,
blah" _
& (Chr(13)) & "as requested." _
& (Chr(13)) & "" _

End Sub

This should produce the report, attach it to an email, add a subject, and
add some text to the body of the report.
Is this anything like what you wanted?

Martyn
 
Unfortunatly no, I wanted the email's body to be populated by the report
data. I wanted to avoid the whole attachment thing. Any other ideas?
 
In your first message you mentioned a pdf attachment but in your reply to
martyn's suggestion you seem to have changed your mind about attachments,
which makes it confusing.

Without knowing what is in the report you want to e-mail, I would suggest
that you output the report in say, txt format and then read it back into a
string variable and use it for the "message body" parameter in the
sendobject command. Would it do?

Good Luck,
Engin Tarhan
 
bbddvv said:
Unfortunatly no, I wanted the email's body to be populated by the report
data. I wanted to avoid the whole attachment thing. Any other ideas?

To create a formatted document to send as an email you will need to
use VBA code to create a largish string. This string will then be
passed to the SendObject command as the body of the email. For more
details including sample air code see my Tips page on this topic at
http://www.granite.ab.ca/access/email/formatted.htm.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
Back
Top