Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Email attachments

0 views
Skip to first unread message

DeanT

unread,
Feb 28, 2008, 9:08:07 AM2/28/08
to
I want to send email with 2 report attachments. My coding is below. The
problem I have is this coding only attaches the first report. How do I add in
the 2nd report into the coding. I only want one email sent with both reports
attached.

Function Send_RC()

On Error GoTo Send_RC_Err

DoCmd.OpenReport "Record of Complaint", acViewPreview, "",
"[Complaints]![ComplaintNumber]=[Forms]![ComplaintForm]![ComplaintNumber]",
acNormal

DoCmd.OpenReport "AckLetter", acViewPreview, "",
"[Complaints]![ComplaintNumber]=[Forms]![ComplaintForm]![ComplaintNumber]",
acNormal

DoCmd.SendObject acReport, "Record of Complaint",
"SnapshotFormat(*.snp)", "", "", "", "Consumer Complaint", "", True, ""

Send_RC_Exit:

Exit Function

Send_RC_Err:

MsgBox Error$

Resume Send_RC_Exit

End Function

Thanks for any help.


Daniel Pineault

unread,
Feb 28, 2008, 6:00:02 PM2/28/08
to
Sadly, the SendObject method only supports a single filename being passed as
an argument. So you cannot send both reports in 1 email. that said you have
two choices.

1. perform to send objects, 1 per report


DoCmd.SendObject acReport, "Record of Complaint",
"SnapshotFormat(*.snp)", "", "", "", "Consumer Complaint", "", True

DoCmd.SendObject acReport, "AckLetter",
"SnapshotFormat(*.snp)", "", "", "", "Letter", "", True

Also, you do not need to open the report to send the e-mail.

2. automate Outlook to create a mail, with both attachement and fire it off.

You can find an example (need to be modified slightly for your needs) at
http://msdn2.microsoft.com/en-us/library/aa159619(office.11).aspx#odc_ac_olauto_sendanoutlookmessageusingaccess

If you need more help, post back indicating which method you've chosen to
adopt and how I can further assist you.
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.

Daniel Pineault

unread,
Feb 28, 2008, 6:01:03 PM2/28/08
to
Just came across a really good post on the subject with another solution.
Check out

http://groups.google.ca/group/microsoft.public.access.macros/browse_thread/thread/ac7e96df8b3a280e/c60eaa86563f3e19?hl=en&lnk=st&q=vba+sendobject+multiple+attachments#c60eaa86563f3e19
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.

nealberk

unread,
Mar 27, 2008, 5:27:03 PM3/27/08
to
The lazy man's way of doing this is to create a "wrapper" report and make
your two current reports subreports. Have your sendobject send the main
report.......

nealberk

unread,
Mar 27, 2008, 5:28:00 PM3/27/08
to
The easiest way of doing this is to make a "wrapper" report and make your two
current reports subreports of this wrapper.
0 new messages