Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

Can't open source - Microsoft Access had encountered a problem and needs to close

I am running Access 2003 on XP 2002 SP2. Something wierd is happening. I have an ADP file that I have been working with for several years. Just today, when I attempt to open any module or form source code. I get an error: "Microsoft Office Access has encountered a problem and needs to close ...". It continually does this, even after reboot. I can do no work at all. What is going on? How do I get around this?

This is fairly urgent because 1099 tax forms need to be printed out of this system by tomorrow!!!
Avatar of tonydemarco
tonydemarco
Flag of United States of America image

Try holding down the shift key while opening the file.
Then go to tools database utilities "compact repair"
Avatar of Mark
Mark

ASKER

Compact Repair did not work; still gave me the error message and termianted whenever I tried to open any source. But I did get it working. Here's what I did: The last thing I did before this started happening was to make a minor VBA code change to a module (in fact, very minor - I just changed the contents of a string used in a query). I reasoned that there must be something wrong with this module. So, I opened up a new database and did a cut on the module in the misbehaving database and pasted it into the new database. In the new database I was finally able to open the module source code. I copied the VBA code and pasted it to a notepad txt. I then closed everything and opened the original database (now missing this module). I created a new module and simply pasted the contents of my paste bufferinto this new module. I saved and renamed the module to the original name and, voila! problem gone. I am able to compile to an ADE and open all sources again. I have no idea what the problem was. I made no changes to the module source. Who knows!
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Try the full procedure below:

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

But first, if you have not already:
Check for any **Missing References via the VBA Editor>>Tools>>References ....

Then, follow this procedure:

0) **Backup your MDB**
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 ...
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) 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:
       >>Debug>>Compile
        Note ... after the word Compile ...you will see the name of your 'Project' - just an fyi.

6) Close the mdb
7) 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) for 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:

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\AzDoc\Pgrm\AzDocPgrm2K3.mdb"

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

http://www.trigeminal.com/usenet/usenet004.asp?1033

mx
Before doing any more work on this database, I'd strongly encourage you to move your objects to a new database container. Even though it's "fixed", you obviously have some issues with the vba container.

Open Access, then open a new, blank database. Import all your objects from the problem db. Remake you references, if necessary, then compact and repair this one. Make a copy of this new database, then go back to development.
And if you make a new MDB, then run the full Decompile procedure.

mx
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial