Corrupt database

R

Rod

I have an Access database that has been corrupted. I can open it but as soon
as I try and do anything it crashes with "Microsoft Access has encounter a
problem and needs to close. We are sorry for the inconvenience".

I have created a blank database and tried imported stuff from the corrupted
file in but as soon as I select the corrupted file I get the same error
message. Database compact and repair also gives the same error.

All I want to extract is the VBA code. I don't care about the tables,
perversely it will let me export those, but my backups cover them anyway.

The database is 2000 format but was created with XP.

Any suggestions on how I can get my code back please.


many thanks
 
A

Allen Browne

There could be many things going on here, but give this a try.

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

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

3. Close Access. Make a backup copy of the file. 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"

4. Open Access, and compact again.

5. Create a new database. Immediately, turn off the Name AutoCorrect check
boxes.

6. Set minimal References under Tools | References (from the code window).
If you are not sure which references you need, see:
http://allenbrowne.com/ser-38.html

7. Import the tables and queries (File | Get External | Import) the tables,
or link the tables (File | Get External | Link) if the database is split.

8. Make a backup of the new database, so you can revert to this point.

9. Import the other forms. Watch the names of the forms as the import takes
place. If it crashes during the import, revert to a copy from step 8, and
import the *other* forms. Watch again: there may be more than one that is
corrupt.

10. Import the reports and modules, using the same process as step 9.

11. Import any macros.

The basic idea is to get Access to recreate the database without referring
to any corrupt module, form, or report. Some corruptions may still prevent
this kind of process from succeeding, but it works with more than 50%.

The sequence corrects:
- Name AutoCorrect corruptions;
- bad indexes;
- inconsistencies between the text- and compiled versions of the code;
- problems associated with different binaries in different versions of
Access;
- reference issues.
 
R

Rod

Absolutely bloody brilliant
thank you


Allen Browne said:
There could be many things going on here, but give this a try.

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

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

3. Close Access. Make a backup copy of the file. 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"

4. Open Access, and compact again.

5. Create a new database. Immediately, turn off the Name AutoCorrect check
boxes.

6. Set minimal References under Tools | References (from the code window).
If you are not sure which references you need, see:
http://allenbrowne.com/ser-38.html

7. Import the tables and queries (File | Get External | Import) the tables,
or link the tables (File | Get External | Link) if the database is split.

8. Make a backup of the new database, so you can revert to this point.

9. Import the other forms. Watch the names of the forms as the import takes
place. If it crashes during the import, revert to a copy from step 8, and
import the *other* forms. Watch again: there may be more than one that is
corrupt.

10. Import the reports and modules, using the same process as step 9.

11. Import any macros.

The basic idea is to get Access to recreate the database without referring
to any corrupt module, form, or report. Some corruptions may still prevent
this kind of process from succeeding, but it works with more than 50%.

The sequence corrects:
- Name AutoCorrect corruptions;
- bad indexes;
- inconsistencies between the text- and compiled versions of the code;
- problems associated with different binaries in different versions of
Access;
- reference issues.
 

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