Access 2000, VBA Code corrupt


R

Rlee

Hi there,

I am working with Access 2000 and have 2 VBA items that i'm unable to open.

I am unable to open the VBA Class Code ("Items"), which was originally an
import from a VB6 program.. I had no problem until the other day when i
noticed some odd things happening with the program.

Also, the form that accesses this Items class is also corrupt (the VBA part,
i can see the form itself).

Does anyone know of a way to recover the VBA code itself? I've tried to do
the compact and repair, as well as make sure i am running sp3 and the vba
code is still inaccessable.

The Error i get whenever i open that (or any form) is "Error Accessing File.
Network connection may have been lost".

Thanks to anyone who may be able to help.
 
Ad

Advertisements

M

Michael J. Strickland

Rlee said:
Hi there,

I am working with Access 2000 and have 2 VBA items that i'm unable to
open.

I am unable to open the VBA Class Code ("Items"), which was originally
an import from a VB6 program.. I had no problem until the other day
when i noticed some odd things happening with the program.

Also, the form that accesses this Items class is also corrupt (the VBA
part, i can see the form itself).

Does anyone know of a way to recover the VBA code itself? I've tried
to do the compact and repair, as well as make sure i am running sp3
and the vba code is still inaccessable.

The Error i get whenever i open that (or any form) is "Error Accessing
File. Network connection may have been lost".

Thanks to anyone who may be able to help.

If by "unable to open" you mean Access hangs when you try to open it in
Design View, you might try this:

1. Make a backup of the database (in Windows).
2. Open the database and do a compact/repair.
3. Close the database.

4. Re-open the database and import a different, working form (e.g.
frmABC).
5. Run the working form and Hit Ctl-Break to break its code execution.
6. Click on the "Debug" button.
7. Hit Ctl-R to go into Project Explorer.
8. Click on the Reset button to stop code execution.
9. In the panel on the left, select the corrupt form to view its code.
10. Click Debug->Compile to re-compile the corrupter form.
11. Exit design mode saving the form and the database.
12. Re-open the database and your form should be restored.

It seems that sometimes Access (2003 & 2007) forms get corrupt and lose
something which is needed for Design Mode/Compilation. Importing a good
form restores/restarts this process and allows you to open/edit and
restore a corrupt form.


--
 
R

Rlee

No i didn't have a backup of the changes (it was an update i was working on
on my local computer)...

I figure i'm probably having to re-write it all...
 
R

Rlee

Hi Michael,

Thanks for responding..

Unfortunately, its only when i open the VBA portion of the form... Access
does not open it up. I still get the "Error accessing file. Network
connection..."... This file is on my local computer...

I've tried to import it into a clean database, and i still get the same
errors.

In the end, i'm just having to re-write the entire thing.

Thanks anyway for the help.
 
R

Rlee

Thats the problem.. if i could open the vba code itself, then i would do
that...

Unfortunately thats where the error occurs.. when i try to open it... is
where i get that error.

Oh well, i've almost finished re-writing it anyway... just wish i didn't
have to.

Thanks again.
 
Ad

Advertisements

J

Jim Burke in Novi

I've had that problem before after importing a form or report that had code
behind it or importing a module. I can't say this will work for you, but it
worked for me (you'll need to have an old backup of the form and it's code
for this to work)

1) Delete the class and the form and create new versions of them (get the
class from where you got it before, get the form from your backup if you have
it)

2) go into the VBA immediately after you have the new copies of the class
and the form and do a Debug, Compile, then do a File, Save.

This has always worked for me when I had this problem. Always make sure you
take backups of your appl before making any type of major change!
 
R

Rlee

Hi tkelley,

I actually did try that before giving up :)... lol... The VBA code was all
gone... but i was able to access the form and class (even though they were
blank).

Thank you though...

....Robin
tkelley via AccessMonster.com said:
Try a decompile before you totally give up (unless you have already).

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

or google for more "access decompile"
Hi Michael,

Thanks for responding..

Unfortunately, its only when i open the VBA portion of the form... Access
does not open it up. I still get the "Error accessing file. Network
connection..."... This file is on my local computer...

I've tried to import it into a clean database, and i still get the same
errors.

In the end, i'm just having to re-write the entire thing.

Thanks anyway for the help.
Hi there,
[quoted text clipped - 39 lines]
form restores/restarts this process and allows you to open/edit and
restore a corrupt form.
 
R

Rlee

Hi Jim,

Unfortunately these changes were brand new so i don't have any backups of
it...

However, I do have backups of the "live" version (front end for the users),
but i don't have a backup of my local version where i do development on
it...

Guess i need to change the location of it so that it does get backed up :)

Thanks

....Robin
 
J

Jim Burke in Novi

If you have backups of the live version, why can't you just import the old
form form one of those backups?
 
R

Rlee

It was my development file that got corrupted, not the live... The live file
doesn't have the new stuff... i was nearly finished it in fact...

As soon as i imported the form and class to the live file, i had the same
problem...
 
Ad

Advertisements

M

Michael J. Strickland

Rlee said:
Hi Michael,

Thanks for responding..

Unfortunately, its only when i open the VBA portion of the form...
Access does not open it up. I still get the "Error accessing file.
Network connection..."... This file is on my local computer...

I've tried to import it into a clean database, and i still get the
same errors.

In the end, i'm just having to re-write the entire thing.

Thanks anyway for the help.

....
If by "unable to open" you mean Access hangs when you try to open it
in Design View, you might try this:

1. Make a backup of the database (in Windows).
2. Open the database and do a compact/repair.
3. Close the database.

4. Re-open the database and import a different, working form (e.g.
frmABC).
5. Run the working form and Hit Ctl-Break to break its code
execution.
6. Click on the "Debug" button.
7. Hit Ctl-R to go into Project Explorer.
8. Click on the Reset button to stop code execution.
9. In the panel on the left, select the corrupt form to view its
code.
10. Click Debug->Compile to re-compile the corrupter form.
11. Exit design mode saving the form and the database.
12. Re-open the database and your form should be restored.

It seems that sometimes Access (2003 & 2007) forms get corrupt and
lose something which is needed for Design Mode/Compilation. Importing
a good form restores/restarts this process and allows you to
open/edit and restore a corrupt form.


--
-----------------------------------------------------------------------
Michael J. Strickland
Quality Services
(e-mail address removed)
703-560-7380
Did you try my steps?

They are specifically for a form which will not open in the VBA editor.
The ides is that you import a different form, run it, break out of its
execution
and then you are in the VBA editor where you can switch to the
non-working form and re-compile its code.


--
 

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

Top