Quit

Close Microsoft Access.

Syntax
      Quit(Option)

Key
   Option   The action to take when quitting Access:
               acQuitPrompt (0)
               Ask whether to save any changes.

               acQuitSaveAll (1) (Default)
               Save all objects without displaying a dialog box.

               acQuitSaveNone (2)
               Quit Microsoft Access without saving any objects.

DoCmd.Quit was added to provide backward compatibility for running the Quit action in Visual Basic code in Microsoft Access 95. It’s recommended that you use the existing Quit method of the Application object instead.

When code is called directly or indirectly from an Autoexec macro/vba, quit is likely to fail with error 2046 (Access thinks it hasnt finished opening yet). In these cases you may need to close the database (Docmd.CloseDatabase), or recordset, before closing the application manually.

Examples

' Quit Microsoft Access (implicitly also close the current database)
Application.Quit acQuitSaveNone

“You ain’t nothin’ but a hound dog
Quit snoopin’ round my door
You ain’t nothin’ but a hound dog
Quit snoopin’ round my door” ~ Leiber and Stoller

Related

CloseDatabase - Close the database.


 
Copyright © 1999-2024 SS64.com
Some rights reserved