ADO Update Method

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO Update Method

The Update method is called to save all changes you have made to the current Record to both the Recordset object and the data source. Clearly, both the Recordset object and the data source must support updates.

If you have made changes to a record and then move to another record, the Update method is implicitly called and the record is saved. After a call to this method is completed, the current record pointer will still point to the same current record.

The Update method is used to save a single record. The UpdateBatch method is called to save multiple records. (If the Recordset object supports batch updating, the new and changed records will be locally cached until you call the UpdateBatch method.)
 

Syntax

objRecordset.Update fields,values

Example


If MsgBox("Save All Changes", vbYesNo) = vbYes Then
   objRecordset.Update
   MsgBox "All Changes Updated"
Else
   objRecordset.CancelUpdate
   MsgBox "Update Cancelled"
End If
 

There are two optional parameters.

Parameter Description
fields 
Optional. A field name, or an array of field names or field positions to update
values 
Optional. A value or an array of values for the field or array of fields you want to update