Email list

  • Thread starter Thread starter Kathy Webster
  • Start date Start date
K

Kathy Webster

I have a contacts table with an email field in it.
How can I send an email blast to everyone in the table?

Tia,
kw
 
That's a little scary for me, Mr. Feakazeud. I'm familiar w/the SendObject
part, but the looping part is over my head. Can someone baby me a little?
kw
 
Hi,
I'm going to comment almost each line for you so you know what is happening.
Just put this on the on click event of a form button if that is where you
want to execute it from.

--------------------------------------------------
'Declaire Variables
Dim rs As New ADODB.Recordset
Dim strEmail As String

'Open ADO recordset change YourEmailTable to the name of the table or query
holding your emails
rs.Open "YourEmailTable", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic

'Clear strEmail Variable
strEmail = ""

'Start to loop through the recordset
Do While Not rs.EOF

'Build email string...change "emails" in "rs!emails" to the name of the
field in the table/query you specified earlier which holds the email address
strEmail = strEmail & rs!emails & ";"

'move to next record in recordset...go to beginning of loop and add the next
email of that record to the email string (strEmail)
rs.MoveNext
Loop

'Send email using SendObject...the "To" argument will be filled with the
values the constructed string "strEmail" holds
DoCmd.SendObject , , , strEmail, , , "test", "Test", True

'Close established references...clean up code
rs.Close
Set rs = Nothing
 
Wow, thank you for commenting each line!
I'll try this in the morning when my head is more clear :-)
 
Back
Top