email to multiple addresses

S

shanebgross

I want to create a button that will send one email to multiple addresses. I
have a table called users with a username, email address and yes/no field
called administrator. More than one user can be an administrator. I want
the button to send an email to all users where administrator is yes. I can
use the docmd.sendobject method with a dlookup function for the "to" , but
that will only get me one address. I think I need some sort of sql statement
or have to use a recordset to get all of them to show properly in the "to"
field of the email message. How do I do it?
 
P

Piet Linden

I want to create a button that will send one email to multiple addresses. I
have a table called users with a username, email address and yes/no field
called administrator.  More than one user can be an administrator.  Iwant
the button to send an email to all users where administrator is yes.  Ican
use the docmd.sendobject method with a dlookup function for the "to" , but
that will only get me one address.  I think I need some sort of sql statement
or have to use a recordset to get all of them to show properly in the "to"
field of the email message.  How do I do it?

Easiest way is to create a query that returns the e-mail address for
that.

SELECT emailaddress
FROM SomeTable
WHERE Administrator=True;

open a recordset based on that, and then loop through it, appending
the address to the Recipients collection. Or if you're using
sendObject, send one per person. Basically SendObject is a stunted
dwarf that can't do much. IF you want flexibility either automate
Outlook directly or use CDOSys...
 
Top