The Quit method quits Microsoft Access. You can select one of several options for saving a database object before quitting.
expression.Quit(Option)
expression Required. An expression that returns an Application object.
Option Optional AcQuitOption. The quit option.
AcQuitOption can be one of these AcQuitOption constants. |
acQuitPrompt Displays a dialog box that asks whether you want to save any database objects that have been changed but not saved. (Formerly acPrompt). |
acQuitSaveAll default Saves all objects without displaying a dialog box. (Formerly acSaveYes). |
acQuitSaveNone Quits Microsoft Access without saving any objects. (Formerly acExit). |
Remarks
The Quit method has the same effect as clicking Exit on the File menu. You can create a custom menu command or a command button on a form with a procedure that includes the Quit method. For example, you can place a Quit button on a form and include a procedure in the button's Click event that uses the Quit method with the Option argument set to acQuitSaveAll.
Quit method as it applies to the DoCmd object.
The Quit method of the DoCmd object carries out the Quit action in Visual Basic.
expression.Quit(Options)
expression Required. An expression that returns a DoCmd object.
Options Optional AcQuitOption. The quit option.
AcQuitOption can be one of these AcQuitOption constants. |
acQuitPrompt Displays a dialog box that asks whether you want to save any database objects that have been changed but not saved. |
acQuitSaveAll default Saves all objects without displaying a dialog box. |
acQuitSaveNone Quits Microsoft Access without saving any objects. |
Remarks
The Quit method of the DoCmd object 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.
Example
As it applies to the Application object.
The following example shows the Click event procedure for a command button named AppExit. After the AppExit button is clicked, a dialog box prompts the user to save changes and the procedure quits Microsoft Access.
Private Sub AppExit_Click()
Application.Quit acQuitPrompt
End Sub
As it applies to the DoCmd object.
The following example displays a dialog box or dialog boxes that ask if users want to save any changed objects before they quit Microsoft Access.
DoCmd.Quit acQuitPrompt