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.
LockTypeEnum Constants
| |||||||||||||
See Also
| ||||||||||||||
Example
| If objRecordset.Supports(adBookmark) = True Then
Set objRecordsetClone = objRecordset.Clone(adLockReadOnly)
End If
|