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 has the following arguments.

Argument

Description

objecttype

One of the following intrinsic constants:

acDefault (default)
acForm
acMacro
acModule
acQuery
acReport
acTable

objectname

A string expression that's the valid name of an object of the type selected by the objecttype argument.

save

One of the following intrinsic constants:

acSaveNo
acSavePrompt (default)
acSaveYes

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


Remarks   If you leave the objecttype and objectname arguments blank (the default constant, acDefault, is assumed for objecttype), 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, Close method, Open, Close events, Quit method (DoCmd object), Save method.

Example

The following 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