Disable Access Close Button not Form Close Button? 
Author Message
 Disable Access Close Button not Form Close Button?

Hi All,

I've been searching through google for the answer to this problem and I know
there is a way to do this by going to the MS Knowledgebase. However I think
what I'd rather do is what someone else suggested which is when close is
called then put up a message box to say you must exit via the button on the
switchboard.

They said to use the code below.

Quote:
>Add to your switchboard a boolean variable (I used "AllowClose").  Set
>the variable to false.  Then add something like the following to the
>Unload event of your Switchboard form.
>   If Not AllowClose Then
>      MsgBox "You must use the 'Quit' button to exit this application!",

vbInformation + vbOKOnly, "Illegal Escape"

Quote:
>      Cancel = True
>   End If
>Then in the click event for your Quit button, add a line to set
>AllowClose to True.

I understand how to add code to the events but not how to set the boolean
variable
to start with do you do this on a Public Function in a Module? If so how?

TIA
Mark



Thu, 25 Aug 2005 04:10:55 GMT  
 Disable Access Close Button not Form Close Button?
hello Mark
you declare the variable as public in the declarations
section of the form (just under Option Explicit And option
compare...) and then set it's value to true in the click
event of the button (you dont need to reset it's value to
False since boolean variables are false until changed)
good luck
Erez.
Quote:
>-----Original Message-----
>Hi All,

>I've been searching through google for the answer to this
problem and I know
>there is a way to do this by going to the MS

Knowledgebase. However I think
Quote:
>what I'd rather do is what someone else suggested which
is when close is
>called then put up a message box to say you must exit via
the button on the
>switchboard.

>They said to use the code below.

>>Add to your switchboard a boolean variable (I

used "AllowClose").  Set
Quote:
>>the variable to false.  Then add something like the
following to the
>>Unload event of your Switchboard form.

>>   If Not AllowClose Then
>>      MsgBox "You must use the 'Quit' button to exit
this application!",
>vbInformation + vbOKOnly, "Illegal Escape"
>>      Cancel = True
>>   End If

>>Then in the click event for your Quit button, add a line
to set
>>AllowClose to True.

>I understand how to add code to the events but not how to
set the boolean
>variable
>to start with do you do this on a Public Function in a
Module? If so how?

>TIA
>Mark

>.



Thu, 25 Aug 2005 06:46:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Disable Close button in Access 2.0 Form

2. Disable Close button on Access 2.0 Form

3. Disabled Close button / What's this button

4. User Form close buttons and timer close

5. Cancel/close form command button causes app to close

6. Close command button allows form to be closed when required fields are left blank

7. Problem with Controlled Closing of a Form when exiting throught the Window-Close-Button

8. Form Close Vs Close Window button problem

9. Close button not disabled

10. Close button, closes form to the wrong place


 
Powered by phpBB® Forum Software © phpBB Group