Save the current record and any changes you've made to it.

      expression.Update(UpdateType, Force)

   UpdateType  The type of update, as specified in Settings 
               (ODBCDirect workspaces only).

   Force       Force the changes into the database, regardless
               of whether the underlying data has been changed
               by another user. True / False
               (ODBCDirect workspaces only).

To add, edit, or delete a record, there must be a unique index on the record in the underlying data source. If not, a "Permission denied" or "Invalid argument" error will occur.

If you move to another record, close or cancel the recordset without performing an update then all changes to the current record will be lost.

In an Access workspace, when the Recordset object’s LockEdits property setting is True (pessimistically locked) in a multiuser environment, the record remains locked from the time Edit is used until the Update method is executed or the edit is canceled. If the LockEdits property setting is False (optimistically locked), the record is locked and compared with the pre-edited record just before it is updated in the database.

If the record has changed since you used the Edit method, the Update operation fails. Access database engine-connected ODBC and installable ISAM databases always use optimistic locking. To continue the Update operation with your changes, use the Update method again. To revert to the record as the other user changed it, refresh the current record by using Move 0.


Dim db As Database
Dim rst As Recordset

Set dbs = OpenDatabase("Northwind.mdb")
Set rst = dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)
With rst
   !FirstName = "Fred"
   !LastName = "Bloggs"
End With

“Even God cannot change the past” ~ Agathon


MoveFirst/Last/Next/Previous Record
OpenRecordset - Create a new Recordset
CancelUpdate - Cancel recordset changes

Copyright © 1999-2024
Some rights reserved