M
martin
Use this function: Its from the code librarian in access
2000.
Function IsLoaded(ByVal strFormName As String) As Integer
' 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
then it is
if not isloaded("form2) then form1!
[field1].setfocus 'assuming form is open
2000.
Function IsLoaded(ByVal strFormName As String) As Integer
' 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
then it is
if not isloaded("form2) then form1!
[field1].setfocus 'assuming form is open