Access 2007 VBA hangs and wont let me fix the problem

E

Eirik

Hello!

I have a complex .accdb database which i after yesterdays changes cannot
enter the VBA anymore. Most of the forms and all tables/queries works fine.
But one of the forms causes it to hang and everytime i try to enter VBA it
hangs so i cant find a way to fix it.
I belive that it corrupts in some of the code i wrote yesterday.

This is an extraordinary fault, i have never seen access behave like this in
my 2-3 years of experience. I have tried to import all object to new
database, it also hangs when trying to import forms with VBA code. I have
tried debug and repair, i have tried to save it in 2003 format and so on.

The cpu usage goes up to 50% and stabilizes there, everytime it hangs.

Can some of you guys think of more thing i could try? I hope i wont go back
to my backup cause i cant remember all changes i did to the code.
 
D

Dirk Goldgar

Eirik said:
Hello!

I have a complex .accdb database which i after yesterdays changes cannot
enter the VBA anymore. Most of the forms and all tables/queries works
fine.
But one of the forms causes it to hang and everytime i try to enter VBA it
hangs so i cant find a way to fix it.
I belive that it corrupts in some of the code i wrote yesterday.

This is an extraordinary fault, i have never seen access behave like this
in
my 2-3 years of experience. I have tried to import all object to new
database, it also hangs when trying to import forms with VBA code. I have
tried debug and repair, i have tried to save it in 2003 format and so on.

The cpu usage goes up to 50% and stabilizes there, everytime it hangs.

Can some of you guys think of more thing i could try? I hope i wont go
back
to my backup cause i cant remember all changes i did to the code.


Have you tried decompiling the database? First, make a copy of the database
in its current state -- better yet, two copies -- just in case something you
do makes the problem worse. Here are steps to decompile:

1. With the database closed -- no users in it at all -- and (ideally) Access
not running, make a backup copy.

2. On the task bar, click Start -> Run...

3. Enter this (adapted to match your database path and name) in the Run
dialog box and click OK:

msaccess.exe /decompile "C:\My Documents\YourDBName.accdb"

You may need to include the full path to msaccess.exe, but I don't find that
to be the case when I try it. Depending on your Access version, you may not
get any sign that anything in particular happened. Your database will
probably open in Access.

4. Compact and Repair your database.

5. Open the database again, press Alt+F11 to switch to the VB Editor, and
click Debug -> Compile (your project). If any errors appear, fix them and
recompile.

6. Close the VB Editor. Compact & Repair again.

See if the problem has disappeared.

If that doesn't work, you might try using the almost-undocumented
Application.SaveAsText method to export the corrupt form to a text file.
Then import all the other objects (except that form) to a new database, and
use Application.LoadFromText to import the text file into the new database.
 
E

Eirik

That worked! Thank you :)

Dirk Goldgar said:
Have you tried decompiling the database? First, make a copy of the database
in its current state -- better yet, two copies -- just in case something you
do makes the problem worse. Here are steps to decompile:

1. With the database closed -- no users in it at all -- and (ideally) Access
not running, make a backup copy.

2. On the task bar, click Start -> Run...

3. Enter this (adapted to match your database path and name) in the Run
dialog box and click OK:

msaccess.exe /decompile "C:\My Documents\YourDBName.accdb"

You may need to include the full path to msaccess.exe, but I don't find that
to be the case when I try it. Depending on your Access version, you may not
get any sign that anything in particular happened. Your database will
probably open in Access.

4. Compact and Repair your database.

5. Open the database again, press Alt+F11 to switch to the VB Editor, and
click Debug -> Compile (your project). If any errors appear, fix them and
recompile.

6. Close the VB Editor. Compact & Repair again.

See if the problem has disappeared.

If that doesn't work, you might try using the almost-undocumented
Application.SaveAsText method to export the corrupt form to a text file.
Then import all the other objects (except that form) to a new database, and
use Application.LoadFromText to import the text file into the new database.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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