J
janetb
I need to send an email to each person matching an id in a db (right now I'm
sending to myself as a test) upon the click of a button, but it keeps making
an endless loop. (myID is variable from earlier in the code and is working
correctly) I should only be getting 3 emails. When I execute the exact query
below separately - it only pulls up three records. Can anyone point out what
I'm screwing up?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strTo As String
Dim strMsg As String
Dim strCC As String
Dim strSubject As String
strCC = ""
strTo = "(e-mail address removed)"
strSubject = "Videoconferencing Participation Request " & myID
On Error Resume Next
Set db = CurrentDb()
Set rs = db.OpenRecordset("select p.email as email, e.eventTitle,
e.startDate, t.partID, e.eid from (dbo_tblParticipant t LEFT JOIN
dbo_xTblPerson p ON t.pid = p.pid) LEFT JOIN dbo_tblEvent e ON t.eid = e.eid
where t.eid=13")
Do While Not rs.EOF
strMsg = "You have been invited to participate in a videoconference. Please
go to the following page link and respond. <a
href=http://www.server.net/telehealthNet/admin/participantConfirmation.aspx?upd=0&eid="
& rs("e.eid") & "&partID=" & rs("t.partID") & ">Click Here</a> " & rs("email")
DoCmd.SendObject acSendNoObject, , , strTo, strCC, , strSubject, strMsg, True
strMsg = ""
rs.MoveNext
Loop
sending to myself as a test) upon the click of a button, but it keeps making
an endless loop. (myID is variable from earlier in the code and is working
correctly) I should only be getting 3 emails. When I execute the exact query
below separately - it only pulls up three records. Can anyone point out what
I'm screwing up?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strTo As String
Dim strMsg As String
Dim strCC As String
Dim strSubject As String
strCC = ""
strTo = "(e-mail address removed)"
strSubject = "Videoconferencing Participation Request " & myID
On Error Resume Next
Set db = CurrentDb()
Set rs = db.OpenRecordset("select p.email as email, e.eventTitle,
e.startDate, t.partID, e.eid from (dbo_tblParticipant t LEFT JOIN
dbo_xTblPerson p ON t.pid = p.pid) LEFT JOIN dbo_tblEvent e ON t.eid = e.eid
where t.eid=13")
Do While Not rs.EOF
strMsg = "You have been invited to participate in a videoconference. Please
go to the following page link and respond. <a
href=http://www.server.net/telehealthNet/admin/participantConfirmation.aspx?upd=0&eid="
& rs("e.eid") & "&partID=" & rs("t.partID") & ">Click Here</a> " & rs("email")
DoCmd.SendObject acSendNoObject, , , strTo, strCC, , strSubject, strMsg, True
strMsg = ""
rs.MoveNext
Loop