Is form Loaded

G

Guest

Hello,

I have been using the following in my databases to determine if a form was
open or not

Function fIsLoaded(ByVal strFormName As String) As Integer
'Source: http://www.mvps.org/access/forms/frm0002.htm
'This Function Finds out if a form is open
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function

However, going through the help file with access 2003, I came across the
..IsLoaded property. Is one method better than the other for determining if a
form is open? Is the .IsLoaded property new to access 2003? Are there any
pros or cons to continuing to use the function?

Thank you for the clarifications,

Daniel
 
A

Allen Browne

The IsLoaded property of the form in the AllForms collection was new in
Access 2000. Feel free to use it in any recent version.

The code on the MVPs site is older code that is still useful if you need
compatibility with Access 97 or earlier.
 
D

Dirk Goldgar

Allen Browne said:
The IsLoaded property of the form in the AllForms collection was new
in Access 2000. Feel free to use it in any recent version.

The code on the MVPs site is older code that is still useful if you
need compatibility with Access 97 or earlier.

Interestingly, the older, SysCmd version function is actually faster,
not that it matters in any practical application. The nice, explicit
property exposed in the newer version is preferable for
self-documentation purposes. I tend to use the oder version, though,
for maximum compatibility in an application I'm developing for multiple
clients.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top