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

Check if a form is exist

Status
Not open for further replies.

sisan

Programmer
Jan 9, 2002
39
ID
Hi, All !

How to check if a form is exist (shown) ?
Thank's
 
I mean an child form of an MDIform
 
Have a look at this code...I use this to destroy forms etc..
Public Sub shutdown()
' Comments :
' Parameters: -
' Modified :
'
' --------------------------------------------------

On Error GoTo err_close
Dim frmForm As Form
Dim f As Integer
Dim z As Integer
f = 0

z = Forms.Count - 1


For f = 0 To z
If Forms(f).Name <> &quot;frmMasterDemo&quot; And Forms(f).Name <> &quot;eICAT&quot; And Forms(f).Name <> &quot;MainMenu&quot; Then

Set frmForm = Get_Form(Forms(f).Name)
Unload Forms(f)
Set frmForm = Nothing

DoEvents
End If

Next f
Exit Sub
err_close:
If Err.Number = 9 Then
Exit Sub
End If
MsgBox _
&quot;Error in shut down: &quot; & Err.Description, _
vbOKCancel + vbCritical + vbDefaultButton1, _
&quot;eICAT Error&quot;
Exit Sub
End Sub
 
Yes, that's what I mean, Krill. Thanx :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top