CharlesWhiteman
Registered User.
- Local time
- Today, 19:56
- Joined
- Feb 26, 2007
- Messages
- 421
Hi All, I am usiung the following code which is correctly running through a query and outputting PDF files. However, its not quite right.
The query behind the report contains 194 lines and raltes to call records. I want to output 194 pdf files with each pdf the report just for the related row in the query, not 194 copies of the entire report.
The query behind the report contains 194 lines and raltes to call records. I want to output 194 pdf files with each pdf the report just for the related row in the query, not 194 copies of the entire report.
Code:
Private Sub Command0_Click()
Dim rs As DAO.Recordset, pdfName As String, MyFilter As String, MyFilename As String, MyPath As String
Set rs = CurrentDb.OpenRecordset("qryCalls")
rs.MoveFirst
Do Until rs.EOF
pdfName = rs("REF") & ".pdf"
'MyFilter = "Unique_Programs_Distinct.Program = '" & rs("program") & "'"
MyPath = rs("MyPath")
DoCmd.OutputTo acOutputReport, "RepCalls", acFormatPDF, MyPath & pdfName
rs.MoveNext
Loop
rs.Close
Exit_Create_PDF:
Exit Sub
End Sub