Question

How do you PROPERLY close a HIDDEN form / window in Access 2003 WITHOUT going to the top menu and choosing unhide and closing it manually?

There is only one method that I'm aware of (because I don't know VBA... yet) and that is to make a macro that closes the window/form by name using the Close action. But, when I do this, it gives me an error and says it can't find the named object. (Yet, if I check the unhide window list, said window has indeed been closed.)

This is really irritating because apparently it's closing the hidden window, then throwing an error saying that it can't find the object (which of course, messes up the macro sequence).

Is there a more "correct" way to close a hidden window?

So, the answer is...... I was encountering an ID-10-T error. I was referencing the hidden form AGAIN after it was closed, which, because of the instantaneous nature of the code execution in general, I missed that fact...

...problem solved. PEBKAC.

Was it helpful?

Solution

I just tested these in Access 2010 and they both seem to work fine on a hidden form:

From a Macro...

Action: CloseWindow
Object Type: Form
ObjectName: AgentsForm
Save: No

From VBA code...

DoCmd.Close acForm, "AgentsForm", acSaveNo
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top