View Full Version : How to tell if form is open


esurfer
02-12-2002, 11:37 AM
This is probably very easy, but I have not been able to find an answer. I am using DLookup to pull info from a table based on the selection I have on one of two forms. If form A is open I want DLookup to use the selection from form A otherwise I want it to use the selection from form B.

What I need is a function to tell me whether Form A is open or closed.

Thanks,
JJ

Jack Cowley
02-12-2002, 11:47 AM
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

esurfer
02-12-2002, 11:52 AM
Thank! Solved my problem

esurfer