INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How can I create a clone of a record set that is NOT in synch with the original?

How can I create a clone of a record set that is NOT in synch with the original?

How can I create a clone of a record set that is NOT in synch with the original?

(OP)
I need to clone or otherwise duplicate a record set of a sub-form. I need to be able to look at original values to see if any changes have been made.

RE: How can I create a clone of a record set that is NOT in synch with the original?

The form object has a built in recordset and recordsetclone properties.

RE: How can I create a clone of a record set that is NOT in synch with the original?

(OP)
That I know. The problem is that the recordset and the recordset clone tend to be pretty closely synchronized. I need a programmatic way of knowing if any field of a record has been changed in any way, and by how much.

RE: How can I create a clone of a record set that is NOT in synch with the original?

Not tested, just an idea here...

CODE

Dim intF As Integer

recOrgin.MoveFirst
recClone.MoveFirst

Do While Not recOrgin.EOF
    For intF = 1 To recOrgin.Fields.Count
        If recOrgin.Fields(intF).Value <> recClone.Fields(intF).Value Then
            'Do your magic here
        End If
    Next intF
    recOrgin.MoveNext
    recClone.MoveNext
Loop 

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: How can I create a clone of a record set that is NOT in synch with the original?

(OP)
You are thinking along the correct lines, but if I change an entry in the recordset it will be picked up by the recordset clone, on account of them being synchronized. What I need is to have a copy of the recordset that is NOT synchronized, so that the original data will still be available for comparison.

RE: How can I create a clone of a record set that is NOT in synch with the original?

As I pointed out in an earlier thread you need to institute logging. You are not going to get there from here with any native functionality. It is not that hard, and the example I provided contained the code. A clone will not work as pointed out. The recordsetclone is what is known as a shallow clone. A new object is created, but it contains pointers to all the "child objects". So it does not create a new fields collection of field objects but only holds a pointer to those fields. So both recordsets are pointing to the same fields no a copy of the fields.

You could write code to deep clone a recordset but it would have to be done using ADO disconnected recordsets. This would be extremely cumbersome and complicated I would think. Just institute basic logging and be done.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close