email each individual separately

W

wpshop

I have a query name [qryProgressRptResearcherFinal]. The query has the
following fields: [Item#],[Fund Number],[Account Number],[Date Received],
[Researcher],. I want to push a bottom and if there is a record for a
researchers I want the information to email to the [Email] address on the
record. I have 58 researchers so I want to be able to push one button and
have a code loop until all researchers have been emailed. I know how to
write code to send an email based on variables but I have never tried a loop
before. Please let me know if you need more information.
 
D

Dennis

Try something like this in the click event of your button

Dim db As Database
Dim rs As Recordset
Dim strEmail As String
Dim strResearcher as String

Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM [qryProgressRptResearcherFinal]")
rs.MoveFirst
While Not rs.EOF
strEmail = rs.Fields(5)
strResearcher = rs.Fields(4)
MsgBox strEmail & " - " & strResearcher
' replace the msgbox with your code to send the e-mail
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Set db = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top