On Close ()

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Function Name problem 5
Passing Variable value to a report 2
Passing variable value 3
Return without GoSub? 3
Access 97 Module Code 2
Module mystery 2
HELP 6
Compile Error: Variable Not Defined 2

Top