Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot delete Form module that Access says doesn't exist.

Status
Not open for further replies.

fperri

Programmer
Apr 25, 2007
8
US
I created a form and had started the code for it - when I went to save I originally saved it as the default "Form1" Then after I finished the code and wanted to add it to my menu I renamed it to what I wanted it in the forms window. For some reason unkown to me, it renamed it, but then left the code module for the form still named "Form1" now I cannot edit any of the code for the form, and every time that I open up the VB editor I get constant message boxes saying that "Form1" does not exist, that it has been deleted or moved. I can see in the VB editor the code module for the "Form1" and the new name that I named it. I tried to delete the "Form1" module but it won't let me because it says it doesn't exist. I tried to rename the form back to "Form1" but it won't let me name it the name of an object that already exists. I tried compacting and reparing the database but the message pops up while its trying to repair it and then it can't complete the process.

Is there anyway that I can get around Access and manually delete this code module? I don't want to delete the database and start over because I have other forms and custom menus that I don't want to spend the time creating again. I created a shell database and tried to copy all my forms over and it was telling me the database had been locked (by me) and could not be opened for editing.....but I already had it open.

Please tell me someone has a simple solution. Thank you!

~ Franccesca
 
Hi,

Be careful with this importing everything into a new database (unless MS has finally pulled it's thumb out of its @#*& and fixed the 'Network' error where forms containing VBA are imported into other Access databases corrupting the whole database).

Whenever I import forms, I always strip the modules out of every form (first copying them to Notepad, import the 'empty' form, then paste the VBA back into each form individually.

This has corrupted too many of my applications for me to make the same mistake again.

If anyone can confirm that this massive problem has been fixed in later versions of MS Access - please do so here. PLEASE!!!!!!!!!!!!!!!!!

;-)

Regards,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Thanks guys, that's pretty much what I ended up doing. Just created a new database and copied the forms in and then I had to rewrite the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top