Ken,
Thanks for replying. I want to loop through the records and send an email
to each of the owners who have a store in the group. I've been looking and
reading and found a little help on Google, but it's still not quite right.
I went ahead and created a new recordset for the loop, but it doesn't go to
the next record, it always stays on the record that was displayed in the
form. For example, on the form I have a cmdEmail that calls the code to
loop through the recordset. Let's say there are 20 records that match the
criteria I've given the recordset. If I am displaying store MI026, then it
does loop through 20 times, but each time it uses store MI026. If I move
through the records on the form and select store AZ004, then hit cmdEmail,
it again loops 20 times but uses store AZ004 for each "stop" in the loop.
My code is below. Any help or guidance on a better way is highly
appreciated!
Darhl
Private Sub RecordSet_Loop()
On Error GoTo Err_RecordSet_Loop
Dim rs As Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset(Me.RecordSource)
Do While Not rs.EOF
If IsNull(Me.txtFirstContact) Then
If MsgBox("Are you sure you want to send this owner the checklist?",
vbYesNo) = vbYes Then
Call subSendMessage
End If
Else
strMsgBox = Me.txtPMINumber & " has already received their checklist."
MsgBox strMsgBox, vbExclamation, "Redundancy Check"
End If
rs.MoveNext
Loop
rs.Close
Exit Sub
Err_RecordSet_Loop:
MsgBox Err.Number & " " & Err.Description
End Sub