Hello All,
I'm trying to mass output PDFs from an Access form. The form ties to a report which is driven of the current Form values. The following code is intended to cycle through all available form records and generate a corresponding report to pdf.
Without the loop it works, but when it cycles through the records, it seems that it's going to fast for Access. Even though the Access starts going to subsequent form records, the 'Me. Values' never update to the current record and the script just rewrites over the same file over and over again.
Any idea on how to slow this down to have the Me. Values update for each record appropriately?
Code:
FileName = Me.Supplier_Name & " - " & Me.Invoice_Num
Filepath = Environ("UserProfile") & "\Desktop\" & FileName & ".pdf"
While Me.CurrentRecord < Me.Recordset.RecordCount
'CurrentDb.Execute "Invoice Header - Report"
DoCmd.OutputTo acOutputReport, "Invoice PDF - Report", acFormatPDF, Filepath
DoCmd.GoToRecord , , acNext
Wend
End Sub