Check for Open Form

  • Thread starter Thread starter DavidW
  • Start date Start date
D

DavidW

I have got a possiblility of 3 forms opening 1 report. Is there a way
through code to check to see if a form is open or not. What I am doing Is
closing certain forms when a print preview is rendered. If I do a
DoCmd.close acform, ("myform"), acsaveyes
on a form that is not open I will get an error.
Is there a way to do this?
Thanks
David
 
Open Northwind and go to Modules. There is an IsLoaded function there that does
what you want. You can copy that function to a standard module in your database.
Use it like this:

If IsLoaded("MyForm") Then
<Do this if MyForm is open>
End If
 
Back
Top