emailing residents from a recordset

prmitchell

Registered User.
Local time
Today, 16:43
Joined
Jan 2, 2013
Messages
58
I have a recordset (titled ASBSelectedMonth) which is executed from a button on a form
with the following fields
emailAddress, ResidentName, EventName,SessionDate,Message1,Message2

I want to email each person in the recordset, they may be in the recordset once or multiple times, the contents of the other fields basically
I know the code will start with something like
Do While recordset is not empty (but I have forgotten the rest)
Hope you can help!!!

eg.

abiden@bigpond.comBiden, AndrewPetanque
5/10/2022​
Hi Andrewnext month's sessions
abiden@bigpond.comBiden, AndrewPetanque
19/10/2022​
Hi Andrewnext month's sessions
bobkat116@bigpond.comAlbanese, BobFri dinner Oct
14/10/2022​
Hi Bobnext month's sessions
bobkat116@bigpond.comAlbanese, BobLawn Bowls Tues
18/10/2022​
Hi Bobnext month's sessions
bobkat116@bigpond.comAlbanese, BobGolf Shield dinner
26/10/2022​
Hi Bobnext month's sessions
 
Code:
' say your recordset is Rs
With Rs
    Do Until .EOF
        DoCmd.SendObject acSendNoObject, , , _
        !emailAddress, , , _
        !EventName & " on " & !SessionDate, Message1 & vbcrlf & vbcrlf & Message2, False
        .MoveNext
    Loop
End With
 
I would not send multiple emails.
Here is how I did it on one of my DBs. A little more than just sending emails as they were also formatted as HTML, but perhaps you can also use that.
Attached as to big to copy and paste, site complains otherwise.
 

Attachments

First make sure the recordset contains unique persons only.
 

Users who are viewing this thread

Back
Top Bottom