Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    Error2501 (A2000)

    I have a problem with the above error message. Error 2501
    The open form action was cancelled.
    Has any one had any experience withis and how to deal with it.
    I'm using keycode27 to open a form. Some-times it will load, some-times it won't.
    If I press any other key before Keycode27 (esc) it will work fine.???


  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Error2501 (A2000)

    Why on earth would you use the Esc key to open a form? That runs entirely counter to normal application behavior in Windows and will bite you in the long run because Windows users don't expect Esc to behave that way. Normal Windows behavior for Esc is to Undo the current unsaved changes or basically to stop what is currently going on ... in other words, CANCEL.

    If this is your conversion of a legacy app, it's time to retrain the users. Some green screen behavior should NOT be reproduced in a Windows application. The old apps created their own environment and there was no real standard for which keys did what, especially back in the days before function keys on standard keyboards.

    OK, now that the rant is over ... this is actually a very common occurrence in Access, and it means you have a couple of events colliding. You issued a command to open a form but for some reason the form couldn't be opened. If code in your form cancels the Open event, say because there is no data for the where condition you passed it, then the Cancel of the Open event will run headlong into your OpenForm command and you'll get the 2501 error.

    What you normally do about this is put an error handler into the code that tries to open the form and test for the 2501 error. If you get it, you just ignore it instead of allowing Access to pop up a msgbox. You might want to look at the event that is actually raising the 2501 (probably the Open or NoData event of the form you called) and provide it with a polite msgbox telling the user the reason the form will not open.

Posting Permissions

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