Results 1 to 7 of 7
  1. #1
    Join Date
    May 2005

    Unanswered: Run-time Error '2501'

    Hey guys,

    I've been having troubles with access. The database is stored on the network drive and is accessed by multiple users.

    One user has been having troubles just recently in using a search form I created on the database (his screenshot with the error is attached). Over the last month, when he tries to use the search form, he will occasionly get this error message. When you click the Search button, the form is supposed to pull up a report that is based on a query that has its criteria from the form (hope that makes sense). But he (and as far as I know, only he) has been having this problem.

    Does anyone know what may be causing this? Has anyone seen this problem before? And, more importantly, does anyone know how to fix it? Thanks in advance to anyone who can help.
    Attached Thumbnails Attached Thumbnails Error.jpg  
    Me.Geek = True

  2. #2
    Join Date
    Apr 2004
    outside the rim
    As indicated in your screenshot, the OpenReport action was canceled.

    Run Time error 2501 most often occurs when something is Canceled. For example, if a report is sent to the printer using the OutputReport action and the user hits cancel while it is spooling, it will return error 2501, which you can trap.

    Also, if the OpenForm method is called and something causes the form to cancel opening (either Cancel was set to True during open, or an unhandled error occurs, triggering Cancel = True) then error 2501 is triggered.

    There are other ways to get 2501, almost all of them involve canceling an operation.

    I suggest you place an error trap in the procedure that opens the report. If Err.Number = 2501, then the user hits cancel. If the Err.number is anything else, post a messagebox with Err.Number and Err.Description
    have fun!

    Todd S.
    click to email

    Independent Development Consultant
    Biz db & reports - SQL, Access, Crystal, Seradex and more
    Small, custom, unique programs - Office, VBA, .NET

    Favorite message from Windows:
    There was an error displaying the previous error message

    Sadly, there was no error number to look up ...

  3. #3
    Join Date
    May 2006
    I have the same problem nckdryr but this is an Access issue that I, and numerous other users/developers (do a google) are also experiencing.

    Its not a coding problem because as you can see it works fine on some PCs, just individual ones..

    The only work around I've discovered is by changing the default printer of the PC in question to something else - the report will then appear fine on screen. However... you won't be able to print it out!! I can only presume there must be a config issue - maybe a service pack will fix it.

    Its ironic that I'm developing the Access db, I have these 2051 problems, yet the users I'm supporting don't !!


  4. #4
    Join Date
    Apr 2005
    Zagreb - Croatia

    Hello Nick!

    Look at "DemoErr2501A2000.mdb".
    Open Form2, click on first button. No error 2501.
    Click on second button. Err 2501 appear.
    Look at VBA.
    Attached Files Attached Files

  5. #5
    Join Date
    Nov 2007
    I had this same problem, and I found the only way to solve it was to change the default printer. However, then I removed the printer and added it back as the default, the problem went away. Hope this helps someone.

  6. #6
    Join Date
    Nov 2010

    Printer preferences

    As mentioned by the above poster, this error can be triggered by weirdness between your machine and your default printer.

    A quick test to see if the printer is issuing the cancel command is to just swap your default printer preference to the microsoft image writer printer (or another working printer) and then retry the open report command.

    For some reason, within access when a report document is opened for viewing, some hook is sent to the default printer. If there's any bad mojo going on there, the printer will send a cancel request to the database, triggering the 2501 error.

    Delete your default printer and add the printer again and the problem should resolve itself.

  7. #7
    Join Date
    Sep 2006
    I've seen this error in Access 2007 as well and I found this:

    Function NoData_Reports()
        With CodeContextObject
            MsgBox "There was nothing to report in " & CodeContextObject.Name, vbOKOnly, "Report Printing"
    On Error GoTo Error_NoData_Reports:
        If Err.Number <> 2501 Then
             MsgBox Err.Number & ": " & Err.Description
        End If
        Resume Exit_NoData_Reports
        End With
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts