Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2007, 02:00 PM
Authorized User
 
Join Date: Sep 2007
Location: , , USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default cancelling close form

Hi all,

I'm trying to get something done on the close event of a form.
When the user closes the form, a message box pops up asking "do u want to exit ?" vbYesNo.
If the user says 'Yes' then there are a series of commands and then the application closes. And if the user says 'No' then nothing happens and the form doesn't close.

My problem is I cannot stop the form from closing even if the user says 'No'. How can this be done ?

Thanks

 
Old October 12th, 2007, 12:25 AM
Friend of Wrox
 
Join Date: Jul 2005
Location: Oklahoma City, OK, USA.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Since the close event does not have a cancel parameter, you will need to move your code to the unload event for the form.

Private Sub Form_Unload(Cancel As Integer)

In your code when the user does not wnat ot exit then use the following

Cancel = True



Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com
 
Old October 12th, 2007, 08:49 AM
Authorized User
 
Join Date: Sep 2007
Location: , , USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok. Got it.
Thank you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
Close all MdiChield form from open one form salman .NET Framework 1.x 0 November 8th, 2007 12:32 AM
How To Close One Form And Show Another form Israr VS.NET 2002/2003 1 December 7th, 2004 12:30 PM
How Do I Close a Form When I Move to Another Form. flyingfox VB.NET 2002/2003 Basics 3 December 29th, 2003 08:56 AM
Cannot close the Form jkalinina C# 3 October 31st, 2003 05:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.