danielhitch
New Member
- Joined
- Sep 8, 2008
- Messages
- 48
Hi.
I have tried several ways to prevent a form of mine from closing.
My problem lies in the fact that I have got a particularly fragile ActiveX control that crashes if the form is closed using either the Application Close, Menu Close, or Tab close - It does not happen if I create a macro linked to a button that closes the form.
First of all, I tried creating an AutoExec but, this still crashes the control. So I have put together a bit of code that almost works, but doesn't. I need you guys to tell me how to make it work.
Here is my code:
I have also tried the code on the form unload too with no success.
As far as I can see, the code kicks in after the close / unload command happens, therefore my click arguement in the If statement doesnt work.
What I need to happen is that the cancel command kicks in on every type of close appart from when the Close_Basic_Accident_Plot button is clicked.
Any ideas?
Thanks.
Dan.
I have tried several ways to prevent a form of mine from closing.
My problem lies in the fact that I have got a particularly fragile ActiveX control that crashes if the form is closed using either the Application Close, Menu Close, or Tab close - It does not happen if I create a macro linked to a button that closes the form.
First of all, I tried creating an AutoExec but, this still crashes the control. So I have put together a bit of code that almost works, but doesn't. I need you guys to tell me how to make it work.
Here is my code:
Code:
Private Sub Form_Close()
If Close_Basic_Accident_Plot_Click Then
Cancel = False
Else
MsgBox "Please Use The Exit Button At The Bottom Left Of The Screen", vbOKOnly + vbExclamation, "Error"
Cancel = True
End If
End Sub
I have also tried the code on the form unload too with no success.
As far as I can see, the code kicks in after the close / unload command happens, therefore my click arguement in the If statement doesnt work.
What I need to happen is that the cancel command kicks in on every type of close appart from when the Close_Basic_Accident_Plot button is clicked.
Any ideas?
Thanks.
Dan.