I'm automating an email and sending to employees. But i need to do this multiple times and my recordset will change about five times pulling from differnet queries. Does anybody know how to run through the current recordset until EOF is reached change the recordset to rst2 then send those emails until EOF is reached, change the recordset to rst3 etc...
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
dim mydb as database
dim rstas recordset
set mydb = currentdb()
set rst= mydb.openrecordset("Mytable"
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
do until rst= EOF
With objOutlookMsg
.to = rst![Email Address]
.body = "Whatever the message is" & rst!
.send
End With
loop
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
dim mydb as database
dim rstas recordset
set mydb = currentdb()
set rst= mydb.openrecordset("Mytable"
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
do until rst= EOF
With objOutlookMsg
.to = rst![Email Address]
.body = "Whatever the message is" & rst!
.send
End With
loop