Quit Method (Application Object)

Applies To   Application object.

Description

The Quit method quits Microsoft Access. You can select one of several options for saving a database object before quitting.

Syntax

Application.Quit [option]

The Quit method has the following argument.

Argument

Description

option

An intrinsic constant that specifies what happens to unsaved objects when you quit Microsoft Access. This argument can be any of the following constants.

Constant

Description

acSaveYes

(Default) Saves all objects without displaying a dialog box.

acPrompt

Displays a dialog box that asks whether you want to save any database objects that have been changed but not saved.

acExit

Quits Microsoft Access without saving any objects.


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 acSaveYes.

See Also   Quit action, Quit method (DoCmd object).

Example

The following example shows the Click event procedure for a command button named AppExit. After clicking the AppExit button, a dialog box prompts the user to save changes, and the procedure quits Microsoft Access.

Private Sub AppExit_Click()
    Application.Quit acPrompt
End Sub