Clone

This method duplicates a recordset.

Syntax

recordset.Clone

Remarks

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

ADOCE sets the current record of a newly created clone to the first record.

Changes that you make to one Recordset object are visible in all its clones regardless of cursor type.

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

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

Example

The following code example shows how to duplicate a recordset using the Clone method.

Dim rs1, rs2, f
Set rs1 = CreateObject("adoce.recordset")
rs1.open "MSysTables"
Set f = rs1.Fields(0)
Msgbox f.Value, ,f.Name
Set rs2 = rs1.Clone
Set f = rs2.Fields(0)
Msgbox f.Value, ,f.Name