
Opening form 2 from form 1 - what form/event to close form 1
I would put the close command in the form being opened if you are always
going to open that form from the first form. If not include a test to see
if form one is open and if yes then close form one.
See SysCmd acSysCmdGetObjectState in Help for more details
ObjectState = SysCmd(action[, objecttype][, objectname])
A better way to do this
If SysCmd(acSysCmdGetObjectState, acform, "Form1")>0 then DoCmd.Close
acForm,"Form1"
Alan
Quote:
> When you are opening one form from another form, and want to close the
> first form - where/when is the best time to close the first form?
> Should the close command code be on the first form, following or before
> the code opening the second form, or should it be on the open event of
> the second form? What if there is an error opening the second form or
> closing the first form?
> TIA -
> --
> Erin O'Leary
> Energy & Environmental Research Center
> Sent via Deja.com
> http://www.deja.com/