我已经使用此代码访问2010年生成PDF文件 DoCmd.OutputTo acOutputReport,“Graph_report2”,“.pdf”,“C:\ Graph_report2.pdf”,True访问问题:输出不能在访问2007年
它在Access 2010中工作正常,但是当我在访问2007年中打开访问数据库时,它给出运行时错误2501'OutputTo操作被取消',而不是pdf文件已打开。
大问题!我做了什么? plz帮助
我已经使用此代码访问2010年生成PDF文件 DoCmd.OutputTo acOutputReport,“Graph_report2”,“.pdf”,“C:\ Graph_report2.pdf”,True访问问题:输出不能在访问2007年
它在Access 2010中工作正常,但是当我在访问2007年中打开访问数据库时,它给出运行时错误2501'OutputTo操作被取消',而不是pdf文件已打开。
大问题!我做了什么? plz帮助
DoCmd.OutputTo acOutputReport, "Graph_report2", ".pdf", "C:\Graph_report2.pdf", True
应该是:
DoCmd.OutputTo acOutputReport, "Graph_report2", acFormatPDF, "C:\Graph_report2.pdf", True
罗布
我可以补充一点,除了一个需要安装一个PDF输出加入,然后启动Access 2007,http://www.microsoft.com/en-us/download/details.aspx?id=9943
如果试图将文件保存在不存在的目录中,该错误也会弹出。
这里是PDF输出功能:
Function PrintToPDF(SrcReport As String, DestPath As String, DestFile As String, ShowPdf As Boolean)
On Error GoTo PrintToPDF_Err
'ScrReport = The report Name to output as PDF
'DestPath = Destination path for PDF file e.g. C:/DatabaseReports/Financial/
'DestFile = File name for the PDF file being created, but without the file extension, one can add date to it
'Showpdf = launch pdf viwer and display this PDF output
DoCmd.OutputTo acOutputReport, SrcReport, "PDFFormat(*.pdf)", DestPath & DestFile & ".pdf", ShowPdf, "", 0, acExportQualityPrint
PrintToPDF_Exit:
Exit Function
PrintToPDF_Err:
MsgBox Error$
Resume PrintToPDF_Exit
End Function
你必须确保在PDF插件安装于2007年 http://www.microsoft.com/downloads/en/details.aspx ?familyid = f1fc413c-6d89-4f15-991b-63b07ba5f2e5&displaylang = en – ZippyV 2011-06-06 22:03:39
@ZippyV:这是实际的答案,你应该把它作为评论而不是评论。 – 2011-06-09 01:29:19