none
Error 2501 in Access 2016 RRS feed

  • Question

  • I have been running this report for years using Access 2010. I just upgraded to Office 365 with Access 2016 and I now generate this 2501 error, "The OutputTo action was canceled." when I run the report. See Code below:

    Dim strDate As String

    Dim strFile As String

    Dim strFilePath As String

    Dim MyFilter As StringEnd Sub

    strDate = [TxtDate]

    MyFilter = ""

    strFilePath = "C:\RMReports\"

    strFile = "RM Weekly Report " & strDate & ".pdf"

    strFilePath = strFilePath & strFile

    DoCmd.OutputTo acOutputReport, "rptRMReportIIxlsStrtDte", acFormatPDF, strFilePath, True


    Dean J. Waring

    Thursday, March 21, 2019 8:18 PM

All replies

  • Error 2501 happens when a report does not open possibly because of no data or a part of the DoCmd has an error.

    1. Are you able to open the report manually?
    2. Is the report relying on any parameters that are not correct?
    3. Are you sure the path is correct and permissions properly set?

    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Friday, March 22, 2019 7:09 PM
  • I can open the report manually and the parameters are all correct.  The path is also correct. I've been running this report every month for years with no issues. We upgraded to Office 365 and now I get this error. Again, it runs perfectly manually and, in fact, that is how I had to run it this month.  I think it has something to do with the pdf setting now.

    Dean J. Waring

    Saturday, March 23, 2019 10:12 AM
  • I also get the same error with other reports that I run using the acOutputReport command with the acFormatPDF.

    When I change the line to DoCmd.OpenReport, "ReportName", acViewNormal the process executes correctly but I don't get to name the report. Again, this just started happening when we upgraded from Access 2010 to Access 2016. Any thoughts you may have would be helpful, because I am now having to manually run and save reports as a work around.

     

    Dean J. Waring

    Wednesday, May 15, 2019 2:32 PM
  • I do remember that I had such an error with Access 2016.
    (I got it working though.)

    You could try the following:

    DoCmd.OpenReport srptName, acViewPreview

    DoCmd.SelectObject acReport, srptName 'does not work if you had opened more than one instance of the report DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:="", OutputFormat:=acFormatPDF, OutputFile:=sFileName, AutoStart:=bAutoStart, _ OutputQuality:=acExportQualityPrint

    This would actually show the report, but I can confirm that this code works in Access 2016/365.

    Good luck!


    • Edited by papa_bear Thursday, May 16, 2019 7:07 PM forgot line
    Thursday, May 16, 2019 7:05 PM