VBA corrupt

M

mcnews

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?

tia,
mcnewsxp
 
A

Arvin Meyer [MVP]

First, always work on a copy of the database. Working on the original may
make it impossible for a repair service to fix it.

Download a copy of JetComp.exe:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;273956

Try backing up your forms as text with the undocumented SaveAsText
LoadFromText functions:

http://www.datastrat.com/Code/DocDatabase.txt

Also have a look at the Microsoft KB article:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;209137

Then have a look at Tony Toews' Access Corruption FAQ at:

http://www.granite.ab.ca/access/corruptmdbs.htm

for some suggestions. Unfortunately, some corruption cannot be fixed - you
may need to create a new database, import what can be salvaged, and recreate
the rest.

Although it's a paid service, Peter Miller does an outstanding job of saving
corrupt databases. Try this URL:

http://www.pksolutions.com
 
J

John W. Vinson

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?

tia,
mcnewsxp

Find the backup... :-{(

See http://www.granite.ab.ca/access/corruptmdbs.htm for some possible
solutions, though I've had very little luck recovering databases with that
particular message.

John W. Vinson [MVP]
 
D

David W. Fenton

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.
 
T

Tony Toews [MVP]

mcnews said:
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?

Does the following KB article apply?

You may receive a "The Visual Basic for Applications project in the
database is corrupt" error message when you try to open an object that
is in a compiled database or in a compiled project in Access 2002, in
Access 2002 SP1, or in Access 2002 SP2
http://support.microsoft.com/kb/897764

If this is indeed the situation there is little if anything you can do
to get out of this problem.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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

Similar Threads


Top