cricketbird
Registered User.
- Local time
- Today, 18:58
- Joined
- Jun 17, 2013
- Messages
- 121
I'm baffled by why this code I've used many times isn't working on a new report. It should loop through each record and print one report per record. But, I can't even get it to loop through the recordIDs... What am I missing? This is in an onclick event of a button.
In the Immediate window, I get "1, 1, 1" on three lines instead of what should be "1, 2, 3". Why is this not looping?
Code:
Set db = CurrentDb()
Set RS = db.OpenRecordset("SELECT EmailID, Email FROM [emails] WHERE [ACTIVE]")
If Not (RS.EOF And RS.BOF) Then
RS.MoveFirst
Do Until RS.EOF = True
Debug.Print Me.EmailID
' SendPDFReportAsEmail 'Currently commented out for testing
RS.MoveNext
Loop
Else
MsgBox "There are no records in the recordset."
End If
RS.Close
Set RS = Nothing
In the Immediate window, I get "1, 1, 1" on three lines instead of what should be "1, 2, 3". Why is this not looping?