Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 May 26th, 2006, 10:00 AM
Authorized User
 
Join Date: Aug 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Close Database using VBA

Hi Guru's

Does someone has a code snippet available for closing the complete database when closing the master form

thx

S

 
Old May 26th, 2006, 10:45 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Try this...

Private Sub cmdExit_Click()
    DoCmd.Quit acQuitPrompt
End Sub

The acQuitPrompt, ensures that it asks if you want to save, if there are any unsaved changes.

HTH

Mike

Mike
EchoVue.com
 
Old May 26th, 2006, 12:26 PM
Authorized User
 
Join Date: Aug 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx

S.
www.scriptingit.be

 
Old May 26th, 2006, 12:43 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Looks like you will need to remove the close button from the master form, and give them only one way out of the master form: cmdExit.


mmcdonal
 
Old May 31st, 2006, 01:49 AM
Registered User
 
Join Date: May 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can also place the docmd.quit command in the unload event of the master form:

Private Sub Form_Unload()
  DoCmd.Quit acQuitPrompt
End Sub

maarten






Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close when screen saver close Rehanrana Pro VB 6 1 April 7th, 2008 03:09 AM
When should you close the database connection? Stickannn Pro PHP 0 September 13th, 2007 04:25 AM
Database update on window close hemal_301080 ASP.NET 1.0 and 1.1 Professional 1 August 12th, 2006 02:34 PM
window.close() failing to...well...close! mheathcote Javascript How-To 2 October 31st, 2005 03:02 PM
How to close database opened by adodc aa_azadeh Pro VB Databases 1 September 28th, 2004 08:04 AM





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