我正在Access 2007中创建一个报告,并且能够将其保存为PDF,但问题是,不是每个PDF有1个报告,而是在1个PDF中有206个报告。我正在使用VBA以编程方式执行此操作 这是我正在使用的代码
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 :(得分:0)
我对它进行了分类购买改变了我获取数据的方式,并且一次只能获得一条记录