"VBA project cannot be read" error message

Alc

Registered User.
Local time
Today, 11:09
Joined
Mar 23, 2007
Messages
2,421
I came into work this morning to be greeted by a user telling me he had an error message on-screen, after trying to open a database. I should stress that this database was working perfectly when I left work yesterday.

The message reads
"The database cannot be read because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project.

To create a backup copy, click Cancel and then make a backup copy of your database. To open the database and delete the VBA project without creating a backup copy, click OK."

I already had a backup, so was able to revert to that and all seems to be okay. What I'm worried about is why this happened? Does anyone have any idea what could have caused this?
 
The database has been corrupted, probably because of an abnormal termination or closing of the program.
 
When this happens, it erases all the VB code. You must copy your backup back to production.
 
This just happened again.

I was using a database, then I started to get a "File not Found" message. I closed the database, reopened it, got the message again, did a C&R, closed it and reopened it and I'm back to the "VBA project cannot be read" message.

Reverting to my backup copy, I can view all the VBA code but can't run any of it.

I understand it means that the file is corrupt, but
a) How can I get a working version again
and
b) What causes this to happen?
 
Perhaps something in the below can help...
http://www.granite.ab.ca/access/corruption/symptoms.htm
I would make a back-up, make another back-up and then first try importing everything into a new database. Also, read this article...
http://www.granite.ab.ca/access/corruption/retrievedata.htm
And after all of that I would finish off with this article…
http://allenbrowne.com/ser-25.html and see if any of those circumstances apply to you.
And when all else fails…
Data Recovery Services (I have never used them but I see them most mentioned when trying to recover data)…
http://www.pksolutions.com/t4.htm
and...
http://pauls-learningcurve.blogspot.co.uk/2012_07_01_archive.html
 
All VBA code is not lost. Create a blank database, then import all objects from your "corrupted" database. Be careful of the options, there's one which you have to import. Off the top of my head, I forget which but it's obvious.

Someone posted in this stri9ng that all code is lost. That's not the case at all.
 
All VBA code is not lost. Create a blank database, then import all objects from your "corrupted" database. Be careful of the options, there's one which you have to import. Off the top of my head, I forget which but it's obvious.

Someone posted in this stri9ng that all code is lost. That's not the case at all.

Thanks. That's essentially what I've done, albeit I copied and pasted the code rather than importing it. Same end result - I can use the database again. I was so reluctant to lose what I'd written I was at the "clutching at straws" stage and just tried anything in the hope it worked.

As soon as the pace slows down a bit here, I'm going to work through the links GinaWhipp posted.
 
Alc,

So at the end of the day the REAL lesson learned is... until you can figure out what is going on make back-ups, frequent ones! :D
 
Fortunately, I was. The first time it happened, it was the front end of a database. I had a copy on my local drive and it took all of five minutes to overwrite it. No data lost and nobody apart from me seemed bothered. Someone told me it's happened before here, so nobody cares, but as I've been brought in specifically to cover the Access databases, I'd rather it didn't happen again.
 
Its not of any help - but I have noticed an increase in the number of corrupt front ends since moving from Access 2003 > 2010.

We have made a windows launcher exe that includes a "Forced Update" option to copy over a new front end to users machines.
 
Hmm, I have only seen this happen if you don't update the code accordingly. Things that worked perfect in .MDB format didn't fare well when upgraded to the .ACCDB format. This would include some References, see...
http://www.access-diva.com/d5.html
 

Users who are viewing this thread

Back
Top Bottom