testing if a form is open access 2000

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
 
S

Sandra Daigle

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
 

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