Name

Recordset.AddNew Method — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     recordset.AddNew Fields, Values
                  

The AddNew method creates a new record within the current Recordset object that is set to the value that you specify.

Arguments

Fields

As the optional first parameter to the AddNew method, supply either a Variant or a Variant array. This object represents the name of the field or an array of fields, respectively, for which you wish to initialize values. If this parameter is a Variant array, then the next parameter, Values, must also be a Variant array of the same dimension.

Values

The optional second parameter works in correspondence with the first parameter, Fields. This parameter is also either a Variant or a Variant array that specifies the values of the fields that you included in your first parameter. It is important to remember that if this parameter contains a Variant array, then the Fields parameter must also be an array of the same dimension. In addition, each ordinal position of both arrays must match the proper fields to the correct values.

Description

The AddNew method is a member method of the Recordset object. Its purpose is to add a new record to the recordset specified by the Recordset object. With the AddNew method, you may choose to include either a single field name and initialization value or a list of fields, in the form of a Variant array, along with a corresponding Variant array of values, which match these fields.

After calling the AddNew method, you can call ...

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.