VBA Project is Corrupt

D

Dennis

I have a problem: I was running a VBA access module on a very large database
(520,000 recs) and suddenly got an "Invalid Argument" popup, after processing
all but about 17,000 records. Since I'd previously debugged the code, I know
it works. (However, this IS a new project under development.)

I closed out and rebooted, and now I get the error:

The Visual Basic for Applications project in the database is corrupt

Now, how can I recover this? I need the mods I made on Friday, so I need the
code. The rest of it is completely backed up, so not a problem. Oh, and to
add something to the mix, when I checked the file information for the
database, its size shows as 2,097,124 kb (2 gig), when it never ran larger
than 1.2 Gig on the same data.

The added code processes at a later stage of the program, so I know it's not
involved. Running Win2KPro and Access 2002 (Office XP).

Any insight would be hugely appreciated.

Thanks!
 
K

Ken Snell [MVP]

Create a new database and import all the objects (including the modules)
into it.

When a database exceeds 2 GB for ACCESS 2000 and up, everything pretty much
just shuts down....

And be sure you keep backups as you do your work...if you had, you could
just go back to that backup and continue your work.
 
P

Paul Overway

2 gig is max file size for an MDB, so, it isn't a surprise that you'd get an
error. Create a backup of the file, and then try to compact it from the
command line.
 
D

Dennis

All efforts to import/export/repair have failed. I have the tables, but the
code I did on Friday cannot be reached. Is there some way I can get to that
program?
 
P

Paul Overway

This is just a swag, but if you have programattic access to the tables, you
might be able to delete a big one and free up some space to allow a
compact/repair. From another database, use code similar to what follows on
a COPY of the database:

dim db as database

Set db = OpenDatabase("path and name of MDB copy")
db.TableDefs.Delete "Some big table name here"
 
D

Dennis

I actually exported all tables to a "recovery" database without problem.
Also, I was able to export all queries, etc. (The database DOES open fine,
and will export out, but I can't import FROM it into another db.)

I can even pull up the form in design mode. The ONLY thing I cannot do is
select PROERTIES and view the code behind the OnClick event procedure (my
code).

I manually deleted the tables as well, after exporting them. But every
attempt to compact/repair results in the same error.

Truly bizarre.
 
P

Paul Overway

Try this from a command line (on a copy):

"path to msaccess.exe" "path to copy of MDB" /decompile
 
D

Dennis

No go. Looks like the 2 Gb limit trashes every method of extracting the code.
Where is the decompiled code suppoed to show up?

Oh, and one more question: during this phase, I have a debug.print for every
hundred recs (just to make sure I'm processing). These debug.prints will be
removed in the production version. Do these prints require "workspace" in the
database? In other words, is having these prints turned on contributing to
the HUGE (10x) workspace size in excess of the table sizes?

Thanks
 
P

Paul Overway

Decompile basically resets the code to text form vs compiled form. It is a
useful switch whenever an app starts acting flaky or crashes. The
debug.print statements aren't a problem. You might trying being selective
in respect to which forms and modules you import...import them one at a
time. Sometimes, it is just one form or module that is corrupt.
 
D

Dennis

I only have one form, with a single "Execute" button. That vb "event
procedure" does all the work. And it was hosed. I could physically copy/paste
the form components into another (blank) form without any problem. Everything
was there except that vB code. I just cannot get to it. I did re-code the app
today, but this is really annoying. I was hoping there was a way to recover
from something like this.
 

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