Form Loading

  • Thread starter Thread starter Alain
  • Start date Start date
A

Alain

Hello again,

I want to use the .IsLoaded on the form_load to see if a specific form is
already loaded, I am using the following code:
If Application.Forms("frm-Bud").Form.IsLoaded Then
and I am getting the following error:
Cannot find the form frm-Bud referred to in macro or VB code.
The form really exist so I would like to know if I'm using correctly the
..IsLoaded or not. The reason is I want to be able to open the form from 2
different forms, the original form from which I will normally open the
frm-Bud will be passing some value to the frm-Bud, and the second form is
from the Main Menu, which will not be passing any value.

Any suggestions will be greatly appreciated

Alain
 
IsLoaded is a routine that came within examples of Access, here it is:

Function IsLoaded(ByVal strFormName As String) As Boolean
' 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


Take care
Mauricio Silva
 
Back
Top