I am creating a report in Access 2007 and am able to save it as a PDF, but the problem is that instead of having 1 report per PDF I have got 206 Reports in 1 PDF. I'm using VBA to programatically do this here is the code I'm using
Sub makeLetterPDF(Contract As String, LetterType, outTo As String)
Dim rs As New ADODB.Recordset
Dim strReportName As String
Dim strFileName As String
Dim Maxrow As Integer
Dim C As Integer
Dim fileno As Integer
SysCmd acSysCmdSetStatus, "Saving " & C & " of " & Maxrow
strReportName = LetterType
strFileName = LetterType & fileno & ".PDF"
fileno = fileno + 1
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, _
outTo & "\" & strFileName, , , , acExportQualityPrint ``"
SysCmd acSysCmdSetStatus, " "
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim strRecordSource As String
strRecordSource = "Exec dbo.rsp_Letter_ServiceBooking '" & Contract & "'"
Me.RecordSource = strRecordSource
End Sub
The report open has the Stored Procedure that has the data I need for the report but how do I iterate through this to create the individual reports as the makeLetterPDF
is run first