Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Close Button will not disable


Message #1 by "David Chapman" <david.chapman@d...> on Thu, 12 Dec 2002 00:24:17
I have to validate data before form close. If the validating is 
unsuccesful, I don't want the form to close. Form close is not a 
cancellable event. The preferred method is to disable the close form  X in 
the top RH corner of the screen, and create my own close form button to 
execute the validation and then conditionally close. 

But contrary to the help, the close X will not disable when the 
forms "close button" property is set to "No". The help reads "    No
	The Close button is disabled and the Close command isn't available 
on the Control menu.	False (0)" which would be great if it worked.

In experimenting I have also set Border style to none, control box to No, 
MinMax buttons to none. But none of these help at all.

Q258049 says "In order to disable the application Close button and the 
Close command on the System menu, you must call the GetSystemMenu and 
ModifyMenu functions from the Win32 API." Does this apply to all forms in 
the application? It seems to negate the purpose of the close button 
property.
Message #2 by "Haslett, Andrew" <andrew.haslett@i...> on Thu, 12 Dec 2002 11:46:14 +1030
You can remove the X button in the control box through the form properties.
This will reduce the number of methods available to the user to exit the
form, and therefore easier for you to trap.

Under the format tab, under form properties, set 'Close Button' to NO

Cheers,
A

-----Original Message-----
From: David Chapman [mailto:david.chapman@d...]
Sent: Thursday, 12 December 2002 10:54 AM
To: Access
Subject: [access] Close Button will not disable


I have to validate data before form close. If the validating is 
unsuccesful, I don't want the form to close. Form close is not a 
cancellable event. The preferred method is to disable the close form  X in 
the top RH corner of the screen, and create my own close form button to 
execute the validation and then conditionally close. 

But contrary to the help, the close X will not disable when the 
forms "close button" property is set to "No". The help reads "    No
	The Close button is disabled and the Close command isn't available 
on the Control menu.	False (0)" which would be great if it worked.

In experimenting I have also set Border style to none, control box to No, 
MinMax buttons to none. But none of these help at all.

Q258049 says "In order to disable the application Close button and the 
Close command on the System menu, you must call the GetSystemMenu and 
ModifyMenu functions from the Win32 API." Does this apply to all forms in 
the application? It seems to negate the purpose of the close button 
property.

IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.
Message #3 by "Kenny Alligood" <kennyalligood@h...> on Thu, 12 Dec 2002 01:43:10
Try setting the following properties of the form:

Border Style -- Thin
ControlBox -- No
CloseButton -- No

I use this method on all my forms and it works well for me.

Hope this helps....

Kenny
Message #4 by "David Chapman" <david.chapman@d...> on Thu, 12 Dec 2002 03:14:25
> You can remove the X button in the control box through the form 
properties.
This will reduce the number of methods available to the user to exit the
form, and therefore easier for you to trap.

Under the format tab, under form properties, set 'Close Button' to NO

Cheers,
A
Thanks for your prompt replies. 

Sadly I realise that I forgot to mention Access97. I do not have a form 
properties selector in the format menu from the selection bar, and as 
previously explained, the usual form properties, seting closebutton 
to 'no' just does not have any effect, I can still use the top RH X to 
close the form.
Kenny, I tried setting the border to thin wth the other settings you 
recommended but it does not make any difference.

Message #5 by "Haslett, Andrew" <andrew.haslett@i...> on Thu, 12 Dec 2002 14:11:41 +1030
See if any of these help:
http://www.experts-exchange.com/Databases/MS_Access/Q_10260568.html
http://www.experts-exchange.com/Databases/Q_20388411.html
http://www.tek-tips.com/gfaqs.cfm/pid/702/fid/1870
http://www.tek-tips.com/gfaqs.cfm/pid/702/fid/2071

-----Original Message-----
From: David Chapman [mailto:david.chapman@d...]
Sent: Thursday, 12 December 2002 1:44 PM
To: Access
Subject: [access] RE: Close Button will not disable


> You can remove the X button in the control box through the form 
properties.
This will reduce the number of methods available to the user to exit the
form, and therefore easier for you to trap.

Under the format tab, under form properties, set 'Close Button' to NO

Cheers,
A
Thanks for your prompt replies. 

Sadly I realise that I forgot to mention Access97. I do not have a form 
properties selector in the format menu from the selection bar, and as 
previously explained, the usual form properties, seting closebutton 
to 'no' just does not have any effect, I can still use the top RH X to 
close the form.
Kenny, I tried setting the border to thin wth the other settings you 
recommended but it does not make any difference.


IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.
Message #6 by "Leo Scott" <leoscott@c...> on Wed, 11 Dec 2002 22:18:14 -0800
Does Access 97 have a QueryUnload event for the form?  If it does you can
set Cancel=True in the event and it will prevent the form closing.

-----Original Message-----
From: David Chapman [mailto:david.chapman@d...]
Sent: Thursday, December 12, 2002 3:14 AM
To: Access
Subject: [access] RE: Close Button will not disable


