IsLoaded function??

F

Francisco F.

I have the following code line " If IsLoaded("FORM DB IQP por Ref") = False
Then CAncel = True" but the function IsLoaded is not recognized. To which
reference/library does this function belong, where can I get it?

Thanks.
 
F

fredg

I have the following code line " If IsLoaded("FORM DB IQP por Ref") = False
Then CAncel = True" but the function IsLoaded is not recognized. To which
reference/library does this function belong, where can I get it?

Thanks.
You may not need to use the IsLoaded function as written above (which
you could have copied from the Northwind sample database that comes
with Access ... see below..) if you are using a newer version of
Access.

What version of Access?
Access 2002:
If Not CurrentProject.AllForms("FORM DB IQP por Ref").IsLoaded Then
Do something here
Else
Do something else
End If

In Access 97, copy this function (from the Northwind.mdb sample
database).

Function IsLoaded(ByVal strFormName As String) As Integer
' Returns True if the specified form is open in Form view or
Datasheet
view.

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

Then code:
If Not IsLoaded("FORM DB IQP por Ref") Then
Do this
Else
Do that
End if
 
T

Tim Ferguson

I have the following code line " If IsLoaded("FORM DB IQP por Ref") =
False Then CAncel = True" but the function IsLoaded is not recognized.
To which reference/library does this function belong, where can I get
it?

I don't think this has ever been built-in. There are at least three
methods of writing the function. This one is mine:

public function IsLoaded(FormName as String) As Boolean
dim strFName as String ' convert to lcase
dim frm as Form ' iterate forms collection

' ignore case
strFName = LCase$(FormName)

' assume it's not there
IsLoaded = False

' look through open forms
For Each frm in Forms
' could use StrComp if you prefer
If LCase$(frm.Name) = strTemp
' found it
IsLoaded = True
' don't bother going round any more
Exit For

End If
Next frm
End Function


but I like really explicit code! The other popular way is to use one of
the SysInfo functions -- check help. You can also look in the Documents
collection, I think.

Hope it helps


Tim F
 
D

DebbieG

This is what I have in a module:

Public Function IsLoaded(strName As String, _
Optional lngtype As AcObjectType = acForm) As Boolean
IsLoaded = (SysCmd(acSysCmdGetObjectState, acForm, strName) <> 0)
End Function

Then in a form:

If IsLoaded("frmMain") Then
...
End If

HTH,
Debbie


|I have the following code line " If IsLoaded("FORM DB IQP por Ref") = False
| Then CAncel = True" but the function IsLoaded is not recognized. To which
| reference/library does this function belong, where can I get it?
|
| Thanks.
 
N

Naresh Nichani MVP

Hi:

Hi -

Try it like this

Currentproject.AllForms("FORM DB IQP por Ref"").isLoaded


Naresh Nichani
Microsoft Access MVP
 

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

Top