How to pick an record in ADODB.recordset

FuzMic

DataBase Tinker
Local time
Today, 23:02
Joined
Sep 13, 2006
Messages
744
Hi gurus

This must be dead simple and yet i don't know

Lets say i have a adodb.recordset eg rsMy which is opened with 2 fields eg
rsMy.open "SELECT Fld1, Fld2 FROM tbl;", currentproject.connection,1,3,1

I want to assign a value to Fld2 eg "valt" for a record with value "Tgt" for Fld1. How do i do it without using rsMy.Find ...blah, blah..
 
Adjust the query in the Open command to just get the record you want.

But why not just use an Update Query?
 
Thanks mate, Update Query should be fast & easy

Adjust the query in the Open command to just get the record you want.

Would the "Adj Qry" be the similar to an Update Query or you can show how.

Essentially i have to pick up a few values in the recordset, add them together and assign to a target record. Thus i created a simple select recordset, pick the various values by finding. Finally the find the target record and assign the total to it Hence i thought using index to pick is neater than find.

Thanks always.
 
Last edited:
Would the "Adj Qry" be the similar to an Update Query or you can show how.

You would just put a Where clause in the Select query.

Essentially i have to pick up a few values in the recordset, add them together and assign to a target record.

"Add them" as in arithmetic? If so then use an aggregate query with a Where clause.

Thus i created a simple select recordset, pick the various values by finding. Finally the find the target record and assign the total to it Hence i thought using index to pick is neater than find.

Opening multiple recordsets with exactly the required records is orders of magnitude faster than finding records in a single more general recordset.
 
Thank you Sir, will follow your good suggestions. Have a good day!
 

Users who are viewing this thread

Back
Top Bottom