> You can remove the X button in the control box through the form
properties.
This will reduce the number of methods available to the user to exit the
form, and therefore easier for you to trap.

Under the format tab, under form properties, set 'Close Button' to NO

Cheers,
A
Thanks for your prompt replies.

Sadly I realise that I forgot to mention Access97. I do not have a form
properties selector in the format menu from the selection bar, and as
previously explained, the usual form properties, seting closebutton
to 'no' just does not have any effect, I can still use the top RH X to
close the form.
Kenny, I tried setting the border to thin wth the other settings you
recommended but it does not make any difference.



Message #7 by "Brian Skelton" <brian.skelton@b...> on Thu, 12 Dec 2002 08:47:58 -0000
David

Can you please confirm that you are talking about the forms close button
and not Access's close button? If you click on the close button does the
form close? Or does the whole of Access shut down?

Brian

-----Original Message-----
From: David Chapman [mailto:david.chapman@d...] 
Sent: 12 December 2002 03:14
To: Access
Subject: [access] RE: Close Button will not disable

> You can remove the X button in the control box through the form 
properties.
This will reduce the number of methods available to the user to exit the
form, and therefore easier for you to trap.

Under the format tab, under form properties, set 'Close Button' to NO

Cheers,
A
Thanks for your prompt replies. 

Sadly I realise that I forgot to mention Access97. I do not have a form 
properties selector in the format menu from the selection bar, and as 
previously explained, the usual form properties, seting closebutton 
to 'no' just does not have any effect, I can still use the top RH X to 
close the form.
Kenny, I tried setting the border to thin wth the other settings you 
recommended but it does not make any difference.


Message #8 by "Steve Klein" <Stephen@K...> on Thu, 12 Dec 2002 22:48:03 -0000
If you use the FOKtoClose flag on a form like this  you diasble most of the
unwanted ways out. All I have left is the cmdClick button to work.  Imprt
this to a swirchboard and see what happensw

Dim fOKToClose As Boolean


Private Sub Form_Load()
    fOKToClose = False
 End Sub
  Private Sub Form_Unload(cancel As Integer)
    cancel = Not fOKToClose
 End Sub

Private Sub cmdQuit_Click()
On Error GoTo Err_cmdquit_Click


   Dim Msg, Style, title, Response, MyString



          Msg = "Are you sure you want to close the database?"   ' Define
message.
            Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define
buttons.
            title = "STOP and THINK"  ' Define title.
            Response = MsgBox(Msg, Style, title)

                        If Response = vbYes Then   ' User chose Yes.
                            MsgBox "The warehouse is now closing.  Goodbye!"
                             fOKToClose = True
                             ShrinkMe (Me.Name)
                            DoCmd.Quit acQuitSaveAll
                          Else    ' User chose No.
                                MsgBox "You decided to carry on.  Do
continue."
                        End If




Exit_cmdquit_Click:
    Exit Sub

Err_cmdquit_Click:
    MsgBox Err.Description
    Resume Exit_cmdquit_Click
End Sub

Steve K


-----Original Message-----
From: David Chapman [mailto:david.chapman@d...]
Sent: 12 December 2002 00:24
To: Access
Subject: [access] Close Button will not disable


I have to validate data before form close. If the validating is
unsuccesful, I don't want the form to close. Form close is not a
cancellable event. The preferred method is to disable the close form  X in
the top RH corner of the screen, and create my own close form button to
execute the validation and then conditionally close.

But contrary to the help, the close X will not disable when the
forms "close button" property is set to "No". The help reads "    No
	The Close button is disabled and the Close command isn't available
on the Control menu.	False (0)" which would be great if it worked.

In experimenting I have also set Border style to none, control box to No,
MinMax buttons to none. But none of these help at all.

Q258049 says "In order to disable the application Close button and the
Close command on the System menu, you must call the GetSystemMenu and
ModifyMenu functions from the Win32 API." Does this apply to all forms in
the application? It seems to negate the purpose of the close button
property.


Message #9 by "Brian Skelton" <brian.skelton@b...> on Thu, 12 Dec 2002 09:02:35 -0000
...and maybe this article is relevant?

http://www.mvps.org/access/api/api0022.htm

Brian

-----Original Message-----
From: David Chapman [mailto:david.chapman@d...] 
Sent: 12 December 2002 03:14
To: Access
Subject: [access] RE: Close Button will not disable

> You can remove the X button in the control box through the form 
properties.
This will reduce the number of methods available to the user to exit the
form, and therefore easier for you to trap.

Under the format tab, under form properties, set 'Close Button' to NO

Cheers,
A
Thanks for your prompt replies. 

Sadly I realise that I forgot to mention Access97. I do not have a form 
properties selector in the format menu from the selection bar, and as 
previously explained, the usual form properties, seting closebutton 
to 'no' just does not have any effect, I can still use the top RH X to 
close the form.
Kenny, I tried setting the border to thin wth the other settings you 
recommended but it does not make any difference.



  Return to Index