I have code in my access db that selects certain email addresses from a table, opens outlook and sends them an email. I can't figure out how to add multiple email adresses to one email. any help is appreciated:
' Now, we open Outlook for our own device..
Set MyOutlook = New Outlook.Application
' Set up the database and query connections
Set db = CurrentDb()
mysql3 = "SELECT [User_Email] From [User_Data] Where [Access Level] =" & 4
Set rsemail = db.OpenRecordset(mysql3)
'
' this is where we loop through our list of addresses,
' adding them to e-mails and sending them.
'Do Until rsemail.EOF
' This creates the e-mail
Set MyMail = MyOutlook.CreateItem(olMailItem)
Do Until rsemail.EOF
' This addresses it
MyMail.To = rsemail(0) 'maillist("email")
'This gives it a subject
MyMail.Subject = Subjectline$
'This gives it the body
MyMail.Body = MyBodyText
MyMail.Display
'And on to the next one...
rsemail.MoveNext
Loop
'Cleanup after ourselves
' Now, we open Outlook for our own device..
Set MyOutlook = New Outlook.Application
' Set up the database and query connections
Set db = CurrentDb()
mysql3 = "SELECT [User_Email] From [User_Data] Where [Access Level] =" & 4
Set rsemail = db.OpenRecordset(mysql3)
'
' this is where we loop through our list of addresses,
' adding them to e-mails and sending them.
'Do Until rsemail.EOF
' This creates the e-mail
Set MyMail = MyOutlook.CreateItem(olMailItem)
Do Until rsemail.EOF
' This addresses it
MyMail.To = rsemail(0) 'maillist("email")
'This gives it a subject
MyMail.Subject = Subjectline$
'This gives it the body
MyMail.Body = MyBodyText
MyMail.Display
'And on to the next one...
rsemail.MoveNext
Loop
'Cleanup after ourselves