views:

516

answers:

5

I have an MS Access 2003 database that I'm using to develop a basic little inventory app. I have added some extraneous forms along the way and I wanted to get them out of the DB. I deleted most of them just fine but one of them appears to have left behind its VBA Object. All that's in the object is Option Compare Database. Now whenever I try to work with the database, I get the following error:

The form name 'Transaction1' is misspelled or refers to a form that doesn't exist.

If the invalid form name is a macro, ...

Truncated for typings sake.

Yes, I agree, the form doesn't exist. What confuses me so much is that all of the other forms, when I deleted them, also destroyed their VBA object as well. This one, no matter what, seems to like to stick around and I have no idea how to get rid of it.

How do I get rid of it?

Things I've tried:

  • Compact and Repair and the DB
  • Create a new form named what it's expecting, verify that it gets rid of the problem, and then delete that form.
A: 

I had a same problem. I created a form with same name and deleted the form again. That fixed the peoblem. Try. BTW try to open the new form in design mode to make sure if the VBA module is assosiated with the new form.

THEn
+1  A: 

You can try the /decompile switch

  • Make a backup of your mdb
  • Open your mdb (hold the SHIFT key down to stop any code from running) via a short cut: msaccess.exe database.mdb /decompile
  • Open a module and compile your app
  • Save and close Access
  • Open again (SHIFT again) without decompile
  • Compact and repair database
  • close Access
DJ
Decompile is the best suggestion, +1, but the best order is to close the instance of Access opened with the /decompile switch after the MDB is opened, then open it in a new instance (with SHIFT key), compact, *then* compile, and then compact again (each time with SHIFT key).
David-W-Fenton
I always compile, close, then reopen and compact. I always hate to close access in a uncompiled state.
DJ
A: 

I had to combine both solutions to achieve the goal. First de- and recompile next compact and repair then create new form with the same name and delete it Pay attention that the form has the status Hasmodule set to Yes

This should be moved to a comment on DJ's answer.
Tim Visher
A: 

Many thanks. The answers provided me with a path to resolving a nasty situation.

This should be moved to a comment on DJ's answer.
Tim Visher
A: 

Great solution. My db crashed every time I tried to start the VB editor. the /decompile fixed it.

Thanks,

wimZ
This should be moved to a comment on DJ's answer.
Tim Visher