I'm trying to send a report to each person in my recordset. The report is different for each person (same report but individualizesdinfo). I'm having trouble filtering the report to one record (everyone in the query shows in the report). When I don't use a recordset, I can filter the report (Filter on the report: [ReloID] = Forms!frmPCSTracker!ReloID). But the technique doesn't work when I run a recordset. What should I do differently? Thanks.
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim rs As Object
Dim iCount As Integer
Dim rscritiques As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("qry91To120DaysFromPDDEmail")
With rs
If .RecordCount <> 0 Then
rs.MoveLast
iCount = rs.RecordCount
Do While Not .BOF
DoCmd.SendObject acSendReport, "rpttest", acFormatPDF, rs!SubjectEMail, rs!SupvrEMail & "; " & rs!CCF_EMail, , "PCS Orders - Assignment Actions", rs!Grade & " " & rs!LastName & ", " & vbCr & vbCr & _
"blah, blah, blah",True
.MovePrevious
Loop
End If
End With
rs.Close
MsgBox "Process complete.", vbInformation
Error_Handler_Exit:
On Error Resume Next
Set rs = Nothing
Set db = Nothing
Exit Sub
Error_Handler:
If Err.Number <> 0 Then Err.Clear
Resume Error_Handler_Exit
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim rs As Object
Dim iCount As Integer
Dim rscritiques As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("qry91To120DaysFromPDDEmail")
With rs
If .RecordCount <> 0 Then
rs.MoveLast
iCount = rs.RecordCount
Do While Not .BOF
DoCmd.SendObject acSendReport, "rpttest", acFormatPDF, rs!SubjectEMail, rs!SupvrEMail & "; " & rs!CCF_EMail, , "PCS Orders - Assignment Actions", rs!Grade & " " & rs!LastName & ", " & vbCr & vbCr & _
"blah, blah, blah",True
.MovePrevious
Loop
End If
End With
rs.Close
MsgBox "Process complete.", vbInformation
Error_Handler_Exit:
On Error Resume Next
Set rs = Nothing
Set db = Nothing
Exit Sub
Error_Handler:
If Err.Number <> 0 Then Err.Clear
Resume Error_Handler_Exit