[AccessD] IsLoaded function

Bob Gajewski rbgajewski at roadrunner.com
Tue Mar 23 21:06:19 CDT 2010


If you just want to check to see if a form is loaded/open, you can use this
function too:

Function IsLoaded(ByVal strFormName As String) As Boolean

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
        If Forms(strFormName).CurrentView <> conDesignView Then
            IsLoaded = True
        End If
    End If
    
End Function

Regards,
Bob Gajewski
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Tuesday, March 23, 2010 10:24 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] IsLoaded function

 
Actually it was introduced with Access 2002 IIRC.

Because it is a property of an Access object, as you point out, it is always
called with a dot in front as in...

SomeObject.IsLoaded() 

Or

With SomeObject
	if .IsLoaded() Then
	...
	End If
End With

So therefore its name does not clash with a function named "IsLoaded()". I
can confirm that if you have the IsLoaded() function as part of an Access
2002 app you can call it happily instead of the form object's IsLoaded
property: i.e. legacy code still runs.

Lambert


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Tuesday, March 23, 2010 9:56 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] IsLoaded function

The .IsLoaded property of an access object is in Access 2003.  

I could see where an IsLoaded function may have difficulty if a version of
Access uses IsLoaded as the name of a property.

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Tuesday, March 23, 2010 8:45 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] IsLoaded function

Unless you are working with Access 97 or earlier. In which case IsLoaded()
is not built in. In which case the code looks like this...

Function IsLoaded(FrmName As String) As Boolean Dim i As Integer

IsLoaded = False
For i = 0 To Forms.Count - 1
    If Forms(i).Name = FrmName Then
        IsLoaded = True
        Exit Function
    End If
Next i

End Function

Lambert 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Tuesday, March 23, 2010 9:35 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] IsLoaded function

It looks like .IsLoaded is a property of an access object, rather than a
function.

Like this:

    If CurrentProject.AllForms(stgFormName).IsLoaded = False Then
        ... Do Something
    End If

HTH,
Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Tuesday, March 23, 2010 8:26 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] IsLoaded function

For some reason I'm a "procedure not found" error on a call to the function
IsLoaded(). Does anyone have a copy of it handy? I thought it was built-in
but maybe I got it from ADH or somewhere.

TIA,
Arthur
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list