Correct Methodology Rebuilding Corrupt DB (1 Viewer)

eirman

Registered User.
Local time
Today, 22:07
Joined
Aug 16, 2013
Messages
38
I had a badly corrupted form in a front end DB. Compact/Repair didn't work. Importing everything into a new DB didn't work .... the db crashed access.

I imported everything except the dud form into a new db and everything was fine. I copied all the fields and controls into a new form.
When it came to copying the VBA, I did it one control/procedure at a time (from the Property Sheet) as I though it was safer.

Was I being over-cautious? Could I have safely copied/pasted all the code in one go ?
 

Steve R.

Retired
Local time
Today, 18:07
Joined
Jul 5, 2006
Messages
4,617
As a first step, look at using the decompile switch. Click on the link below.
ms-access: HOW TO decompile and recompile

Assuming that you get an error message, this can be helpful. As a corruption example, I had one line of code that looked correct, but keep failing. I even edited that line, but to no avail. As a last resort, I typed a new line and deleted the old line. The code worked!

I have also used a slow methodical last resort brute force approach. Basically, follow how the code executes and "remove" chunks of code associated with a particular action. You can "remove" the code either by commenting it out or by actually deleting the code. Keep repeating the removal process (of code that executes) until the form does not crash.

Once the form fails to crash, you will then need to: 1) isolate the offending code segment and 2) restore the code deleted. In restoring the code, it needs to be restored and tested by segment.

To test if the brute force approach may work; make a copy of the form, delete all code and see if the form loads successfully. If the form does not load, start deleting the controls one by one. But by that point, you may just want to simply create a new form. If you decide to create a new form, it might be advisable not to copy anything from the old form.
 

eirman

Registered User.
Local time
Today, 22:07
Joined
Aug 16, 2013
Messages
38
Great link on decompiling/compiling Steve. Thanks
 

Users who are viewing this thread

Top Bottom