Form can't be opened

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,
Suddenly I can't open some forms in my access 2k db. These forms are still
in the list, but when I double click on them, Access tell me, it cannot find
the form "...".
Why?
I can export them to another DB, although I cannot open them.
I have tried to repair the DB...

Any help is wellcome
Thanks
Martin
 
Sounds like a corruption of the database.

1. Make a backup of the mdb while it is NOT in use, and without overwriting
any previous backups.

2. 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"

3. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

4. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact

5. Try opening the form. If it still fails go on to step 6.

6. Open the Immediate Window (Ctrl+G), and enter:
SaveAsText acForm "Form1", "C:\form1.txt"
replacing Form1 with the name of your form.

7. If this works okay, then create a new (blank mdb), and turn off Name
AutoCorrect in the new file. Then import all the other objects except the
problem form:
File | Get External | Import

8. In the new database now import the problem form from the text file. Open
the Immediate Window, and enter:
LoadFromText acForm, "Form1", "C:\form1.txt"
 
At step 2 I think, it is not successfull.
I receive always the message: "you have canceled the last action".

I tried to import the forms in another DB, where the VBA code is OK, but in
the new DBs there the same problem.

Each time, when I try to write some code, open a codemodul, Access tell me:
"you have canceled the last action".

At step 6 (SaveAsText acForm ....) Access said: "you have canceled the last
action" and then "Modul is not found"


I hope, you can help me.

Thanks
Martin
 
Okay, if the decompile fails, and the SaveAsText fails, then the form is
corrupt.

You now have a new database that has everything except this bad form. Any
chance of importing the form from an old backup of this database? If so, you
are done.

If not, it is possible that it is just the code of the form that is corrupt.
Can you open it in design view?
No: This won't work.
Yes: Can you also open its module?
No: Set the form's HasModule property to No.
Yes: Select all the code, copy to Notepad. Save as a text file.
Set the form's HasModule property to No.
Both: Save the changes. Close the Form. Compact the database.
Now try importing the codeless form into the new database.
If that works, and you were able to save the code as text,
paste it back in as well.
 
Back
Top