Using the second page of this thread (https://access-programmers.co.uk/forums/showthread.php?t=206372&highlight=outputto) I am able to export a report that is filtered by person and save it under their name and today's date, but it is taking over 5 minutes to export 3 1 page reports. There are two subreports within the main report, and when it is exporting, the popup will show the same person's name a couple of times, like it is doing it more than once. Here is the code I am using:
Any ideas on why it is so slow or what I can do to speed it up? The report itself is also slow to open in print preview, probably 20 seconds. The query seems fine when I run it separately. Any help would be appreciated! Thank you!
Code:
Private Sub Command74_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As QueryDef
Set db = CurrentDb
Set qdf = db.QueryDefs("qryProductivityProcessorIndividual")
qdf.Parameters(0).Value = Forms!frmReports![Start Date]
qdf.Parameters(1).Value = Forms!frmReports![End Date]
Set rst = qdf.OpenRecordset
Do While Not rst.EOF
strRptFilter = "[Processor] = " & Chr(34) & rst![Processor] & Chr(34)
DoCmd.OpenReport "rptErrorsbyProcessorIndividual", acPreview
DoCmd.OutputTo acOutputReport, "rptErrorsbyProcessorIndividual", acFormatPDF, "(deleted)" & rst![Processor] & " - Weekly - " & Format(Date, "mm.dd.yyyy") & ".pdf"
DoCmd.Close
DoEvents
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set qdf = Nothing
Set db = Nothing
End Sub
Any ideas on why it is so slow or what I can do to speed it up? The report itself is also slow to open in print preview, probably 20 seconds. The query seems fine when I run it separately. Any help would be appreciated! Thank you!