
check if a form is open or loaded
Steve:
If IsLoaded("MyFormName") Then
' "MyFormName" is open
Else
' "MyFormName" is not open
End If
The function "IsLoaded()" is below. Copy it and paste it into a standard
(global) module (NOT the module behind a form or report).
'**********************FUNCTION START
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 END
:-)
--
Bruce M. Thompson, Microsoft Access MVP
Quote:
>>No Email, Please. Keep all communications
within the newsgroups so that all might benefit.<<
Quote:
> Can anyone tell me if there is anyway to check if a certain form is open /
> minimized using VBA?
> What I am trying to do is when say, when form 2 is opened check to see if
> Form 1 is open (or minimized) if so then "txtbox_Onform2 = txtbox_OnForm1"
> or if form 3 is open (or minimized) then "txtbox_Onform2 = txtbox_OnForm3".
> Thanks
> Steve