ADODB Object
 
Syntax
 
Set recordsetobject_clone = recordsetobject.Clone([LockType])
 
Description
Creates a duplicate copy of a Recordset object by copying an existing Recordset object.
 
The Clone method allows you to create multiple copies, one at a time, of an existing Recordset object. In essence, this allows you to have two or more copies of a Recordset open for editing at the same time, unless you make the clones read-only.
 
You do not actually make another physical copy which would require memory, but rather, you create a second (or third, etc.) pointer to the same Recordset. Since there is only one set of data, any changes made using either the original Recordset or one of the clones will be visible in the original and all clones. However, if you execute a Requery, you will lose synchronization.
 
The provider, and hence the Recordset object, must support bookmarks or you cannot successfully create clones. You can use the same bookmark to find the same record in both the original and all clones. The current record is automatically set to the first record in a newly created clone. You must separately close the original and each clone.
 
There is one optional parameter.
 
Parameter
Description
LockType
The optional LockType parameter is one of two possible LockTypeEnum constants. Note that there are actually five types of LockTypeEnum constants, but this method only recognizes two.
 
 
LockTypeEnum Constants 
 
Constant
Value
Description
adLockReadOnly
1
The records in the clone are read-only and cannot be changed
adLockUnspecified
-1
The clone inherits the lock type of the original
See Also
Example
 
If objRecordset.Supports(adBookmark) = True Then
   Set objRecordsetClone = objRecordset.Clone(adLockReadOnly)
End If