Error 2501 The OpenForm action was canceled.

G

Guest

I keep getting this error trying to open a form from another form. The form I
am trying to open has a table as the recordsource. At one time the form
would open by clicking it, but not from another form which is how I need to
open it. It would also open showing all the records, but I linked to it
using linking parameters in the doCmd.openform and it would not open with any
linking parameters. After trying many things now the form will not open by
clicking open from the database window or by code from another form. I get
this abbreviated message: ..Method or data member not found

It makes no difference what code, or no code, I have in the Form_Open or
Form_Load. This has happened to this form and another similar form that is
bound to a table that is linked to the table in the form above.

I have started fresh with a new form similar to what I need, but still have
the same problem.

Anyone have any ideas? Any help will be appreciated.
Thanks,
Chuck
 
A

Allen Browne

This could be several things. Try this sequence:

1. Ensure the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database:
Tools | Database Utilities | Compact

3. Open any code window, and choose References from the Tools menu.
Make sure the word MISSING does not appear beside any libraries.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

4. If the problem is still there, close Access, make a backup copy, and
decompile the database by entering something like this at the command prompt
while Access is not running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"
Then compact again.

5. Problem still exists with *one* form? Open the VBA window, and copy the
code to clipboard. Paste into Notepad and save. Then set the form's
HasModule property to no. Save. Close the form. Compact again. If the form
opens successfully now, you can try opening the form's module, and pasting
the code back in.

6. If the problem persists with *all* forms, get Access to rebuild the
database for you by following the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html
 
G

Guest

Thanks Allen.

I followed your steps except for the decompile, which I could not get to
work, and both forms open by clicking them. One opens ok from another form
and I think the other will too once I add back code to the form. It opens
fine with no code in the module, but I need to change my code some before I
add it back in as I have found a better way to accomplish what I want to do
with the form.

I use decompile all the time at work and have a statement at work that I got
to work a few years ago (after seeing it on your site) that I will copy and
bring home where I am having the problems. Your syntax looks ok, but I could
not get it to work after trying several variations of where the quotes go.

Thanks again.

Chuck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top