E-mail from a table

  • Thread starter Thread starter Dale Crowder
  • Start date Start date
D

Dale Crowder

I have a database that has a table with an e-mail field.
Is there a way to automate from that list to send out a
bulk mail?
 
Hello Dale,

Yes, you can use Outlook Automation to send an email to each of the email
addresses in your table.

First, create a form which uses your table as its RecordSource.

Then, create a command button on your form and insert the following code (in
the Click event of that command button) that will loop through your form's
recordset and send an email to each email address. You will need to have
references set to the Microsoft Outlook xx.x Object Library and Microsoft
DAO x.xx Object Library. In addition, the email address for each of your
contacts *must be* a text field, not a hyperlink.

Dim oApp As Outlook.Application
Dim objNewMail As Outlook.MailItem
Dim rs as DAO.Recordset

Set rs = me.RecordsetClone
Set oApp = New Outlook.Application

rs.MoveFirst
Do While Not rs.EOF
Set objNewMail = oApp.CreateItem(olMailItem)
With objNewMail
.To = rs!EmailAddress
.Subject = "Your subject here."
.Body = "Your text message here."
.Save
.Send
End With
rs.MoveNext
Loop


hth,
 
Ok your like the great Access goddess, and I feel like I
don't know anything. When you say create a form which uses
your table as it's recordsource. Do you mean a form in
Outlook 2003 or inside the existing database? I hope you
don't mind dealing with an idiot here.
Is there an easier way to make a distribution list for
outlook from the table field in the database?
 
The code I provided is intended to work from a Form in your Access database.
You can use the Form Wizard to create the form and it will allow you to
perform any number of activities for maintaining the data in your Access
table and for using that data to perform other functions such as reports or,
as you requested, to send emails.

If you want to keep your email addresses in Outlook, you can import them
from your Access table into Outlook.
 
You have just opened my mind to a whole world of ideas,
any idea where I can learn more about automation with
access.
 
Back
Top