The database cannot be opened because the VBA proj

2019-05-10 01:47发布

This morning, I got this error

Error accessing file. Network connection may be lost

no matter what I was doing on any form. So I opened a blank database and imported everything. Some error occurred but it said that the import was successful. I was able to open my form again. Then I went back the old copy and then I got this error when I try to open the database

The database cannot be opened because the VBA project contained in it cannot be read

Even the backup I did before the first error is saying that now.

and I tried to import again and I got the error while it was importing.

I'm getting abit nervous now, plz tell me there's a way to fix this

thank you

2条回答
Rolldiameter
2楼-- · 2019-05-10 02:09

You can try decompile when Access complains it can't read the VBA project code. See the two answers to this SO question for detailed instructions: HOW TO decompile and recompile.

If decompile is unable to restore your application to good working order, the quickest solution is probably to revert to your last good backup copy.

If you're willing to put in extra effort to recover module changes since the last backup, check whether you can still access the module source code. If the source code is readable, you can use the undocumented SaveAsText method to dump the code to a text file:

Application.SaveAsText acModule, "Module1", "C:\SomeFolder\Module1.txt"

Then later load it into a new db file with the LoadFromText method.

Application.LoadFromText acModule, "Module1", "C:\SomeFolder\Module1.txt"
查看更多
贪生不怕死
3楼-- · 2019-05-10 02:27

For those still having this issue, here's an update. This issue occurs when the .accde is compiled on a version of Access that is newer than that of the affected computer. It turns out that some machines were being updated with windows update and some weren't. After getting all installations of Office to the same version number by installing SP2 and then a February, 2016 update, the executable now runs on all my machines.

Here's the Link to SP2 (make sure you download the correct file.) https://www.microsoft.com/en-us/download/details.aspx?id=39667

Here the February, 2016 update: https://support.microsoft.com/en-us/kb/3114750

HTH, Patrick

查看更多
登录 后发表回答