【问题标题】:an access problem:OutputTo not work in access 2007一个访问问题:OutputTo not work in access 2007
【发布时间】:2014-04-08 22:59:08
【问题描述】:

我已在 access 2010 中使用此代码生成 pdf 文件 DoCmd.OutputTo acOutputReport, "Graph_report2", ".pdf", "C:\Graph_report2.pdf", True

它在 access 2010 中工作正常,但是当我在 access 2007 中打开我的 access 数据库时,它会给出运行时错误 2501,即“OutputTo 操作已取消”,而不是打开 pdf 文件。

大问题!我该怎么办?请帮忙

【问题讨论】:

  • 您必须确保安装了 2007 年的 pdf 插件。microsoft.com/downloads/en/…
  • @ZippyV:这才是真正的答案,您应该将其发布,而不是作为评论。

标签: ms-access-2007


【解决方案1】:
DoCmd.OutputTo acOutputReport, "Graph_report2", ".pdf", "C:\Graph_report2.pdf", True

应该是:

DoCmd.OutputTo acOutputReport, "Graph_report2", acFormatPDF, "C:\Graph_report2.pdf", True

罗伯

【讨论】:

    【解决方案2】:

    除了需要安装一个用于 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-04
      • 1970-01-01
      相关资源
      最近更新 更多