访问问题:OutputTo在Access 2007中不起作用

问题描述

| 我已在Access 2010中使用此代码生成pdf文件  DoCmd.OutputTo acOutputReport,\“ Graph_report2 \”,\“。pdf \”,\“ C:\\ Graph_report2.pdf \”,True 它在Access 2010中工作正常,但是当我在Access 2007中打开我的Access数据库时,出现运行时错误2501,提示“'OutputTo操作已取消\',而不是打开pdf文件。 大问题!我该怎么办?请帮助     

解决方法

        
DoCmd.OutputTo acOutputReport,\"Graph_report2\",\".pdf\",\"C:\\Graph_report2.pdf\",True
应该:
DoCmd.OutputTo acOutputReport,acFormatPDF,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,\"\",acExportQualityPrint

  PrintToPDF_Exit:
    Exit Function

  PrintToPDF_Err:
    MsgBox Error$
    Resume PrintToPDF_Exit


   End Function