Access database corrupted, then backup becomes corrupted

Posted on 2011-09-19
Last Modified: 2012-08-14
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?

Question by:gordonwwaugh
  • 2
  • 2
  • 2
  • +1

Author Comment

ID: 36563282
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.
LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 36563304
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

LVL 26

Expert Comment

ID: 36563365
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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 61

Expert Comment

ID: 36566252
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.


Author Closing Comment

ID: 36566985
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.
LVL 26

Expert Comment

ID: 36567662
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.

LVL 75
ID: 36567977
Long live Decompile, DAO and JET!


Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Query: Text to Date 10 32
Access #Deleted data 20 43
VBA Delete sql "Too Few Parameters" 8 24
Access vs Access runtime 6 16
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question