Access 2003 - run-time error 2501

Posted on 2007-07-30
Last Modified: 2008-01-09
We are getting an error message when trying to run one of our access files.  The error message reads: "Run-time error 2501 - The OpenReport action was canceled"  -- when I click on debug it brings me to the following line of code:
            DoCmd.OpenReport stDocName, acViewPreview

This report runs fine when we remote into work from home.  I am not familiar with visual basic code so any help would be appreciated before I have to call out the person that wrote this code.  What is confusing is it runs fine when accessed from the girl's computer from home.  I have uninstalled and re-installed Office2003 Pro and applied SP2.  
Any help is appreciated.  Thank you.
Question by:mmj1
    LVL 75

    Accepted Solution

    Here is a typical example where that error occurs, which may help you track it down:

    You have button which opens a report ..
       DoCmd.OpenReport "YourReport"

    But ... the report has No Data ... and in the OnOpen event of the report, you have a message box that pops up and says "Sorry, no Data"  if the NoData property = Truen ... and then you Cancel the opening of the report. Back at the Open command ... you will the get the message ""You cancelled the previous operaton".

    So ... you have to trap that error around the OpenReport command.

    So ... maybe this example will help you track it down?


    Author Comment

    Thank you for your help.  It ended up being an issue with the installation of Windows and/or Office.  I re-installed Windows and Office on one of the computers and the database runs fine.  Thank you for your help.  
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    you are welcome.


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now