Discussion Locked

Recordsets cloning in Visual Basic 6.0

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am using a recordset with the filter condition. Now if I try to clone that particular recordset, the cloned recordset also contains records not satisfied by the filter condition. How do I clone the recordset which will give me only the filtered record(s)?

1 reply

by nikki96

You can't. Clone creates a POINTER to the original recordset by design. Filters do not affect the DB, so they don't affect the cloned RS. You need to re-apply the filter. Or don't clone the filtered recordset and duplicate it instead.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthclone.asp
(remove spaces from URL, if any)

"The Filter property of the original Recordset, if any, will not be applied to the clone. Set the Filter property of the new Recordset in order to filter the results. The simplest way to copy any existing Filter value is to assign it directly, like this: rsNew.Filter = rsOriginal.Filter"

This discussion is closed to new replies.