Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-02-2009, 02:31 AM   #1
davidjearly
Registered User
 
Join Date: Apr 2009
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
davidjearly is on a distinguished road
Major problems with VBA

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."

davidjearly is offline   Reply With Quote
Old 07-02-2009, 03:00 AM   #2
KenHigg
Registered User
 
Join Date: Jun 2004
Posts: 13,309
Thanks: 8
Thanked 155 Times in 129 Posts
KenHigg has a spectacular aura about KenHigg has a spectacular aura about
Re: Major problems with VBA

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...
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

ken

“You don’t learn to walk by following rules. You learn by doing, and by falling over.”
KenHigg is offline   Reply With Quote
Old 07-02-2009, 03:15 AM   #3
prlsol
Registered User
 
Join Date: Jul 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
prlsol is on a distinguished road
Re: Major problems with VBA

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.

prlsol is offline   Reply With Quote
Old 07-02-2009, 03:36 AM   #4
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,768
Thanks: 55
Thanked 1,022 Times in 988 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: Major problems with VBA

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
__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 07-02-2009, 04:25 AM   #5
KenHigg
Registered User
 
Join Date: Jun 2004
Posts: 13,309
Thanks: 8
Thanked 155 Times in 129 Posts
KenHigg has a spectacular aura about KenHigg has a spectacular aura about
Re: Major problems with VBA

Quote:
Originally Posted by gemma-the-husky View Post
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. ?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

ken

“You don’t learn to walk by following rules. You learn by doing, and by falling over.”
KenHigg is offline   Reply With Quote
Old 07-02-2009, 04:45 AM   #6
alktrigger
Aimless Extraordinaire
 
Join Date: Jun 2009
Location: Philadelphia, PA
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
alktrigger is on a distinguished road
Re: Major problems with VBA

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.
alktrigger is offline   Reply With Quote
Old 07-02-2009, 07:25 AM   #7
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,768
Thanks: 55
Thanked 1,022 Times in 988 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: Major problems with VBA

Quote:
Originally Posted by KenHigg View Post
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

__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 07-02-2009, 04:04 PM   #8
KathyL
Registered User
 
Join Date: Apr 2009
Location: Calif.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
KathyL is on a distinguished road
Re: Major problems with VBA

"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 by KathyL; 07-02-2009 at 04:14 PM.
KathyL is offline   Reply With Quote
Old 07-29-2010, 04:35 AM   #9
Sunnray
Registered User
 
Join Date: Jul 2010
Location: Canada
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Sunnray is on a distinguished road
Angry Re: Major problems with VBA

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.

Sunnray is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to recover corrupt VBA code kjcmas Modules & VBA 7 03-02-2011 11:32 AM
vba class mikevds Forms 5 02-25-2009 10:53 AM
Training in VBA taniadimitri Forms 1 07-04-2007 01:49 PM
Need VBA in a database - but cant think what for crazymarvin Modules & VBA 2 06-03-2007 08:06 AM
Stored Parameter Query vs. Built SQL Statement in VBA (FE/BE Environment) directormac Queries 3 01-06-2004 10:45 AM




All times are GMT -8. The time now is 01:01 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World