Single record from ADO recordset

Hi. I want to take a given record (in this case the last record) from an ADO recordset and put it into another recordset.  Is there any easy way of doing it other than:-

rst2!Field1 = rst1!Field1

Thanks for your help.

ShaleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BennyBunnyCommented:
you may do

dim field as new field

for each field in rst1.fields

 .....
next
0
BennyBunnyCommented:
because der is no "Record" object on ADO u may try
if the recordsets have the same field names...u can something like this:

For each field in rst1.fields
     rst2.field(field) = field(FIELDNAME).Value
next
0
ShaleyAuthor Commented:
The recordset I am copying to is set to "Nothing".  I just want to take one record out of the recordset and use that to create a new recordset.

Therefore I do not want to have to create all the field details for the recordset.  I could just delete all records apart from the last but I was hoping there was a more efficient way of doing it.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ShaleyAuthor Commented:
The recordset I am copying to is set to "Nothing".  I just want to take one record out of the recordset and use that to create a new recordset.

Therefore I do not want to have to create all the field details for the recordset.  I could just delete all records apart from the last but I was hoping there was a more efficient way of doing it.
0
BennyBunnyCommented:
ok in that case try to add the fields with the add method

for each field in rst1
  rst2.addnew field.name
next
and then fill it with an other for each field in

0
ShaleyAuthor Commented:
Your code as it stands won't work but I can modify it so it can, but again it's not quite what I'm really after.  

What you are suggesting will probably not be any more efficient than deleting all but the record I want - especially as the recordset being returned will be a maximum of 10 records.
0
BennyBunnyCommented:
yea but as i said there is no record object on ADO
so u have to add manually
but maybe u can do it in one for each next
like
for each field in rst1.fields
  rst2.addnew field.name,field.value
next

0
BennyBunnyCommented:
yea but as i said there is no record object on ADO
so u have to add manually
but maybe u can do it in one for each next
like
for each field in rst1.fields
  rst2.addnew field.name,field.value
next



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShaleyAuthor Commented:
Thanks for your help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.