Option Compare Database
Option Explicit
Function IsLoaded(ByVal strFormName As String) As Integer
' Returns True if the specified form is open
' in Form view or Datasheet view.
Const OBJ_STATE_CLOSED = 0
Const DESIGN_VIEW = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> OBJ_STATE_CLOSED Then
If Forms(strFormName).CurrentView <> DESIGN_VIEW Then
IsLoaded = True
End If
End If
End Function