How can I get rid of a persistent VBA Form Object

2019-07-30 19:12发布

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.

6条回答
成全新的幸福
2楼-- · 2019-07-30 19:31

I had this problem. I renamed my default form from Form Login to frmLogin which suits my naming style, but the program was still looking for it on opening. I am using 2013 so I went to File » Options » CurrentDB and in the display dropdown select the new name. The old name remains in the list until you close and restart the application.

查看更多
Animai°情兽
3楼-- · 2019-07-30 19:33

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
查看更多
等我变得足够好
4楼-- · 2019-07-30 19:38

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

查看更多
爷、活的狠高调
5楼-- · 2019-07-30 19:39

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.

查看更多
孤傲高冷的网名
6楼-- · 2019-07-30 19:41

The problem I was having is that the form was named ~TMPCLP8151 and would not show up in Access no matter what I tried, but I could see it in VBA in the Project Explorer. Here's how I resolved the issue. I created a new form, and created an Event Procedure for Form_Open that contained this: DoCmd.DeleteObject acForm, "~TMPCLP8151"

Then I just opened the form, and sure enough, the VB code deleted the form that I could not delete myself.

查看更多
贪生不怕死
7楼-- · 2019-07-30 19:44

I had similar problem. I found I had named the missing form in the STARTUP menu as the default form to open when starting Access. I opened Tools>Startup and deleted the missing forms name from the "Display/Form/Page" field of the Startup. My problem solved.

查看更多
登录 后发表回答