By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,928 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,928 IT Pros & Developers. It's quick & easy.

Best way to repair corrupted VBA code module?

P: n/a
Well, it has finally happened. We have a five year old app that is
widely distributed. I cannot get an update done because none of the
code modules will open. Access complains that the module is corrupt
or that it cannot be read from a network drive. They are not ON a
network drive.

Anyone have a clue how to repair this?

All help much appreciated.
Nov 13 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a

Forgot to mention -- it's an A2K app.
On Fri, 08 Apr 2005 01:47:50 -0500, Lauren Wilson
<pr*****@private.com> wrote:
Well, it has finally happened. We have a five year old app that is
widely distributed. I cannot get an update done because none of the
code modules will open. Access complains that the module is corrupt
or that it cannot be read from a network drive. They are not ON a
network drive.

Anyone have a clue how to repair this?

All help much appreciated.


Nov 13 '05 #2

P: n/a
Lauren Wilson wrote:
Forgot to mention -- it's an A2K app.
On Fri, 08 Apr 2005 01:47:50 -0500, Lauren Wilson
<pr*****@private.com> wrote:

Well, it has finally happened. We have a five year old app that is
widely distributed. I cannot get an update done because none of the
code modules will open. Access complains that the module is corrupt
or that it cannot be read from a network drive. They are not ON a
network drive.

Anyone have a clue how to repair this?

All help much appreciated.


Did you recently install a newer Office component? Here is a couple of
leads?

http://support.microsoft.com/default...b;en-us;304548
http://support.microsoft.com/default...b;en-us;326605

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #3

P: n/a
Rog
3 options:
- Tools/Database utilities/Repair database - but I guess you already
tried that.
- Decompile: start Access with the decompile switch, e.g.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" /decompile
then open the database and recompile it.
- If that doesn't work, create a new database and import everything.

Nov 13 '05 #4

P: n/a
On Fri, 08 Apr 2005 01:47:50 -0500, Lauren Wilson <pr*****@private.com> wrote:
Well, it has finally happened. We have a five year old app that is
widely distributed. I cannot get an update done because none of the
code modules will open. Access complains that the module is corrupt
or that it cannot be read from a network drive. They are not ON a
network drive.

Anyone have a clue how to repair this?

All help much appreciated.


First step - make a new copy of the file before each repair attempt, so you
don't make thigs worse.

Second step - try decompiling the application. To do this, first make sure
all start-up actions are disabled, then open access with the path of the
database file as the first argument, and /decompile as the next argument.

There's about a 50/50 chance that will fix it for you. If not...

I was able to work around a problem like what you describe once, but I can't
guarantee the solution will work for you.

What worked for me was to open a new Access database, and import objects one
at a time from the corrupted one (one object could not be imported and had to
be recreated from an older copy). They were still corrupted, but so long as I
didn't try to save changes, compile, or run anything, I could open the modules
and copy the code out as text.

After copying out the code text and saving it in text files, the next step was
to open yet another new Access database, import just the forms and reports
from the corrupted database (except the totally trashed one), and delete their
modules by changing their Has Module properties to No and saving them.
Finally, I manually pasted the code back in.
Nov 13 '05 #5

P: n/a
Rog wrote:
3 options:
- Tools/Database utilities/Repair database - but I guess you already
tried that.
- Decompile: start Access with the decompile switch, e.g.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" /decompile
then open the database and recompile it.
- If that doesn't work, create a new database and import everything.

One additional option; restore from backup.

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #6

P: n/a
On 8 Apr 2005 00:05:46 -0700, "Rog" <ro************@hotmail.com> wrote:
3 options:
- Tools/Database utilities/Repair database - but I guess you already
tried that.
- Decompile: start Access with the decompile switch, e.g.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" /decompile
then open the database and recompile it.
- If that doesn't work, create a new database and import everything.


When decompile doesn't work, importing objects doesn't usually work either.
The corruption either prevents importing or results in the corruption being
imported with the objects.

