In over my head again! The code below returns executes the propre number of times in the loop (ie, if there's 8 records, I get 8 messages sent) the problem is all 8 messages go to the first record in the rst!
Any suggestions? I'm pretty weak at VBA, but my guess is that it has something to do with using a string (strSomething) to control the emails being sent.
Dim strTo, strMessage, strSubject, strSomething As String
Dim mydb As Database
Dim myrec As Recordset
Dim I As Integer
Set mydb = CurrentDb
With myrec
Do While Not .EOF
'recipient
strTo = Me.MailTo & "; " & Me.Mobile_Phone & "@messaging.nextel.com" & "; " & Me.Manager_Email
'message
strMessage = Me.FullName & ", daily time reporting is required to receive pay!"
'subject
strSubject = "No daily time has been reported by " & Me.FullName & " for " & Me.txtReportDate
'send mail
strSomething = SendEmail(strTo, strMessage, "", strSubject, "")
.MoveNext
Loop
.Close
End With
'myrec .Close
mydb.Close
MsgBox "complete"
Close
Any suggestions? I'm pretty weak at VBA, but my guess is that it has something to do with using a string (strSomething) to control the emails being sent.
Dim strTo, strMessage, strSubject, strSomething As String
Dim mydb As Database
Dim myrec As Recordset
Dim I As Integer
Set mydb = CurrentDb
With myrec
Do While Not .EOF
'recipient
strTo = Me.MailTo & "; " & Me.Mobile_Phone & "@messaging.nextel.com" & "; " & Me.Manager_Email
'message
strMessage = Me.FullName & ", daily time reporting is required to receive pay!"
'subject
strSubject = "No daily time has been reported by " & Me.FullName & " for " & Me.txtReportDate
'send mail
strSomething = SendEmail(strTo, strMessage, "", strSubject, "")
.MoveNext
Loop
.Close
End With
'myrec .Close
mydb.Close
MsgBox "complete"
Close