Access fails - but works if I have a break point

G

Guest

I have this application that I develop. It somehow just got corrupted.

The mdb file wont run any more, and when I shut down Access it writes a
message about critical error. If I place a breakpoint in my startup form's
code - it breaks as requested and then continues if I press F5. And then the
application runs as it should. So "breaking" makes it ok - but it fails
without the breakpoint....

Problem is then solved by going back to an earlier version - but it is
somehow annoying that it can happen. I have had similar experience on other
Access applications.

Any way to repair such a situation so I dont have to go back? I back up
often - so I havent really lost much, but i would like to be able just to
recover and continue.

RSunday
 
G

Guest

There are procedures for recovering objects from a corrupt database, but if
you have a recent backup and won't loose much, it will probably be faster and
more reliable to go to the back up.
One thing you can do that will help avoid future corruption is to check the
Compact on Close option under Tools, Options, General Tab.
Another thing is that if multiple users are using the same copy of the app
in a shared folder, you are begging for corruption. ALWAYS split you
database. Only the back end should be in a shared folder. Each user should
have a copy of the app on their desktop linked to the data (back end) on the
shared folder.

A decompile might help. See this link for Info:
http://www.granite.ab.ca/access/decompile.htm

If it turns out you need to try to recover a corrupt mdb, here is a guidline:
1. Make a backup copy
2. Copy all your code, standard modules, form modules, and report modules to
a external text format.
3. Open each form and report in design view, Change the Has Module to No for
all of them.
4. Open a new mdb
5. Copy all your objects excepot modulesfrom the original (corrupt) database
6. For each standard module, open a new module and paste the code back in
from the text version you saved earlier.
7. Open each form and report that had a module, change the Has Module back
to Yes, open the module for the object and paste the code back in.
8. Compile the code
9. Do a Compact and Repair
10. Pray, because it still may not work

See why the backup is probably easier?
 
C

Crystal

Add this statement:

DoEvents

DoEvents is used to make VBA pay attention to what is
currently happening and look to see if the OS (Operating
System) has any requests.

ie: if you have a loop and want to be able to BREAK it with
CTRL-BREAK, put DoEvents into the loop

DoEvents will also update values written to a form by a
general procedure or code behind another form or report

A DoEvents is done when you use MsgBox, or are stepping
through code (since it has to pay attention to the keyboard)

It is a good way to say, "Wake Up!"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
G

Guest

Thanks for the input.
For general info: I have it split in frontend and backend - and this is not
shared by anybody. It all happens in my "development environment", where I am
the only one doing anything.
I will check the "compact on close" for the future.

RSunday
 
M

Michael J. Strickland

RSunday said:
I have this application that I develop. It somehow just got corrupted.

The mdb file wont run any more, and when I shut down Access it writes a
message about critical error. If I place a breakpoint in my startup form's
code - it breaks as requested and then continues if I press F5. And then
the
application runs as it should. So "breaking" makes it ok - but it fails
without the breakpoint....

Problem is then solved by going back to an earlier version - but it is
somehow annoying that it can happen. I have had similar experience on
other
Access applications.

Any way to repair such a situation so I dont have to go back? I back up
often - so I havent really lost much, but i would like to be able just to
recover and continue.

RSunday


If you are talking about corruption where Access hangs when you try to
view/edit a form's source code, I've found a procedure that works to recover
it.

1. After opening the corrupted database, do a compact/repair and close the
database.

2. Re-open the database.

3. Import a known (good) form.

4. Run this form and break out of it using Ctl-Break.

5. Click the Debug button. It should break into the good form's code.
If it doesn't (and hangs), then use Alt-Ctl-Del to shutdown Access.
Then re-open the database, delete the imported module, Compact/Repair,
and repeat steps 1-4.

6. Once you have broken into the good form's source code, Use Project
Explorer to select the corrupted form's source code.

7. Re-compile (all).

8. Close/Save all forms/modules.

9. Compact/Repair and close the database.


It seems sometimes Access loses some source code viewing information which
is restored when you import a good form/module.

--
 

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