Re: How to tell if a form is open?
- From: "Arno R" <arraNOcomSPAM@xxxxxxxxxx>
- Date: Mon, 22 Aug 2005 22:57:41 +0200
"deko" <deko@xxxxxxxxxx> schreef in bericht news:xpadnY5QCqMTq5feRVn-1g@xxxxxxxxxxxxxx
> In my adventures with VBA I've come across two different methods to
> determine if a form is open.
>
> I'm wondering if someone more experienced than I am can help me decide which
> one is better - does it matter? FrmIsOpen does not need to set any
> objects - is that enough to qualify as the better option?
>
> Public Function FrmIsOpen(frm As String) As Boolean
> If SysCmd(acSysCmdGetObjectState, acForm, frm) <> 0 Then FrmIsOpen =
> True
> End Function
>
> Public Function FrmIsLoaded(frm As String) As Boolean
> Dim prj As Object
> Set prj = Application.CurrentProject
> FrmIsLoaded = prj.AllForms(frm).IsLoaded
> Set prj = Nothing
> End Function
>
Hi Deko,
Here is another one to choose from ...
Public Function IsLoaded (frm as string) as Boolean
Dim i as integer
For i = 0 To Forms.Count - 1
If Forms(i).FormName = frm Then
IsLoaded = True
Exit Function
End If
Next
End Function
I would not bother too much about which one is better.
Maybe if you call the function 100+ times it matters???
Arno R
.
- References:
- How to tell if a form is open?
- From: deko
- How to tell if a form is open?
- Prev by Date: Re: IsNothing() IsEmpty() : Why i can not find it in Access 2003 Visual Basic For Application?
- Next by Date: .mde on different Office versions
- Previous by thread: Re: How to tell if a form is open?
- Next by thread: Re: How to tell if a form is open?
- Index(es):
Relevant Pages
|
Loading