Shaley
asked on
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.
rst2!Field1 = rst1!Field1
Thanks for your help.
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
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
ASKER
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.
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.
ASKER
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.
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.
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
for each field in rst1
rst2.addnew field.name
next
and then fill it with an other for each field in
ASKER
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.
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.
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help
dim field as new field
for each field in rst1.fields
.....
next