Clone Method (ADO)

Microsoft ActiveX Data Objects (ADO)

Clone Method

       

Creates a duplicate Recordset object from an existing Recordset object. Optionally, specifies that the clone be read-only.

Syntax

Set rstDuplicate = rstOriginal.Clone (LockType)

Return Value

Returns a Recordset object reference.

Parameters

rstDuplicate   An object variable that identifies the duplicate Recordset object to be created.

rstOriginal   An object variable that identifies the Recordset object to be duplicated.

LockType   Optional. A LockTypeEnum value that specifies either the lock type of the original Recordset, or a read-only Recordset. Valid values are adLockUnspecified or adLockReadOnly.

Remarks

Use the Clone method to create multiple, duplicate Recordset objects, particularly if you want to maintain more than one current record in a given set of records. Using the Clone method is more efficient than creating and opening a new Recordset object with the same definition as the original.

The current record of a newly created clone is set to the first record.

Changes you make to one Recordset object are visible in all of its clones regardless of cursor type. However, after you execute Requery on the original Recordset, the clones will no longer be synchronized to the original.

Closing the original Recordset does not close its copies, nor does closing a copy close the original or any of the other copies.

You can only clone a Recordset object that supports bookmarks. Bookmark values are interchangeable; that is, a bookmark reference from one Recordset object refers to the same record in any of its clones.