Here is the function I use.
Function MTSBuildSmart_IsLoaded(ByVal strFormName As String) As Boolean
On Error GoTo errHandler
'Returns True if the specified form is open in either Form or Datasheet view.
Const conObjStateClosed As Integer = 0
Const conDesignView As Integer = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
MTSBuildSmart_IsLoaded = True
End If
End If
exitProc:
Exit Function
errHandler:
MsgBox (Err.Number & ", " & Err.Description)
Resume exitProc
End Function
Regards,
Mike
|