Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 26th, 2006, 10:00 AM
Authorized User
 
Join Date: Aug 2004
Location: , , Belgium.
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

Reply With Quote
  #2 (permalink)  
Old May 26th, 2006, 10:45 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
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
Reply With Quote
  #3 (permalink)  
Old May 26th, 2006, 12:26 PM
Authorized User
 
Join Date: Aug 2004
Location: , , Belgium.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx

S.
www.scriptingit.be

Reply With Quote
  #4 (permalink)  
Old May 26th, 2006, 12:43 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #5 (permalink)  
Old May 31st, 2006, 01:49 AM
Registered User
 
Join Date: May 2006
Location: Amsterdam, , Netherlands.
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:48 AM.


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