-
Testing For an Open Form
How do I test if a Form is open?
Many thanks
-
Find out if Form or Report is open.
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
---------------------------------------------------------------------------------------------
Function IsLoadReport(ByVal strReportName 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, acReport, strReportName) <> conObjStateClosed Then
If Reports(strReportName).HasData <> conDesignView Then
Reports(strReportName).AutoCenter = True
While SysCmd(acSysCmdGetObjectState, acReport, strReportName) = acObjStateOpen
DoEvents
Wend
IsLoadReport = True
End If
End If
End Function
I never had problem using them, so far.
doug
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|