Save a database object.

      DoCmd.Save(ObjectType, ObjectName)

   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
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. Also me.dirty does not throw an error if there are no changes waiting to be saved, so it is more robust than calling the menu command acCmdSaveRecord.


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.


RunCommand acCmdSaveRecord
Undo - Undo the last data edit.

Copyright © 1999-2024
Some rights reserved