Checking for open forms in access 97

  • Thread starter Thread starter John
  • Start date Start date
John said:
Hi

How can I check if a particular form is already open in access 97?

Thanks

Regards

Copy this into a standard module and then use it to test for open forms...

Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
On Error GoTo ErrHandler

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

Exit Function

ErrHandler:
MsgBox Err.Description
End Function
 

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

Back
Top