If the import works at all, though, it can sometimes help to import the
objects, then imediately do a decompile. Even then, it's likely you'll need
to delete all or many of the modules, and re-create them by pasting the text
back in, or the corruption will reappear after the next compact.
Nov 13 '05 #7

P: n/a
Lauren Wilson wrote:
Well, it has finally happened. We have a five year old app that is
widely distributed. I cannot get an update done because none of the
code modules will open. Access complains that the module is corrupt
or that it cannot be read from a network drive. They are not ON a
network drive.

Anyone have a clue how to repair this?

All help much appreciated.

Well, I've had about the same problem, only that Access Crashed whenever
I wanted to open a module or the Visual Basic Editor.
I solved it by going to the Modules tab, there I clicked on New Module.
Then the Visual Basic Editor popped up. Then I saved the project
(without saving, it didn't work), closed Access and reopened it. Finally
i deleted the new Module.

Olivié
Nov 13 '05 #8

P: n/a
On Fri, 08 Apr 2005 02:04:05 -0500, John Mishefske
<mi************@JUNKtds.net> wrote:
Lauren Wilson wrote:
Forgot to mention -- it's an A2K app.
On Fri, 08 Apr 2005 01:47:50 -0500, Lauren Wilson
<pr*****@private.com> wrote:

Well, it has finally happened. We have a five year old app that is
widely distributed. I cannot get an update done because none of the
code modules will open. Access complains that the module is corrupt
or that it cannot be read from a network drive. They are not ON a
network drive.

Anyone have a clue how to repair this?

All help much appreciated.


Did you recently install a newer Office component? Here is a couple of
leads?

http://support.microsoft.com/default...b;en-us;304548
http://support.microsoft.com/default...b;en-us;326605


Thanks a LOT John.

The 2nd article above has this portion:

"CAUSE
You may receive one of these error messages when both Microsoft Access
2000 and version 6.3.91.8 of the Vbe6.dll file are installed on the
computer, and either of the following conditions is true: • You
imported forms or reports that contain code modules or standalone
modules into a new Microsoft Access 2000 database by using Microsoft
Access 2000.
• You copied and pasted forms or reports that contain code modules or
standalone modules into the Microsoft Access 2000 database by using
Microsoft Access 2000.
Then, you close and reopen the database and try to view, execute, or
compile the code."

This is pretty much what happened. I wonder what that file:
"Vbe6.dll" is for? Is that the VBA for extensibility DLL?

What a mess. I have a lot of code to copy and paste into a new
database.
Nov 13 '05 #9

P: n/a
Lauren,
I've had this same issue dozens of times with A2k and it used to scare
me to death. I'm guessing you are developing in Ac2002. If so try
converting the database to ac2002 and then converting the new one back.
It always works for me.
HTH
Pachydermitis

Nov 13 '05 #10

P: n/a
On 8 Apr 2005 07:56:10 -0700, de******@hotmail.com wrote:
Lauren,
I've had this same issue dozens of times with A2k and it used to scare
me to death. I'm guessing you are developing in Ac2002. If so try
converting the database to ac2002 and then converting the new one back.
It always works for me.
HTH
Pachydermitis


Actually, I'm sorry to say, I'm still locked into A2K -- primarily
because most of my users are still on A2K full or runtime.

I WANT to jump to Access 2003 but I am unclear about what impact that
will have on my users and have not had the time to investigate it in
detail.
Nov 13 '05 #11

P: n/a
If you have office 2002/3 installed somewhere, use that to convert the
db to 2002/3. Then convert it back to 2000 (free of corruption we
hope) for your users

Nov 13 '05 #12

P: n/a
Steve Jorgensen <no****@nospam.nospam> wrote in
news:66********************************@4ax.com:
On 8 Apr 2005 00:05:46 -0700, "Rog" <ro************@hotmail.com>
wrote:
3 options:
- Tools/Database utilities/Repair database - but I guess you
already tried that.
- Decompile: start Access with the decompile switch, e.g.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
/decompile then open the database and recompile it.
- If that doesn't work, create a new database and import
everything.


When decompile doesn't work, importing objects doesn't usually
work either. The corruption either prevents importing or results
in the corruption being imported with the objects.

If the import works at all, though, it can sometimes help to
import the objects, then imediately do a decompile. Even then,
it's likely you'll need to delete all or many of the modules, and
re-create them by pasting the text back in, or the corruption will
reappear after the next compact.


If it's the VB dll error, it's hosed and unrecoverable, no?

In any event, you should at least try SaveAsText, which will show
you if the code is actually still there or not. I recently saved a
form where the VBA code window wouldn't open, but SaveAsText could
still extract the code.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #13

P: n/a
On Fri, 08 Apr 2005 19:10:46 GMT, "David W. Fenton"
<dX********@bway.net.invalid> wrote:
Steve Jorgensen <no****@nospam.nospam> wrote in
news:66********************************@4ax.com :
On 8 Apr 2005 00:05:46 -0700, "Rog" <ro************@hotmail.com>
wrote:
3 options:
- Tools/Database utilities/Repair database - but I guess you
already tried that.
- Decompile: start Access with the decompile switch, e.g.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
/decompile then open the database and recompile it.
- If that doesn't work, create a new database and import
everything.


When decompile doesn't work, importing objects doesn't usually
work either. The corruption either prevents importing or results
in the corruption being imported with the objects.

If the import works at all, though, it can sometimes help to
import the objects, then imediately do a decompile. Even then,
it's likely you'll need to delete all or many of the modules, and
re-create them by pasting the text back in, or the corruption will
reappear after the next compact.


If it's the VB dll error, it's hosed and unrecoverable, no?

In any event, you should at least try SaveAsText, which will show
you if the code is actually still there or not. I recently saved a
form where the VBA code window wouldn't open, but SaveAsText could
still extract the code.


It can be a mighty struggle sometimes, but I can't remember a time I wasn't
able to recover all but one or 2 code modules if I had to. Of course, the
recovery may not be worth the hassle, particularly if good backups have been
done (obviously, I've worked with some people who didn't do that).
Nov 13 '05 #14

P: n/a
Steve Jorgensen <no****@nospam.nospam> wrote in
news:4b********************************@4ax.com:
On Fri, 08 Apr 2005 19:10:46 GMT, "David W. Fenton"
<dX********@bway.net.invalid> wrote:
Steve Jorgensen <no****@nospam.nospam> wrote in
news:66********************************@4ax.co m:
On 8 Apr 2005 00:05:46 -0700, "Rog" <ro************@hotmail.com>
wrote:

3 options:
- Tools/Database utilities/Repair database - but I guess you
already tried that.
- Decompile: start Access with the decompile switch, e.g.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
/decompile then open the database and recompile it.
- If that doesn't work, create a new database and import
everything.

When decompile doesn't work, importing objects doesn't usually
work either. The corruption either prevents importing or results
in the corruption being imported with the objects.

If the import works at all, though, it can sometimes help to
import the objects, then imediately do a decompile. Even then,
it's likely you'll need to delete all or many of the modules,
and re-create them by pasting the text back in, or the
corruption will reappear after the next compact.


If it's the VB dll error, it's hosed and unrecoverable, no?

In any event, you should at least try SaveAsText, which will show
you if the code is actually still there or not. I recently saved a
form where the VBA code window wouldn't open, but SaveAsText could
still extract the code.


It can be a mighty struggle sometimes, but I can't remember a time
I wasn't able to recover all but one or 2 code modules if I had
to. Of course, the recovery may not be worth the hassle,
particularly if good backups have been done (obviously, I've
worked with some people who didn't do that).


Well, it depends on how recent your backups are. Losing 4 hours of
work is not as bad as losing the whole project, but it's still a
pretty severe problem.

In the case I was alluding to, it was a new form with newly-written
code, and there was no backup (it corrupted in the same session in
which it was created). It was complex enough that it was worth doing
some extra work to try to recover, though it wouldn't have been a
huge problem to recreate from scratch.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.