Close Method

Applies To

DoCmd Object.

Description

The Close method carries out the Close action in Visual Basic. For more information on how the action and its arguments work, see the action topic.

Syntax

DoCmd.Close [objecttype, objectname], [save]

The Close method uses the following arguments.

Argument

Description


objecttype

One of the following intrinsic constants:

acTable
acQuery
acForm
acReport
acMacro
acModule

objectname

A string expression that is the valid name of an object of the type selected with the objecttype argument.

save

One of the following intrinsic constants:

acPrompt
acSaveYes
acSaveNo

If you leave this argument blank, the default (acPrompt) is assumed.


Remarks

If you leave the objecttype and objectname arguments blank, Microsoft Access closes the active window. If you specify the save argument and leave the objecttype and objectname arguments blank, you must include the objecttype and objectname arguments’ commas.

See Also

Close Action; DoCmd Object; Open, Close Events; Quit Method (DoCmd Object); Save Method.

Example

This example uses the Close method to close the form Order Review, saving any changes to the form without prompting.


DoCmd.Close acForm, "Order Review", acSaveYes