Send one email to multiple emails in a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I assume this simple issue has been covered before, but every email FAQ seems
to describe how to do everything but this:

How can I send one email to multiple recipients listed in an Access query?

I have select query which includes the emails of people I need to email
(i.e., a distribution list). All I'm looking for is some simple OnClick code
to a) open Outlook and b) populate the "To:" box in Outlook with the emails
in the query. I will then fill in my own subject line, message, etc. in
Outlook and send the email when I'm ready.

The SendObject help isn’t clear on this. The methods at
http://www.jephens.com/howtoemail.asp and
http://support.microsoft.com/?id=318881 all send separate emails for each
person. http://www.granite.ab.ca/access/email.htm covers every option but
this one.

Am I just missing something basic?

Thank you. Kurt
 
Hi Kurt

Open a recordset on your query using your favourite data access object
library. Loop through this query adding each email address in turn to the
Recipients collection of your Outlook message object. Here is some air-code
to get you going:

Dim oOutlook As Outlook.Application
Dim oMsg As Outlook.MailItem
Dim oRcp As Outlook.Recipient
Dim rs as DAO.Recordset
Set oOutlook = CreateObject("Outlook.Application")
Set oMsg = oOutlook.CreateItem(olMailItem)
Set rs = CurrentDb.OpenRecordset("MyQuery", dbOpenForwardOnly)
Do Until rs.EOF
Set oRcp = olkMsg.Recipients.Add(rs![EmailAddressField])
oRcp.Type = olTo ' could be olCC or olBCC
oRcp.Resolve
rs.MoveNext
Loop
rs.Close
oMsg.Display ' display the message w/out sending it
 
Back
Top