This method commits changes held in the recordset to the database on the device.
Syntax
recordset.Update Fields, Values
Parameters
Fields
Optional. Single name or an array that represents names or ordinal positions of the fields you want to modify.
Values
Optional. Single value or an array that represents values for the fields in the new record.
Remarks
Use the Update method to save any changes you make to the current record of a Recordset object since calling the AddNew method or since changing any field values in an existing record. The Recordset object must support updates.
To set field values, complete one of the following tasks:
When you use arrays of fields and values, there must be an equal number of elements in both arrays. In addition, the order of field names must match the order of field values. If the number and order of fields and values do not match, an error occurs.
If you move from the record you are adding or editing before calling the Update method, ADOCE automatically calls Update to save the changes. You must call the CancelUpdate method if you want to cancel any changes made to the current record or to discard a newly added record.
The current record remains current after you call the Update method.
Example
The following code example shows how to use the Update method with the AddNew method to create a new record.
Dim rs
Set rs = CreateObject("adoce.recordset")
rs.Open "myTable", "", 1, 3
'This statement creates a new record.
rs.AddNew
'These two statements use the fields collection
'to add data to the recordset.
rs.Fields("firstfield") = "ActiveX Data Objects"
rs.Fields("secondfield") = 1.8
'This statement modifies the database
'based on the recordset.
rs.Update