Major problems with VBA (1 Viewer)

davidjearly

Registered User.
Local time
Today, 15:33
Joined
Apr 30, 2009
Messages
40
When I try to create a command button in any Access database, including new blank ones, I get the following messages.

I have reinstalled Access over and over. I don't know what registry keys to delete and the problem still remains.

Any ides would be helpful!

"The database cannot be opened 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 deleted the VBA project without creating a backup copy, click OK."

"The code contains a syntax error, or a Microsoft Office Access function you need is not available.

If the syntax is correct, check the Control Wizards subkey or the Libraries key in the Microsoft Office Access section of the Windows Registry to verify that the entries you nee are listed and available.

If the entries are correct, either you must correct the Microsoft Office Access Utility Add-in, or the file acWzlib or this wizard has been disabled. To reenable this wizard, run Microsoft Office Access or Microsoft Office Setup again to reinstall Microsoft Office Access. Before you reinstall Microsoft Office Access, delete the Windows registry keys for the Microsoft Office Access Utility Add-in and acWzlib."
 

KenHigg

Registered User
Local time
Today, 10:33
Joined
Jun 9, 2004
Messages
13,327
Here's a stab in the dark: Sounds like a windows dll has corrupted. I would run some hard disk utility to find and fix bad sectors, etc. Or either re-install the OS...
 

prlsol

New member
Local time
Today, 10:33
Joined
Jul 2, 2009
Messages
5
I have had forms with the VBA module corrupted before but I could create a new db and import all the objects into it and be good to go. It sounds like you have entered another level of hell. I can give you a few suggestions you may or may not have already tried. First, I would uninstall Access (Office if you have the whole suite installed) and run one of the various Registry Cleaners. I don't have a particular recommendation on which one, I believe they are all pretty similar. After running the cleaner I would open the Registry Editor and search for 'Access' and delete any key/value that seems to be related. Of course, you should backup the registry before you begin this process, and beware that you could actually make your machine unbootable if you do something wrong in the registry. If you use Access for work then it sounds like rebuilding the machine from scratch would be your next step anyway.
Good luck.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:33
Joined
Sep 12, 2006
Messages
15,640
rather than do this ...

can you open/create a new database nomally?

if so, its more likely a corruption in your database - in which case

1. make a windows copy of the dbs first? (and do this anyway)
2. can you import anything from the original dbs into a new blank database?

its a bit late now, but in general
3. back up, back up, backup - have a non-used copy of any working dbs
4. save old versions of your programme
5. split your database
6. backup your backend
7. do not have multiple users accessing a single network database front end
 

KenHigg

Registered User
Local time
Today, 10:33
Joined
Jun 9, 2004
Messages
13,327
rather than do this ...

can you open/create a new database nomally?

if so, its more likely a corruption in your database - in which case

1. make a windows copy of the dbs first? (and do this anyway)
2. can you import anything from the original dbs into a new blank database?

its a bit late now, but in general
3. back up, back up, backup - have a non-used copy of any working dbs
4. save old versions of your programme
5. split your database
6. backup your backend
7. do not have multiple users accessing a single network database front end

I think he said it does it with any new databases he creates as well. ?
 

alktrigger

Aimless Extraordinaire
Local time
Today, 10:33
Joined
Jun 9, 2009
Messages
124
Another thing to check is if you can open your database on another system. This may specify if it is an access problem or a system issue. You may also try to open VB itself or with another office application and see if that is a source of the issue.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:33
Joined
Sep 12, 2006
Messages
15,640
I think he said it does it with any new databases he creates as well. ?

I realised that afterwards, but i had problems with the froum and couldnt get back in

One thing that occurs to me is that reinstallling Access often won't work. Access thinks it is properly installed, and doesnt do a full reinstall. EVEN deleting Access and reinstalling ownt help

You need to look at MS Knowledge base, and look at installing from command line

There are some command line options that FORCE a TRUE full re-install, but I am not sure what they are offhand
 

KathyL

Registered User.
Local time
Today, 07:33
Joined
Apr 17, 2009
Messages
48
"The database cannot be opened 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."

Access 2007 does not like orphan VB code in your forms or projects. Access 2003 ignored orphan code. (It is not 'corrupted', it's just that Access 2007 makes you clean up your code.)

Backup your DB before you start.
You will have to allow Access 2007 to delete all the VBA code. I had to export ALL active/valid tables from the corrupted DB over to a copy of an uncorrupted DB. Then I compiled (Debug, Run) the DB to allow Access 2007 to identify all (unused subroutines, variables not defined, etc.) orphan code, and corrected or removed all orphan VB code. Yes, it was a pain, but it has to be done.

Access 2007 has tighter controls on making sure you do things correctly.
 
Last edited:

Sunnray

Registered User.
Local time
Today, 11:33
Joined
Jul 7, 2010
Messages
27
I just got this error. Gotta say I'm not a fan of this. There's gotta be a better way to handle orphan code.

I deleted an old splashscreen that had 2 lines of code in it. Now I've lost a days work. This is not right. :mad:
 

Users who are viewing this thread

Top Bottom