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

Include Report in Email Without Using SendObject

P: n/a
I'm using Access 97. In the OnClick event of a button I have the code
below. I looks at txtEmail and sends an e-mail message without
further action from the user (user does not have to click Send as he
would if he used DoCmd.SendObject.) However, I want to attach a
report in Snapshot format. How would I modify my code to include a
report?

Thank you,
JD

Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object

strEmail = Me!txtEMail
Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.createitem(0)
With oMail
.to = strEmail
.body = "Your vacation and/or personal holidays have been
approved or rejected. See attached."
.Subject = "Vacation and/or Personal Holiday Request"
.Send
End With
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
<jd****@yahoo.com> wrote in message
news:75**************************@posting.google.c om...
I'm using Access 97. In the OnClick event of a button I have the code
below. I looks at txtEmail and sends an e-mail message without
further action from the user (user does not have to click Send as he
would if he used DoCmd.SendObject.) However, I want to attach a
report in Snapshot format. How would I modify my code to include a
report?


You would first use DoCmd.OutputTo to create a file on disk of your
Snapshot report and then use your Outlook automation (line below) to add
the file as an attachment. You might want to include a line at the end of
your procedure to delete (Kill) the file from disk.

..Attachments.Add (AttachmentPath)

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #2

P: n/a
"Rick Brandt" <ri*********@hotmail.com> wrote in message news:<bm************@ID-98015.news.uni-berlin.de>...
You would first use DoCmd.OutputTo to create a file on disk of your
Snapshot report and then use your Outlook automation (line below) to add
the file as an attachment. You might want to include a line at the end of
your procedure to delete (Kill) the file from disk.

.Attachments.Add (AttachmentPath)


Thanks, Rick. Do I have to save this to my hard drive, or can I save
it to a network drive (on the server)?

JD
Nov 12 '05 #3

P: n/a
<jd****@yahoo.com> wrote in message
news:75**************************@posting.google.c om...
"Rick Brandt" <ri*********@hotmail.com> wrote in message

news:<bm************@ID-98015.news.uni-berlin.de>...
You would first use DoCmd.OutputTo to create a file on disk of your
Snapshot report and then use your Outlook automation (line below) to add the file as an attachment. You might want to include a line at the end of your procedure to delete (Kill) the file from disk.

.Attachments.Add (AttachmentPath)


Thanks, Rick. Do I have to save this to my hard drive, or can I save
it to a network drive (on the server)?


You should be able to save it anywhere, but if you just want to delete the
file after it has been attached to the Email, then you might as well save
it to a local disk so that the I/o is faster.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.