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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If form is open 1

Status
Not open for further replies.

foxhound44

Technical User
Dec 4, 2000
1
US
I have a form, frmMain. I have an if statement that I would like to use but I want to make sure that the form is open first, I also do not want to load that form on startup and make it invisible. So how in VB would I say:

If frmMain is Open Then
...

TIA!!!!!

 
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


PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top