Exiting not only the DB, but Access 2010

Sanjo

Registered User.
Local time
Today, 10:26
Joined
Mar 14, 2012
Messages
62
When I click on the Exit button on my Access 2010 Switchboard, it exits that DB, but leaves Access open. Is there a straightforward change I can make such that when I click on the Switchboard Exit button, I am taken out of Access? I have looked at a number of suggestions, but am unable to get them to work. I am not knowlegable of VBA. Thanks in advance for any help.
 
I think that a button with the following code in its On Click event would do what you require:
Code:
DoCmd.Quit
 
thanks Bob. Here is the procedure I finally came up with:
Being a novice I could not understand what I was reading as advice on how to make changes neccessary to exit the Access 2010 software, not just the database, thru the Switchboard. So I finally came up with a procedure I hope will help folks:

1st = Create a Macro
-click on Create at top of Access
-click on the arrow on the small window that comes up and scrowl down to "QuitAccess"
-another window appears with options. click on arrow and select "Save All"
-give the Macro a name
-X out and save

2nd = open the Switchboard Manager
- click on "New" (assuming you don't already have an Exit button)
- a 3 field window appears.
.In the TEXT field type in "Return to Desktop" or whatever
.In the COMMAND field select "Run Macro"
.In the MACRO field select the name of the macro you created above.

get out of Switchboard Manager by clicking "close" twice.

For my simple mind I need this detailed instructions. I hope this helps someone.
 
What Bob posted is the way to go.

No need for a Macro.
 
thanks Bob. Here is the procedure I finally came up with:
Being a novice I could not understand what I was reading as advice on how to make changes neccessary to exit the Access 2010 software, not just the database, thru the Switchboard. So I finally came up with a procedure I hope will help folks:

1st = Create a Macro
-click on Create at top of Access
-click on the arrow on the small window that comes up and scrowl down to "QuitAccess"
-another window appears with options. click on arrow and select "Save All"
-give the Macro a name
-X out and save

2nd = open the Switchboard Manager
- click on "New" (assuming you don't already have an Exit button)
- a 3 field window appears.
.In the TEXT field type in "Return to Desktop" or whatever
.In the COMMAND field select "Run Macro"
.In the MACRO field select the name of the macro you created above.

get out of Switchboard Manager by clicking "close" twice.

For my simple mind I need this detailed instructions. I hope this helps someone.
If you open the form in design view and then use the wizard to create a new button, it is very simple to produce the code I gave.
 
I am wanting to learn and do it the simplest way, but If am a little confused. Since the Switchboard has an Exit button where do you put the button with the DoCmd.Quit code in its On Click event? Sorry for being so dense.
 
Have a look at the Code behind the Switchboard's Exit Button and replace it with Quit instead of Close.
 
thanks RainLover. now I really feel dumb. when I edit the "exit application" button on the Switchboard Manager it won't let me do anything else. Don't give up on me
:-)
 
Guess I have to give up. there is no code to post. I simply go to the Access 2010 Switchboard Manager and click on the EDIT SWITCHBOARD PAGE. I then click on Edit and click on the command "EXIT APPLICATION". that is it. I can't change the code behind that command. thanks anyway.
 
You need to be in design View of the form.

Then you can go to the code.
 
The Switchboard generates:
Code:
CloseCurrentDatabase
Replace that with:
Code:
Application.Quit acQuitSaveAll

Even though there won't be any objects that need saving in a production database (the user gets to modify data, not objects), I use the save all option to protect myself in case I have modified something and accidentially press the close button on the menu. I don't want it silently discarding any change I made.
 
Last edited by a moderator:
OK. how do you subsequently close access if it stays open? can you close it normally, or do you have to shut it down with task manager

one problem is that if your code includes any open recordsets, that have not been explicitly closed, then access cannot shut down. that may be your problem.
 
Try this in design view of the Switchboard.

Using the Tools Menu, add a new Command Button and if the wizard starts then follow that to Close the DB.

If no wizard simply put in the On Click Event "DoCmd.Quit."

Or if you like use Pat's Code. Doesn't really matter at this stage.

Don't wory about Open Recordsets. This is not your problem.
 

Users who are viewing this thread

Back
Top Bottom