This must be an easy question for you guys.
Thanks
Printable View
This must be an easy question for you guys.
Thanks
If you meen another instance of your app then:
[code]
If App.PrevInstance Then
MsgBox "Already Running"
End
End if
gwdash, thats for the program, I think that sandra means form
and I think that this is what you want:
Code:if form2.visible = true then
'form 2 is loaded
else
if form2.visivle = false then
'form 2 isn't loaded
end if
i know, i thought she might want program,
Sandra, once you've loaded a form, it's in the forms collection. so if you want to find out simply do something like this:
Code:Private Sub Command1_Click()
Dim frmLocal As Form
If Not FormLoaded("Form2") Then
Load Form2
MsgBox "Form Loaded"
Else
MsgBox "Form2 already loaded"
End If
End Sub
Public Function FormLoaded(strForm As String) As Boolean
Dim frmLocal As Form
FormLoaded = False
For Each frmLocal In Forms
If strForm = frmLocal.Name Then
FormLoaded = True
Exit For
End If
Next frmLocal
End Function
I would go with LAURENS suggestion because a form actually loads on first use. So if you check the Visible property the form will be loaded to check that property value.
Guys, you have been great! Yes, what Laurens said is exactly what I want, but I have learned something from other stuff posted here as an answer too.
Thanks!