Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple attachments on E-mails? 11

Status
Not open for further replies.

Peps

Programmer
Feb 11, 2001
140
ES
I’m using the following code to send an E-mail with a query attached:

DoCmd.SendObject acSendQuery, "Name of attachment being saved", acFormatXLS, [Name of my query being attached], , , "Text message", , False

Can anyone tell me how I can attach two queries on the same E-mail?

Many thanks guys.
Peps
 
One question to this post:

If I have multiple recipients, what should I do on the codes?

Please advise. Thank you.
 
Is this what you mean?

...

With MailOutLook
.To = "ME;YOU;HIM;EVERYBODY"
.Subject = "Batch Releases"
.HTMLBody = "Hello"
.Attachments.Add "C:\Temp\XXX.snp", olByValue, 1, "XXX_SNP"
.Attachments.Add "C:\Temp\XXX.RTF", olByValue, 1, "XXX_RTF"
.Send
...
 
Thank you. That is exactly of what I am looking for if we have more than one recipient.

This is a wonderful post, regarding the sendobject command. I have not tried yet, but at least it is here.

Thanks again.
 
OK let's get tricky.

I can see what you are doing to add an attachment or attachments that have already been generated and residing somewhere on a drive, no problem using the “Attachments.Add” but what if you are first generating a report that is individualized to say an OfficdID field located in a table called tblOffice, which is to be one attachment and then want to add the additional saved attachments to the Outlook email, .doc, .ppt….

I already have the following DoCmd.SendObject performing the initial report generation and attaching that to an email;

Private Sub eMailReport_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblOffice", dbOpenDynaset)
rs.MoveFirst
Do
vOfficeID = rs("OfficeID")
DoCmd.SendObject acSendReport, "rptZIPeMailReport", "RichTextFormat(*.rtf)", rs("eMailAddress"), "", "", rs("ReportSubject"), "The attached report BLAH BLAH BLAH", False
rs.MoveNext
Loop Until rs.EOF
rs.Close
db.Close
End Sub

How can I rewrite the routine to both attach a generated report and then attach additional saved attachments?

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top