Lost Code

M

Martin Andrews

On opening my mdb database this morning I have lost all functionality. The
objects and data are all there but there is no code whatsoever, therefore
command buttons don't work etc. I have a copy of the file which is OK but is
missing some new forms which I have just created. I have tried to export the
new forms from the broken version to the copy so that I can redo the code but
I get an error message saying "Name conflicts with existing module, project
or existing object library". I have also tried renaming these forms but get
the same message no matter what I try to rename them to. Any suggestions?
 
A

Allen Browne

Some kind of corruption appears to have occurred in this database.

1. Make a backup copy of the bad mdb, so that you get multiple chances at
rescuing it, in case any step makes it worse.

2. Create a new (blank) database.
Immediately uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html
Then press Ctrl+G to open the Immediate window.
Choose References from the Tools menu.
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

3. Close the code window. Back in the main window, choose File | Get
External | Import. Import just the tables and queries form the bad database.
For the kind of corruption you describe, this ought to work okay.

4. Once the tables and queries are imported, go back to File | Get External,
and try importing a form that has not been changed recently. If that works
(i.e. the import succeeds, and the form has its code after import), you may
be able to continue importing other forms, with the probable exception of
the one(s) gone bad.

For any forms you cannot import, you should be able to import those from a
backup copy. This gives you all your current data, and the older copies of
the forms. Other than where you have changed a form recently, this is a
pretty good outcome.

Other alternative you could try include a decompile, compact, decompile
sequence. Or you could try the undocumented SaveAsText to save the form to a
text file, and then try importing into the new database with LoadFromText.
But I don't like your chances of getting these suggestions to work with the
kind of corruption you described.
 

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