Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking whether a form, referenced in a form variable, is loaded

Status
Not open for further replies.

astraltango

Programmer
Joined
Nov 19, 2003
Messages
18
Location
AU
How can I check that a form is open using the variable:
public formVariable as Form

After formVariable is assigned, I realise I could use:
isLoaded(formVariable.Name)

but this would only check if an instance of the form is loaded, ie it may be a different instance of the form referenced in formVariable
 
It depends on the technique you are using to open multiple instances? So how are you doing that?
 
astraltango,

you could loop thru, ALL the loaded forms, & check & see how many instances of the form are open...

Sub OpenForms()
'outputs all loaded forms

Dim frm As Form, x As Integer

For Each frm In Forms

If frm.Name = formVariable.Name Then x = x + 1

Next frm

Debug.print x

End Sub



I'm not sure, how to diffrentiate between the different instances, but, hope this offers some help.

either way, Good Luck!
 
Thanks for your suggestions but I ended up simply using the following function:

Function formIsOpen(formVar As Form) As Boolean
On Error GoTo Exit_formIsOpen

Dim tempStr As String

formIsOpen = False
tempStr = formVar.Name
formIsOpen = True

Exit_formIsOpen:
Exit Function
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top