Save

Save a database object.

Syntax
      DoCmd.Save(ObjectType, ObjectName)

Key
   ObjectType   An AcObjectType constant that specifies the
                type of object to save.

   ObjectName   The name of the object to save.

The specified object must be open for the Save method to have any effect. The save method does not work for objects in Print Preview or Design View.

To save the current record (which is not a database object), the preferred syntax is

If Me.Dirty = True Then Me.Dirty = False
or
If Me.Dirty Then Me.Dirty = False

Which means "if the record has changes that can be saved, then save them." Setting the me.dirty property will work even if the form does not have focus, so it is slightly more robust than calling the menu command acCmdSaveRecord.

Examples

DoCmd.Save acForm, "frmPatients"

“God save the Queen – Send her victorious – Happy and glorious – Long to reign over us: God save the Queen” ~ British National Anthem.

Related:

RunCommand acCmdSaveRecord
Me.Dirty


© Copyright SS64.com 1999-2014
Some rights reserved