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

Check to see if a form is open 1

Status
Not open for further replies.

lastout

Programmer
Apr 12, 2002
84
US
Hello,

I would like to be able to check to see if a certain form (frmEntity) is open when another form (frmProject) is loaded. If frmProject is loaded without frmEntity being open, then I have certain code that runs. But, if frmEntity is open when frmProject is loaded, I want different code to run. I am going to use and If Then statement but how do I check to see if frmEntity is open? I've seen the code for this before but don't remember what it is exactly or where I saw it.

Thanks!
 
Copy the following function into a module and save it as whatever you want. To use it in your code, you simply put this:

If IsLoaded("FormNameHere") Then ...

==================================
Public Function IsLoaded(ByVal strFormName As String) As Boolean
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
================================== Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top