i have inherited an MDB that gives me a "Visual Basic for
Applications project in the database is corrupt" error message. i
can't look at any code, can't export form to another MDB etc.
what causes this and what can i do to fix - if anything?
Arvin has given you the best advice that will help you recover the
project if it is recoverable.
But he doesn't mention the important things to do to prevent
corruption from happening in the first place:
1. make backups every day, and after every major coding cycle.
2. continually compile while coding. I generally do it after every 5
or 10 lines of code.
3. turn off COMPILE ON DEMAND in the VBE Options.
4. periodically DECOMPILE and compact/recompile/compact your
application to remove the crud that builds up with partial
compilation (see
http://trigeminal.com/usenet/usenet004.asp?1033).
5. and make backups on a regular basis.
In 11 years of professional Access development, I've lost only 2
forms to corruption. Most of the work in those was recoverable from
backups, but some of it had to be recoded.
It's actual somewhat difficult to clean up an MDB that's developed
code corruption (corruption in one object tends to leak into other
objects so that it's impossible to get rid of), so it's usually best
to start over with a brand-new MDB and import all the non-corrupt
objects into it, and then recreate the lost corrupted objects in the
new MDB.
Much of this is covered on Tony's corruption page, but I thought it
was important to bring it up here.