Check if a form is open

marrett

Registered User.
Local time
Today, 03:59
Joined
Sep 8, 2000
Messages
43
Hi,

I want to Check to see if a certain form is open. ex:

If("MyForm" is open) then

'Do what ever
end if

I would appreciate any help.

Thanks
 
Copy and paste the following function to a module and save:

Function FormIsLoaded(MyFormName As String) As Boolean
'
' Determines if a form is loaded.
'
Dim i As Integer
FormIsLoaded = False
For i = 0 To Forms.Count - 1
If Forms(i).FormName = MyFormName Then
FormIsLoaded = True
Exit Function ' Quit function once form has been found.
End If
Next i
End Function

Now to use this in your code:

If FormIsLoaded("TheFormNameHere") Then
' Do whatever if form loaded
Else
' Do whatever if form is not loaded
End If

HTH
RDH
 
Thanks!

Worked great!!
 

Users who are viewing this thread

Back
Top Bottom