Detect if a form is open or not

P

Pietro

Hi,
Is there a code that detects if a form is open or not?

I've a button on a form,i need to know,on click event of this button if the
form SW is open or not to build other codes...
how can i do this ?
 
P

Pietro

Thank you BruceM very much...
You helped me solve a very big issue in my database...
Can you tell me how i can build event if the form is not loaded (is not open)?
 
B

BruceM

You could set up an Else condition:

If CurrentProject.AllForms("FormName").IsLoaded Then
{Do something}
Else
{Do something else}
End If

or test directly whether the form is loaded:

If Not CurrentProject.AllForms("FormName").IsLoaded Then
{Do something}
Else
{Do something else}
End If

In either case you could leave out the Else part. If the form is loaded, do
something; if it isn't, do nothing. You could also leave out the Then
condition, I think:

If CurrentProject.AllForms("FormName").IsLoaded Then
Else
{Do something}
End If

but if you are going to do that you may as well use Not.

"Not" can be used in other situations such as Not IsNull, or to set one
Yes/No field or check box control to the opposite of another:
Me.Check1 = Not.Me.Check2
or set a property to the absence of another property:
Me.Text1.Visible = Not Me.Text2.Enabled

I expect you get the idea that in general it can be used to test for the
opposite of a condition.
 
Top