Using a form's name

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

Guest

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
 
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
 
Or, if you need to know if the form has been loaded:

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