Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 January 26th, 2010, 02:15 PM
Authorized User
 
Join Date: Feb 2009
Posts: 25
Thanks: 11
Thanked 0 Times in 0 Posts
Default Exit database button to close Access

I have solved the problem. thanks to all who replied.

Last edited by billy1r; March 23rd, 2010 at 01:11 PM..
 
Old February 8th, 2010, 05:56 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

What would you like it to do instead?
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
The Following User Says Thank You to SerranoG For This Useful Post:
billy1r (March 23rd, 2010)
 
Old February 8th, 2010, 11:34 PM
Authorized User
 
Join Date: Feb 2009
Posts: 25
Thanks: 11
Thanked 0 Times in 0 Posts
Default Exit Database Button to CLose Access

I would like the botton on the second page to go back to the first page only, not exit the application, which is what it does! To get back to the first page of my switchboard, I have to restart the database.
 
Old February 9th, 2010, 08:47 AM
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

Bear with me as I understand your switchboard.

Is your switchboard one form that scrolls down to two halves? Are your switchboards two sepearate forms that open? If they are two forms, are they open at the same time or does Page 1 close when you open Page 2?
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
The Following User Says Thank You to SerranoG For This Useful Post:
billy1r (March 23rd, 2010)
 
Old February 9th, 2010, 09:58 AM
Authorized User
 
Join Date: Feb 2009
Posts: 25
Thanks: 11
Thanked 0 Times in 0 Posts
Default Exit Database Button to Close

My switchboard is 2 separate pages. Page 1 closes when page two opens. There is a button on page two which will take you back to the main page (page 1). Since I added that code, that button also closes the database and exits the application. I have tried taking that code out. But when I do my database doesn't work properly.
I am new at VBA for Access so I don't really understand it all yet although I am studying it at this time.
 
Old February 9th, 2010, 10:25 AM
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

Open Pages 1 & 2 at the same time but make Page 1 open second so that it's on top of Page 2. Don't close either.

When on Page 1, the button just activates Page 2 and vice-versa

Forms.Page1.Form.Activate

or

Forms.Page2.Form.Activate

Have yet ANOTHER button on each form that closes the whole database separate from the page-toggling buttons.

DoCmd.Quit
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
The Following User Says Thank You to SerranoG For This Useful Post:
billy1r (March 23rd, 2010)
 
Old February 9th, 2010, 10:27 AM
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

Oh, and replace Page1 and Page2 in my code for your real form names.

Forms.Your_Real_Form_Name_Here.Form.Activate
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
The Following User Says Thank You to SerranoG For This Useful Post:
billy1r (March 23rd, 2010)
 
Old March 22nd, 2010, 05:50 AM
Authorized User
 
Join Date: Nov 2005
Posts: 41
Thanks: 6
Thanked 1 Time in 1 Post
Send a message via MSN to RobCarter
Default

Or you could use

Code:
 
docmd.openform "your_page_1", acform
docmd.close acform, "your_page_2", acSaveYes
on the button on page 2. That ought to do it.
__________________
Rob Carter
The Following User Says Thank You to RobCarter For This Useful Post:
billy1r (March 23rd, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access application exit button generate lock ayazhoda Access VBA 1 June 17th, 2008 10:28 AM
access close button Vince_421 Access VBA 3 February 14th, 2007 12:01 PM
Exit or Close Internet Explorer rylemer Classic ASP Basics 1 July 12th, 2006 07:21 PM
Run macro when exit/close excel dgilford Excel VBA 1 September 8th, 2005 02:42 AM
Access Close Button stoneman Access 9 July 7th, 2004 02:53 PM





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