Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 2.16 KB

Access.DoCmd.Save.md

File metadata and controls

63 lines (41 loc) · 2.16 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
DoCmd.Save method (Access)
vbaac10.chm4177
vbaac10.chm4177
Access.DoCmd.Save
7e01f370-36c9-9f4d-b506-61bc8886ee18
03/07/2019
medium

DoCmd.Save method (Access)

The Save method carries out the Save action in Visual Basic.

Syntax

expression.Save (ObjectType, ObjectName)

expression A variable that represents a DoCmd object.

Parameters

Name Required/Optional Data type Description
ObjectType Optional AcObjectType An AcObjectType constant that specifies the type of object that you want to save.
ObjectName Optional Variant A string expression that's the valid name of an object of the type selected by the ObjectType argument.

Remarks

The Save method works on all database objects that the user can explicitly open and save. The specified object must be open for the Save method to have any effect on the object.

If you leave the ObjectType and ObjectName arguments blank (the default constant, acDefault, is assumed for the ObjectType argument), Microsoft Access saves the active object.

If you leave the ObjectType argument blank, but enter a name in the ObjectName argument, Access saves the active object with the specified name.

If you enter an object type in the ObjectType argument, you must enter an existing object's name in the ObjectName argument.

Note

You can't use the Save method to save any of the following with a new name:

  • A form in Form view or Datasheet view
  • A report in Print Preview
  • A module
  • A server view in Datasheet view or Print Preview
  • A table in Datasheet view or Print Preview
  • A query in Datasheet view or Print Preview
  • A stored procedure in Datasheet view or Print Preview

Example

The following example uses the Save method to save the form named New Employees Form. This form must be open when the code containing this method runs.

DoCmd.Save acForm, "New Employees Form"

[!includeSupport and feedback]