Hi,
How can I check if a Form is already loaded?
Thanks
Michel Jr.
Printable View
Hi,
How can I check if a Form is already loaded?
Thanks
Michel Jr.
Hope this helps :)
Code:Public Function FormIsOpen(strForm As String) As Boolean
'***************************************************************************
'Purpose: Check if a given form is open or not.
'Parameters: strForm - Name of the form to check for.
'Returns: True/False - Form open?.
'***************************************************************************
Dim frm As Form
FormIsOpen = False
For Each frm In Forms
If frm.Name = strForm Then FormIsOpen = True
Next frm
End Function
That's some neat code Stevie, but can't you just check the visible property of the form???
if form1.visible = true then
' the form is already loaded
end if
Or would the form have to have focus for this to work?
Just an idea.....
Big_Berdie,
If the form you were testing the visible propert of was not loaded, it will be now.
As soon as you refrecnce a property of the form, the form is loaded into memory. So Stevie's way is the way to do it.
Plus a form can be loaded, but not visible. If you use the "Load Form" then form_load routine is run, but the form is not visible until the form.visble = true is run.