Is the form open?

Nirious

Registered User.
Local time
Today, 23:40
Joined
Jul 31, 2004
Messages
106
Hi,

Can anyone help me find out wether a form is open or not from vba-code.

I have some code in one form, that shouldn't be executed when another form is open. (Just one form, not all)
 
This example is in the 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
 
Bill [Gates] was kind enough to add the IsLoaded Property to Access 2003. Considering it has been a part of the Northwind db since Access 97.
 

Users who are viewing this thread

Back
Top Bottom