Unanswered: The mysterious and crippling "Form1 misspelled or does not exist" message
I just had another find that I wanted to post. Hopefully it will help some people.
I recently googled (and found only 1 result) of having a phantom Form1 entry that was crippling my attempt at VBScript coding. The situation is that I didn't have a Form1 listed in the forms! But all my code in a completely seperate form was affected, and I kept getting messages stating something to this effect:
Form1 is either misspelled or does not exist...
The only hepful bit of advice was to create a Form1. That actually worked. But then something worse happened. I was continuing to develop my database with my nice new function called CurrentWindowsUser() (that pulls the Windows Logon name), and everything was working perfect. Then all the sudden, every function and query using CurrentWindowsUser() would cause Access 2003 to crash!
I tried for over 45 minutes, trying to narrow down why my function was making Access crash. Finally, after 45 minutes of cursing, I had a few ideas:
1. Restart the database ... didn't work
2. Compress the databse (it blew up to over 14MB, and usually was 2.5MB) ... didn't work
3. Restart the computer ... didn't work ... BUT
I got that darn message again about the mysterious Form1, but this time it already existed!!! After another 5 minutes of cursing, I had the idea to just delete Form1 and re-create it. That worked, and my function was working fine.
Now that I had gone this far I had to figure out how to get rid of Form1 once and for all! So I went into the VB Code Editor, and tried to see if there were some left-over code. I wasn't really sure what I was doing exactly, and the code seemed to dissappear after I deleted it, but then I'd close the editor, go back and it was still there! So, after poking around and looking at the code for the mysterious Form1, I noticed an entry for OnLoad, and an entry for OnClick, and some others.
So... I opened up From1, and looked at all the parts, the form itself, the Detail area, the headers (page and form headers). I actually found [Event Procedure] in a few different places!! And I know I didn't put it there recently.
It seems that if you make a form, even just to mess with a small test of something, if you do something to put an [Event Procedure] in place, you have to manually delete those instances of [Event Procedure] BEFORE you delete the form! Otherwise the code will remain and give you what seems like random errors, AND in the VBScript Editor you will see the left-over form name even though that form does not exist in the list of forms you created!
If someone knows anything about what I just found and can confirm or deny this I'd appreciate it... and so would any other use having this problem I'd imagine...
EDIT: I just tried to re-create that error message and I got it to happen once out of 3 attempts. That's it so far. Can't find a pattern yet.
I thought about doing that too. I've managed to actually get Form1 to be removed so I'm feeling confident at the moment. I'm hoping my luck will hold out. This is not the only database file that I've worked with where I've seen this, so I'm feeling compelled to "tough it out" and see if I can find a solution without recreating everything. ... I got a crap-load of macros, and copying all them would be a pain.