Check to see if form is open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is sort of linked to another query I had but that has been answered and
I forgot to add this bit...

In a current form, I wish to check to see if another form is open and if it
is, close it when the current form is closed. Thanks to the solution I've
already received, I can close the form when required, but if the form is not
open, I get an error. I could just trap the error but would like to do the
task properly!
 
In Access 2000 and later:
If CurrentProject.AllForms("Form1").IsLoaded Then
DoCmd.Close acForm "Form1"
End If

In any version:
If SysCmd(acSysCmdGetObjectState, acForm, "Form1") <> 0 Then
 
Back
Top