Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Closing Box


Message #1 by "Mark Irvine" <markpirvine@b...> on Thu, 6 Dec 2001 12:08:22 -0000
Hi,



I was wondering if there is anyway to stop a form from being closed, after

prompting the user, when the Close Button (X) in the Control Box is pressed.

I know I could hide the Control Box and provide another button to close the

form after prompting the user.



Any help anyone could offer would be greatly appreciated.



Mark





Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 06 Dec 2001 07:13:18 -0800
The Form_Unload event passes in a parameter called Cancel.  Setting this

parameter to True will cancel the close.



HTH,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

Extension 8487



-----Original Message-----

From: Mark Irvine [mailto:markpirvine@b...]

Sent: Thursday, December 06, 2001 4:08 AM

To: Access

Subject: [access] Closing Box





Hi,



I was wondering if there is anyway to stop a form from being closed, after

prompting the user, when the Close Button (X) in the Control Box is pressed.

I know I could hide the Control Box and provide another button to close the

form after prompting the user.



Any help anyone could offer would be greatly appreciated.



Mark










Message #3 by "Mark Irvine" <markpirvine@b...> on Tue, 11 Dec 2001 16:15:30 -0000
Roy,



Many thanks for your reply, I have tried doing what you suggested.  In that

I am calling the Form_Unload(True) procedure from the Form_Close procedure.

However the form still closes.  I have used the MsgBox function to display

the value of Cancel.  This seemed to show that false was passed and then

true - in that the message box appeared twice.



Have you any suggestions?



Mark

Pardee, Roy E <roy.e.pardee@l...> wrote in message news:126591@a...

>

> The Form_Unload event passes in a parameter called Cancel.  Setting this

> parameter to True will cancel the close.

>

> HTH,

>

> -Roy

>

> Roy Pardee

> Programmer/Analyst

> SWFPAC Lockheed Martin IT

> Extension 8487

>

> -----Original Message-----

> From: Mark Irvine [mailto:markpirvine@b...]

> Sent: Thursday, December 06, 2001 4:08 AM

> To: Access

> Subject: [access] Closing Box

>

>

> Hi,

>

> I was wondering if there is anyway to stop a form from being closed, after

> prompting the user, when the Close Button (X) in the Control Box is

pressed.

> I know I could hide the Control Box and provide another button to close

the

> form after prompting the user.

>

> Any help anyone could offer would be greatly appreciated.

>

> Mark

>

>

>




>

>





Message #4 by brian.skelton@b... on Tue, 11 Dec 2001 18:00:19
Mark



You have to put your code in the form_unload event. Something like this:



Private Sub Form_Unload(Cancel As Integer)



  If MsgBox("Do you really want to close?", vbYesNo, "Close") = vbNo Then

      Cancel = True

  Else

      Cancel = False

  End If

    

End Sub



-Brian



> Roy,

> 

> Many thanks for your reply, I have tried doing what you suggested.  In 

that

> I am calling the Form_Unload(True) procedure from the Form_Close 

procedure.

> However the form still closes.  I have used the MsgBox function to 

display

> the value of Cancel.  This seemed to show that false was passed and then

> true - in that the message box appeared twice.

> 

> Have you any suggestions?

> 

> Mark

> Pardee, Roy E <roy.e.pardee@l...> wrote in message 

news:126591@a...

> >

> > The Form_Unload event passes in a parameter called Cancel.  Setting 

this

> > parameter to True will cancel the close.

> >

> > HTH,

> >

> > -Roy

> >

> > Roy Pardee

> > Programmer/Analyst

> > SWFPAC Lockheed Martin IT

> > Extension 8487

> >

> > -----Original Message-----

> > From: Mark Irvine [mailto:markpirvine@b...]

> > Sent: Thursday, December 06, 2001 4:08 AM

> > To: Access

> > Subject: [access] Closing Box

> >

> >

> > Hi,

> >

> > I was wondering if there is anyway to stop a form from being closed, 

after

> > prompting the user, when the Close Button (X) in the Control Box is

> pressed.

> > I know I could hide the Control Box and provide another button to close

> the

> > form after prompting the user.

> >

> > Any help anyone could offer would be greatly appreciated.

> >

> > Mark

> >

> >

> >




> >

> >

> 

> 


  Return to Index