How to tell if form is open

esurfer

Registered User.
Local time
Today, 16:53
Joined
Jan 29, 2002
Messages
12
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
 
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
 
Thank! Solved my problem

esurfer
 

Users who are viewing this thread

Back
Top Bottom