2009-10-08 58 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

我排序它買改變我得到的數據的方式,只有一次獲得一個記錄這項工作