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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send e-mail to multiple users 1

Status
Not open for further replies.

AKMonkeyboy

IS-IT--Management
Feb 4, 2002
141
US
I have a bound form with [SendTo] as Check Boxes. I would like to be able to send one e-mail (field name is ) to all users where [SendTo] = -1

I am having difficulty getting the "To:" in the e-mail populated with all of the e-mail addresses the user has selected.

How can I compile all of the e-mail addresses the user has selected using the [SendTo] field?

Thanks in advance for any help!

Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed
him for life.
Send a man to Tek-Tips and the poor sap can find out how to fish on his own, and learn more by doing it.
 
You can create a comma-delimited string of the email addresses. Loop through the checked [SendTo] checkboxes and append to the string.
 
Thanks rjoubert - wow that was quick! That's what I ended up doing.

How to find answers on Tek-tips:
1. Search Tek-tips for an hour, find nothing.
2. Post question.
3. Search Tek-tips for two more minutes, find answer.

Anyway, here's what I ended up with:

Code:
    Dim rs As Recordset
    Dim strList As String
    Set DB = CurrentDb
    
    'Refresh table to included user's selection
    Me.Refresh
    
    ' Open your table and build distribution list
    
    Set rs = DB.OpenRecordset("tblPhysician")
    Do While Not rs.EOF
        If rs.Fields("SendTo").Value = -1 Then
            strList = strList & rs.Fields("email").Value & "; "
        End If
        rs.MoveNext
    Loop
    
    'Display list (for testing purposes)
    
    MsgBox strList
    
    'Close database
    rs.Close
    Set DB = Nothing

Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed
him for life.
Send a man to Tek-Tips and the poor sap can find out how to fish on his own, and learn more by doing it.
 
It may be useful to test that the email field is not null or empty as such cases will cause errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top