Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if Form is Open (Access VB)

Status
Not open for further replies.

spaceman99

Programmer
Jul 9, 2003
2
GB
Could someone please tell me how to check whether or not a form is open in Access 97 VB with an If statement please?

Form is called Sessions (Forms![Sessions])


Thank you.
 
Hi spaceman99,

It's much easier in A2K, but thisi s taken direct from Microsoft's Northwind Database:

Code:
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

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top