testing if a form is open access 2000

  • Thread starter Thread starter ron
  • Start date Start date
R

ron

Hi

How do i test to see if a form is open or not. I have
tried the if not isNull('form name') approach but it does
not seem to work. I have also tried 'isLoaded' with
similar poor results!

I am trying to determine if a form is open or not so that
I can update a combo box that is displayed upon it.

Many thanks

Ron
 
Hi Ron,

Try the following function:

if isloaded("form1") then
msgbox "Form1 is loaded"
endif

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

Or in Access 2000 and above you can test the AllForms collection of the
CurrentProject object.

if CurrentProject.allforms("form1").isloaded then
msgbox "Form1 is loaded"
endif
 
Back
Top