Using a form's name

A

Akilah

I need an if statement to say

If Form_frm_Main.Visible = True Then something or
If current FormName = "frm_Main" then something.

How can I refer to a form name

Thanks
 
D

Douglas J. Steele

If Forms("frm_Main").Visible = True Then

(of course, the Forms collection only contains open forms, so you'll get an
error if frm_Main isn't open)

If Screen.ActiveForm.Name = "frm_Main" Then
 
K

Klatuu

Or, if you need to know if the form has been loaded:

If CurrentProject.Allforms("FormName").IsLoaded Then
MsgBox "Form Is Loaded"
End If
 
Top