Saving a Record

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

The command button wizard generates the following code to save a record.

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

I have been using docmd.save

What is the difference between these two? Are there advantages to the way
the wizard does it? Are there any other, more preferred methods to save a
record via code?

Thanks

Joe
 
DoCmd.Save actually saves any changes to the *form* and its properties. It
does not save the record.

To save the record, you could use one of these:
RunCommand acCmdSaveRecord
Me.Dirty = False
Me.Refresh
 
The command button wizard generates the following code to save a record.

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

I have been using docmd.save

What is the difference between these two? Are there advantages to the way
the wizard does it? Are there any other, more preferred methods to save a
record via code?

Thanks

Joe

DoCmd.Save does not save the record, it saves any changes made to the
form object itself.

To save a record in Access 2000 or higher:

DoCmd.RunCommand acCmdSaveRecord

Also look up the Dirty property in VBA help.
 
Back
Top