Computer Learning Zone CLZ Access Excel Word Windows

Sleep can interfere with opportunity.

-103rd Rule of Acquisition
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Microsoft Access Email Seminar    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Email to multiple recipients
Jerry Freeman 
    
10 years ago
Richard: I am trying to send an email to multiple recipients without having to create a new form; it is just based off a button click.  ie-email ADMIN.  Then sending an email to all in the ADMINEmail Recordset.  But only the last record in the recordset is showing up in the To: field when Outlook opens.  Any help appreciated. Code as follows:

Dim OObj As Outlook.Application
Dim OMsg As Outlook.MailItem
Dim db As Database
Dim rs As Recordset
Dim EmailAddress As String
    Set OObj = CreateObject "Outlook.Application")
    Set OMsg = OObj.CreateItem(olMailItem)
    Set db = CurrentDb
    Set rs = db.OpenRecordset("65_EmailGroupADMIN_T")
    With rs
        
        If .EOF And .BOF Then
            MsgBox "No emails will be sent becuase there are no records assigned from the list", vbInformation
            Else
            Do Until .EOF
                EmailAddress = ![Email]
                .Edit
                .Update
                OMsg.To = EmailAddress
                .MoveNext
            Loop
        OMsg.Display
End If
End With

    rs.Close
    db.Close
    Set rs = Nothing
    Set db = Nothing
    Set OMsg = Nothing
    Set OObj = Nothing
End Sub


Reply from Alex Hedley:

You have the lineOMsg.To = EmailAddress
So To will always contain the last email address in your loop
You will need to build up a string of emails in your loop instead

Dim strEmails
strEmails = strEmails & EmailAddress & ";"

Then set the .To to your list
OMsg.To = strEmails

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Microsoft Access Email Seminar.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/17/2026 3:26:51 AM. PLT: 0s