2009-10-08 106 views
0

我在Access 2007中创建了一个报告,并且能够将其保存为PDF,但问题在于,不是每个PDF都有1个报告,我有1个206报告PDF。我使用VBA编程方式来做到这一点 这里是我使用使用存储过程在Access 2007中以PDF形式报告

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 

报告开放的代码存储过程有我需要的报表的数据,但我怎么通过这个循环创建个人报告为makeLetterPDF首先运行

回答

0

我排序它买改变我得到的数据的方式,只有一次获得一个记录这项工作