Access database corrupted, then backup becomes corrupted

I made a few changed to an Access 2003 database: Added two very simple select queries and added about 20 lines of VBA code to a form. When I reopened the file, I got the following error when Access was opening the database: "Microsoft Access has stopped working." When I clicked "Show Problem Details: It displayed the following:

Problem signature:
  Problem Event Name:      APPCRASH
  Application Name:      MSACCESS.EXE
  Application Version:      14.0.6024.1000
  Application Timestamp:      4d83e4fc
  Fault Module Name:      VBE7.DLL
  Fault Module Version:
  Fault Module Timestamp:      4d430aec
  Exception Code:      c0000005
  Exception Offset:      00023081
  OS Version:      6.1.7600.
  Locale ID:      1033

Additional information about the problem:
  LCID:      1033
  skulcid:      1033

Luckily, I created a backup copy just before I had made the changes. So, after copying my backup, I opened it. Just to be safe, I compacted and repaired the database before continuing. Then I made the same changes and did another compact/repair. I closed the database. When I reopened it, I got the same error message as before. My copy of the original database opens just fine.

By the way, the program uses linked tables to a single backend database.

Perhaps the VBE7.DLL file is corrupted?

I can open other databases just fine--including the previous version of this file. However, I have not done extensive testing of any of the other databases. I am using Access 2010.

Perhaps I should make the changes to the backup, one line of code at a time. Then exit Access and relaunch it. When it will not reopen, perhaps the last bit of code I added is related to the problem.

Any ideas?

Who is Participating?

Improve company productivity with a Business Account.Sign Up

DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
Try this procedure on the suspect db:

A **DeCompile** may help here ...

But first, if you have not already:
Open the VBA Editor and from the menu ...Tools>>References ....
If you see any listed as **Missing: <reference name>, including the asterisks and the word Missing, the
you need to fix that first.

Then, follow this procedure:

0) **Backup your MDB BEFORE running this procedure**
1) Compact and Repair the MDB, as follows:
Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
Close the mdb after the Compact & Repair.
2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
3) Close the mdb
4) Open the mdb and do a Compact and Repair (#1 above).
5) Close the mdb.
6) Open the mdb:
    a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
    b) From the VBA Editor Menu at the top of the window:
        Note ... after the word Compile will see the name of your 'Project' - just an fyi.

7) Close the mdb
8) Compact and Repair one more time.

*** Executing the DeCompile **EXAMPLE**:
Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
Also, the double quotes are required.

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

For more detail on the Decompile subject ... visit the Master on the subject (and other great stuff) Michael Kaplan:

AND ...
Once you get familiar with the Decompile idea (and ALWAYS make a BACKUP first!) ... you can add both Decompile and Compact/Repair to the Right Click menus in Windows Explorer, which I use multiple times daily:

Getting the Decompile and Compact context menu options

gordonwwaughAuthor Commented:
I did a bit more troubleshooting. Adding the queries was no problem. The problem occurred when I added a button to a form. With this version (with a button), Access crashed when I do anything related to VBA (e.g., clicking buttons on a form). Even opening VBA from my ribbon crashes Access. However, I can run queries without any problem.

And it's only in this file that VBA crashes Access. VBA works fine in my other Access files.
I would rebuild the object you are trying to edit.
Chances are it has gotten brittle.

I regularly destroy OP's samples from here when they were created by A2007+ form wizards and I edit them with A2003.

Create a new form.
Copy all the controls from the old one
Copy all the code from the old one
Copy things like RecordSource, form background pictures etc.

I find it very likely that edited object is the culprit.
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Curious -

What was the nature of the code and/or other changes you made to the database?

Also,  have you been taking steps to prevent corruption, such as using a split frontend/backend setup? Tips here:

Read the tips, and the discussion comments. The tips overall are sound (with the possible exception of 'compact on close', which I have never had issues with personally but others have found to actually be a source of corruption).

A possible problem with your approach of working with a backup copy of this database is that any objects or data that are corrupted are getting passed on from your backup to whatever copy you are working on.

If it is one particular form giving you this trouble, As Nick suggested you might try creating a new copy of it and copy/pasting the controls from the original onto it.

gordonwwaughAuthor Commented:
The decompile worked! Thanks!

Actually, it worked on one of my two corrupted versions of the file. In the other version of the file, Access crashed when I selected Compact/Repair within Access.
I have a folder near my dev and production folders called Decompile.
It has a short little text file with
Backup ~ decompile ~ compact ~ compile ~ compact again
Written in it, so I have the instructions, and it has 'preloaded' shortcuts with the right command built in them for each db that may need decompling
I am running x64 Windows so the shortcuts are

"C:\Program Files (x86)\Microsoft Office\OFFICE11\MSACCESS.EXE" "PathToWhateverFileNeedsDecompling" /decompile
The folders on the M:\ drive so PathToWhateverFileNeedsDecompling is "m:\decompile\somefilename.mdb"

I drag and copy in whatever needs decompiling, and double-click.
Then I drag and copy it back out.
Simple and convenient--and it makes the backup immediately since you are not decompling the original, but the copy you've created in the decompile folder.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Long live Decompile, DAO and JET!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.