A: 

Try to decompile and recompile the database.

If that does not work, I usually create a new database and import everything from this one to the new one. If something is corrupted, I will encounter issues at that time and be able to fix it.

Raj More
How do I decompile and recompile the database? I can't see an option for it in the menus.
a_m0d
Importing everything into a new database seemed to import all the errors as well...
a_m0d
Alt+F11 will pull up the VBA Designer. Choose Debug | Compile.
Jeff O
Debug->Compile is grayed out - can't choose that.
a_m0d
Decompile is a command line option
Raj More
A: 

Can you see the code in your code modules? If so, cut and paste it somewhere safe. Then flip the HasModule setting for each form to false, repair the database, and restore the code to newly created code modules.

Larry Lustig
Tried this, but it didn't work.
a_m0d
+3  A: 

Compact and repair generally won't solve problems that happens in objects other than tables and indexes. Importing usually fixes those but maybe try a decompile and then an import. Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up times

I encountered the same problem once and documented my trouble shooting steps here. The expression On Click you entered ...

Also see Corrupt Objects within a Corrupt Microsoft Access MDB

Long discussion summarized.

One page that might have a solution that might help is Errors using multiple versions of Access under Vista/Windows 7 This is basically a permissions problem into the registry.

Another suggestion is to to repair the Office 2003 installation in control panel. A2003 then reverts to using Version 11 of the library, but only until A2007 is used again, then the problem reappears.

The original poster stated "Okay, after a few restarts, it seems that removing the 2007 runtime did fix the problem for me. "

Tony Toews
I followed the steps you outlined, but they didn't help me at all. However, I saw a post on the hyphen site which mentions that Office 2007 causes problems - sure enough, I have the Access 2007 runtime on my machine, and this project (for some reason) references the Access 12 Object library. The other post says to change the priority of the reference, but I can't do this because the reference is (apparently) in use, even though I am not running anything.
a_m0d
Oh, the A2002 project references the Access 12 Object library? I've seen that problem. I thought it was mentioned at http://allenbrowne.com but I can't see it there right now. It's some kind of permissions problem. What happens when you create a new MDB? Do you still see the Access 12 Object library?
Tony Toews
I don't know what you mean by the hyphen site.
Tony Toews
Errors using multiple versions of Access under Vista/Windows 7 http://allenbrowne.com/bug-17.html
Tony Toews
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23232751.html is the post I was trying to follow. I tried creating a new MDB and importing the forms, etc. but that reference also comes with it
a_m0d
Oh, that site. Sorry but I don't like sites that require you to register and pay $$$$ I'd tell you exactly what I thought of them but I'd be banned from this site for profanity. <msile>
Tony Toews
yeah, same, but I didn't pay - just scroll all the way to the bottom and you can see the answers (a trick I learnt from Joel and Jeff)
a_m0d
Sorry, I don't see what happens if you scroll to the bottom. And I don't really care. Last time the Google inquiry was working properly I had over 37,000 postings in the newsgroups. Experts Exchange should be greatful if I decide to hang out there and give me all the free access I want. <chuckle>
Tony Toews
a_m0d
Ok, that did work. Interesting. But there doesn't look like much useful than what is already in my postings here other that Allen Browne's page talking about permissions and Windows Vista/7. allenbrowne.com/bug-17.html In my opinion my page on decompile is better than FMSs. Although not as pretty looking of course. And my page has been around a lot longer.
Tony Toews
Had a look at the page from Allen Browne, but his stuff only seems to apply to Vista - my machine is running XP, so most of it doesn't work anyway.
a_m0d
Darn. Hmmm, are you an administrator on your machine? Also you didn't asnwer what happens to your references if you create a new MDB.
Tony Toews
My references are imported when I import the forms. Just logged in as Admin and doesn't seem to have made any difference.
a_m0d
I'm confused then. When you create a new MDB in A2002 aka XP you should have Access 10.0 Object Library in your references. So when you do an import it also imports the A12.0 Ojbect Library?
Tony Toews
That's the problem - it was importing the Access 12.0 library, and I couldn't find the Office 10.0 library anywhere. I just uninstalled the Access 2007 runtime, but now, even though the 10.0 library is referenced, it still has the same error.
a_m0d
Okay, after a few restarts, it seems that removing the 2007 runtime did fix the problem for me. If you put some good information in your answer about the conflict, and edit that link from Allen Browne in, I will accept your answer as thanks!
a_m0d
One suggestion is to to repair the Office 2003 installation in control panel. A2003 then reverts to using Version 11 of the library, but only until A2007 is used again, then the problem reappears. At http://groups.google.com/group/comp.databases.ms-access/browse_thread/thread/dc879f8cf3a2c8ab/65e820e5f667d9dd
Tony Toews
A: 

You decompile the database by adding the flag /decompile to the start-up options i.e.

msaccess.exe “C:\my_folder\mydb.mdb” /decompile

I find that solves most of my problems. If not then another one is to re-secure the database by running the security wizard. This basically makes a new db and imports all the objects for you

Kevin Ross
Note that if you have multiple versions of Access I'm not sure which version of Access might be used to do the decompile. Results might not be pretty. <smile>
Tony Toews
Fair point, in that case add the exact path to the version of access you want to do the decompile with
Kevin Ross
+3  A: 

Tony alluded to this in his long string of comments, but this sounds exactly like the dueling Access registration problem. I hadn't used A2007 until recently (I had the runtime installed to test if a database developed in A2003 could be deployed under it -- it could -- but hadn't used it since that testing was completely), and when I run A2007 after I've been using A2003, it has to reconfigure itself. The other day, something went wrong during the A2003 reconfiguration (after having last run A2007) and I got errors similar to yours. Running A2007 (to re-register everything as A2007) and then running A2003 (to re-register everything as A2003) fixed the problem.

The key is that when the re-registration fails, Access doesn't necessarily know it the next time it runs, so you end up running in an environment that is partly registered for A2003 and partly for A2007. The way to restore it is to run the other version of Access. That is, if A2003 is launching without the reconfiguration notice, then close it down and run A2007 so it reconfigures itself and re-registers itself as the real Access. Then when you run A2003 next, it will re-register itself as the authoritative version of Access and your A2003 app should have all of its references in proper shape.

Yes, this is very annoying.

And time-consuming.

I don't know why MS seems to think this is something that doesn't need to be fixed. While I know they don't give a rat's ass about developers who need to run A2003 and A2007 side by side, there are plenty of end users who might have an A2007 runtime app installed but also have A2003 installed as part of their base Office installation.

This has been going on forever, so I doubt it will ever be fixed.

David-W-Fenton
About the only solution here would be to use the Sagekey runtime.
Tony Toews
That would work if you've got a 2007 runtime duelling with full A2003, but how would you use SageKey scripts to cure the problem for full installations of the two apps?
David-W-Fenton