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 <> "frmMasterDemo" And Forms(f).Name <> "eICAT" And Forms(f).Name <> "MainMenu" 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 _
"Error in shut down: " & Err.Description, _
vbOKCancel + vbCritical + vbDefaultButton1, _
"eICAT Error"
Exit Sub
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.