Email attachments

D

DeanT

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.
 
D

Daniel Pineault

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/li...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.
 
N

nealberk

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.......

Daniel Pineault said:
Just came across a really good post on the subject with another solution.
Check out

http://groups.google.ca/group/micro...dobject+multiple+attachments#c60eaa86563f3e19
--
Hope this helps,

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



DeanT said:
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.
 
N

nealberk

The easiest way of doing this is to make a "wrapper" report and make your two
current reports subreports of this wrapper.

Daniel Pineault said:
Just came across a really good post on the subject with another solution.
Check out

http://groups.google.ca/group/micro...dobject+multiple+attachments#c60eaa86563f3e19
--
Hope this helps,

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



DeanT said:
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.
 

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