closing the application with the switchboard exit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I use the exit on the switchboard it closes the database but leaves the
Access application open. Is there anything I can do to click the exit button
and have the Access close too and return to the desktop?

thanks!
 
yes,
the button as is now probably has something like this
DoCmd.Close acForm, "FormName"
change it to
Private Sub cmdExit_Click()
If MsgBox("This action will close Access. Do you still
wish to continue?", vbYesNo, "Exit Application Warning") =
vbYes Then

DoCmd.Close acForm, "frmMainIntro", acSaveYes
DoCmd.Close acDefault, "db.mdb", acSaveYes
DoCmd.Quit acQuitSaveNone
Else
MsgBox ("Exit Application Action Aborted.")
End If

End Sub
 
This is easy to do, but first make a back-up copy of your database in case we screw up.

1. Open the Switchboard form in Design View.
2. Go to the code window for this form.
3. Go down to this area:

Private Function HandleButtonClick(intBtn As Integer)

Then look for this bit of code:

' Exit the application.
Case conCmdExitApplication
CloseCurrentDatabase

Change that code to this:

' Exit the application.
Case conCmdExitApplication
DoCmd.Quit

4. Compile the code and save the form.

5. Use the Switchboard Manager to create an option on your main
page for exiting (if you have not already). Select the command option
that says "Exit Application." Press that option on the form in normal
view and it should close the database and Access as well.

That should do it.
 
thank you jeff for these instructions...you're a genius sir
although you should know that with access 2010, if you create a switchboard with switchboard manager, you would first have to convert all macros to VB and then you'll be able to view the switchboard's code....thanks once again
 
Back
Top