John said:
Hi
How can I check if a particular form is already open in access 97?
Thanks
Regards
Copy this into a standard module and then use it to test for open forms...
Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
On Error GoTo ErrHandler
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
Exit Function
ErrHandler:
MsgBox Err.Description
End Function