Quit Method (Application Object)

Applies To

Application Object

Description

Use the Quit method to quit Microsoft Access. You can select one of several options for saving a database object before quitting.

Syntax

Application.Quit [option]

The Quit method uses the following argument.

Argument

Description

option

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

· (Default) acSaveYes 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 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 option set to acSaveYes.

See Also

Quit Action.

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 acPromptSub