Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how send emails based on recordset

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i loop in a recordset that contains many records and i want in each step to send email with current record to the current customer record, How this coded?

thanks
 
firstly reference outlook in references then your code will be somethign like this

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
dim mydb as database
dim myrec as recordset

set mydb = currentdb()
set myrec = mydb.openrecordset("Mytable")

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

do until myrec = EOF

With objOutlookMsg
.to = myrec![Email Address]
.body = "Whatever the message is" & myrec![whatverfieldinmessageifyouwant]
.send

End With

loop


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top