Access databases having the vba stripped out

  • Thread starter Thread starter Huff
  • Start date Start date
H

Huff

All

We've had a strange problem that's affected two different databases on
a couple of different occasions. What happens is that at some point the
database loses all of the vba contained within it that is built around
the forms. All tables and queries remain intact, and the form design
itself remains, but it has none of the code attached.

At present we have no idea how a user could do this, nor can we find
out who has done it! Has anybody heard of such a problem and knows how
to prevent it?

Cheers

Doug
 
Huff said:
All

We've had a strange problem that's affected two different databases on
a couple of different occasions. What happens is that at some point the
database loses all of the vba contained within it that is built around
the forms. All tables and queries remain intact, and the form design
itself remains, but it has none of the code attached.

At present we have no idea how a user could do this, nor can we find
out who has done it! Has anybody heard of such a problem and knows how
to prevent it?

It is possible that someone went into desgn view and set the Has Module
property to No. If that's what happened, the code is gone. Perhapsthere is a
corruption that is hiding it. In that case you could try my documenting code
at:

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

You will back up the forms as text, then recreate them. Make sure you copy
the file and work on copies. If setting the Has Module property cause this,
creating MDEs will prevent this in the future.
 
Arvin

Thanks for your reply and the code on the site!

I've now got two questions!

1. I can't get your code to run - it always produces a 'can't access
the file' error when creating the first text file. I've tried changing
the path to a different drive, or the same drive as the database
resides on but to no effect. I'm sure I'm missing the obvious here, but
could do with the necessary pointer!

2. Both of the databases that this has happened to have a lot of forms
within them, and the end users for both would be very unlikely to go in
to each form and purposefully wreck it. Do you know of a method that
could wipe the vba from upwards of 50 forms in one go?

Thanks again!
Doug
 
Actually, the problem the file your code was trying to run was down to
the form name itself - it had brackets in the form name. Working fine
now - thanks!!
 
Can you get into design mode of the form? If not someone may have converted
it to an mde. If you can get into design mode but not see the code, you could
have a corruption issue. One might be to do a decompile then recompile the
code on a copy of the database for testing. You can find more about
decompiling at:

http://www.granite.ab.ca/access/decompile.htm
 
Thanks for the replies!

I don't think that the databases are being converted. The file
extension was still MDB on both databases, plus I can still go into the
form design. If you right click on any command buttons to view any
events or procedures that should be stored there the code simply isn't
there. If I re-write the code the forms then function correctly.

I guess it all points to some form of network corruption, but the
actual data in the DB is unaffected so I can't understand why this
should happen....

Grrr!
 
It's possible that the front-end is entirely corrupted as far as the code is
concerned. That sometimes happens if 2 people are sharing the same front-end
file from the server. Make sure that your application front-end is split ant
running from each workstation. Even a Citrix or Terminal Server needs to run
a separate copy for each user.

Make sure that you have sufficient copies of the file to work with. 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
 
This use to happen all the time in Access 95. I still have repressed memories
of that piece of junk! The decompile then recompile of the database file
would fix the problem for a while. Try doing a decompile on a copy of the
database with missing code and see if it shows back up.
 

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

Back
Top