
Originally Posted by
ssanfu
Were you single stepping through the code while editing the code? I found out the hard way that single stepping through the code and making changes to the code is a good way to corrupt the VBA project. The VBA project is the part of the dB that holds all of the VBa you write. When that goes bak, you get the type of errors you reported.
Took me a week to figure this out.
What I did was:
1) You should ALWAYS make back ups. (the 3 rules of computing are 1) Backup...2) Backup... and 3) you guessed it BACK-UP!!)
2) I opened a copy of the corrupt dB by holding down the shift key.
3) If you can open the IDE and see the VBA form module code, copy the code from each form and paste it into a text file (one text file for one form). Save the text file with the name of the form.
4) Provided you can open the forms in design view, open EACH form (one at a time), open the properties dialog box, click on the "Other" tab and set the property "Has Module" to NO. Close and save the form. This will delete the VBA project from that form.
5) Once all of the form modules are gone, if you can open the standard modules, open then (in design mode), copy all of the code and paste the code into a text file. I named the text file the same as the module name. Then delete the code module.
6) Once all of the modules have been deleted, create a NEW dB and copy the tables, queries, forms ( be careful to NOT copy a corrupt form, do a "Compact and Repair" after each object import) and reports. Do not copy the modules or you will have a corrupt VBA project again.
7) Again, do a "Compact and Repair" on the NEW dB.
8) Now the tedious part. If you were able to copy the VBA from the corrupt dB (if not, copy the code from a backup dB) and paste it back into each form.
a) Open EACH form (one at a time), open the properties dialog box, click on the "Other" tab and set the property "Has Module" to YES. Then open the text file for that form, copy the code and paste it into the form module.
9) Create NEW modules, rename them to the correct names, copy the code from the text files and paste into the modules.
Now, in the IDE, do a "Compile", then save the IDE (use the diskette icon or CTL-S).
In Access , do a "Compact and Repair". Close the dB, then open it. Open the "Main Menu" or whatever you call the first form that opens.
Hopefully, you have a working dB now.