Email from Access 2007 to Multiple Recipients

I've been successful with sending an email from Access 2007 with a .pdf attachment to a single recipient using the following:

DoCmd.SendObject acSendNoObject, "C:\Report\Report1.pdf", acFormatPDF, "JohnDoe@Company.com", , , "Report", "Report file attached.", False

I need to send the same report to multiple recipients ( Table: tblEmailAddress, Field: "Address"). What is the best method (ie String, Loop) and can you provide a sample?
Tim313Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MINDSUPERBCommented:
Tim,
Refer the link below. It gives sample code on how to achieve what you want.

http://support.microsoft.com/kb/318881

Sincerely,
Ed

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can also do this:

Dim rst As DAO.Recordset
Dim sEmails As String
Set rst = Currentdb.OpenRecordset("SELECT [Address] FROM [tblEmailAddress]")

Do Until rst.EOF
  sEmails = sEmails & ";" & rst("Address")
  rst.MoveNext
Loop

DoCmd.SendObject acSendNoObject, "C:\Report\Report1.pdf", acFormatPDF, sEmails, , , "Report", "Report file attached.", False

If you need to send a PDF that is SPECIFIC to an individual (that is, Joe Smith has a PDF that contains information relevant to him, while Sarah Jones recevies a PDF with information specific to her) you would have a muc different situation.
Tim313Author Commented:
LSMConsulting, I have a question regarding the line:

     sEmails = sEmails & ";" & rst("Address")

Doesn't sEmails have to be "filled" with the first rst("Address") before beginning the loop? ie:

     rst.MoveFirst
     sEmails = rst("Address")
     rst.MoveNext
     Do Until rst.EOF
       sEmails = sEmails & ";" & rst("Address")
       rst.MoveNext
     Loop
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Not really; Outlook will manage the preceeding semicolon. You can do this:

sEmails = rst("Address") & ";" & sEmails

Then trim off the last semicolon:

sEmails = Left(sEmails, Len(sEmails) - 1)
Tim313Author Commented:
MINDSUPERB, the link you suggested refers to "resolve e-mail addresses against the Outlook Address Book". Can you tell me what this does?
MINDSUPERBCommented:
Tim,

The KB title of the link that I posted is "How to use a recordset to send Outlook e-mail to multiple recipients in Microsoft Access"

That KB has instructions and codes to send e-mail into multiple recepients.

Ed
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
In the code block at that link is a section that uses the Resolve method of the Outlook.Recipient object. The Resolve method does just as you would expect: It verifies whether the email address is included in the Outlook address book.

http://msdn.microsoft.com/en-us/library/bb219924(v=office.12).aspx

Unless you have every recepient in the Address book of Outlook, I wouldn't include this in code to send email. It's most useful when adding Tasks and such.
Tim313Author Commented:
LSMConsulting, Thank you for the explaination. After the response from MindSuperb, I figured it was unfair to ask a "second, separate" question, so I posted a new question regarding this issue. Please post a response to the new question (ID: 26556911) so I can award you the 500 points.

Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.