bob fitz
AWF VIP
- Local time
- Today, 03:37
- Joined
- May 23, 2011
- Messages
- 4,719
Please forgive me if I'm just having a "Senior Moment". They seem to be getting more frequent with every passing day
Some years ago I found/copied/wrote some code to disable the use of the Red Cross in an app, forcing users to use a Quit button on a form. Naturally, I can't find it now, so I thought I'd rewrite it. It's only a few lines of code. Quite a few hours later and I'm going nuts. I just can't see why it doesn't work as I expect it to.
The process i had in mind was:
In a standard module declare a Public boolean variable:
In the click event of the Quit button set boOKToClose to True before attempting to call the Quit method:
Finally in the Unload event of a hidden form, check the value before displaying the promt:
And it WORKS but the message shows, even if the Quit button has been used.
I found that I can stop the message from showing if I use a Public Integer but not with a Public Boolean
The attached db should illustrate the problem.
Thank you for your interest if you've made it to here.
If you have any explanation for me that would be fantastic, even if it's that I'm missing something really obvious. Like my mind
Some years ago I found/copied/wrote some code to disable the use of the Red Cross in an app, forcing users to use a Quit button on a form. Naturally, I can't find it now, so I thought I'd rewrite it. It's only a few lines of code. Quite a few hours later and I'm going nuts. I just can't see why it doesn't work as I expect it to.
The process i had in mind was:
In a standard module declare a Public boolean variable:
Public boOKToClose as boolean 'the default value is False
In the click event of the Quit button set boOKToClose to True before attempting to call the Quit method:
boOKToClose =True
Application.Quit
Finally in the Unload event of a hidden form, check the value before displaying the promt:
If boOKToClose = 0 Then
MsgBox "Use the QUIT button to exit app."
Cancel = True
End If
And it WORKS but the message shows, even if the Quit button has been used.
I found that I can stop the message from showing if I use a Public Integer but not with a Public Boolean
The attached db should illustrate the problem.
Thank you for your interest if you've made it to here.
If you have any explanation for me that would be fantastic, even if it's that I'm missing something really obvious. Like my mind