Microsoft Office Tutorials and References
In Depth Information
The Delete method deletes the current row and sets the EditMode property to adEditDelete .
Again, you need to use the Update method to make the changes final.
One nice feature of the Recordset object is the CancelUpdate method. If you have made any
changes to the current row and call CancelUpdate , all the changes will be discarded and the
original values would be restored. If you had added a new row using the AddNew method, the
new row will be discarded and the current record pointer will be reset to point to the row it
was pointing to prior to calling AddNew .
Using the Fields Collection
The Fields collection contains information about the columns in the current row of the
Recordset object. (See Table 23-9.)
Table 23-9. Key Properties of the Fields Collection
Property: returns the number of items in the collection.
Property: returns the Field object at the location specified by index .
For the most part, you’ll use the Fields collection simply to access the various Field objects
associated with the current row. The other properties and methods in the Fields collection
exist to add and remove Field objects from the collection and aren’t critical to the average
Using the Field Object
The Field object contains information about a single column associated with the current row
of the Recordset object. Some of the most useful properties are listed in Table 23-10.
Table 23-10. Key Properties of the Field Object
Contains the name of the database column.
Contains the original value of the field from the database.
Contains the OLE DB data type of the column. Some common
values are adSmallInt , adInteger , asSingle , adDouble , adCurrency ,
adDate , adBSTR , adBoolean , adDecimal , adBigInt , adBinary ,
adChar , adWChar , adNumeric , adDBDate , adDBTime ,
adVarNumeric , adVarChar , adLongVarChar , adVarWChar ,
adLongVarWChar , adVarBinary , and asLongVarBinary .
Contain the current value of the column as found in the database.
Contain the current value of the field.