Closing form

message from John on 23 May 2004
Hi

Is it possible to close a form through code from within itself without using
the form name? I just worry that form name can change and the code will stop
working.

Thanks

Regards
 
Douglas J. Steele replied to John on 23 May 2004
Well, the name of the current form is always going to be Me.Name, but you
don't actually need the name of the form to close it. DoCmd.Close is all you
need.
 
John Spencer (MVP) replied to Douglas J. Steele on 23 May 2004
It is safest to use Me.Name construct.

If you open a second form or a report or otherwise change the focus from the
original form's code module, the focus may be other than where you expect it to
be. Using

DoCmd.Close acForm, me.Name

is much safer.

"Douglas J. Steele" wrote:
 

Archived message: Closing form (MS Access Database)