Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
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 November 14th, 2005, 05:04 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default Interrupting DoCmd.Close & Form Unload Event

I have a form with a button to exit Access. It's very basic, i.e. asking if you're sure and then issuing a DoCmd.Quit command. The form then has an UNLOAD event. The unload event has error trapping VBA code to call an error handling subroutine if something goes wrong upon the form unloading.

How to I interrupt the CLOSE and allow Access and the form to stay open when there is an error trapped in the unload event? Right now, the CLOSE command is issued, the UNLOAD even fires, it triggers an error, and Access shuts down anyway.

I've tried a few things but they're not working or I'm misusing them. I'm using Access XP (2002).

Thanks in advance.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
Old November 14th, 2005, 05:15 PM
Authorized User
Join Date: Oct 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Figgis

Have you tried putting an Exit sub command in the error statement?
Old November 19th, 2005, 03:41 PM
Friend of Wrox
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post

Have you tried putting your code from your close event into a separate Sub, then calling the sub from the close?


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to laod a form and unload current form? amit_mande@yahoo.com Pro VB.NET 2002/2003 0 August 11th, 2006 09:15 AM
on window unload event in javascript. babu17 Classic ASP Basics 1 April 15th, 2006 05:48 AM
Overriding Form Close event Chris Beach C# 1 January 16th, 2005 10:20 AM
Handling window unload event MurthyGarimella Javascript 2 June 30th, 2004 10:59 AM
Close in the load event on child form gvozden VB.NET 0 October 22nd, 2003 10:48 AM

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