How to pick an record in ADODB.recordset (1 Viewer)

FuzMic

DataBase Tinker
Local time
Today, 19:36
Joined
Sep 13, 2006
Messages
719
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..
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 22:36
Joined
Jan 20, 2009
Messages
12,849
Adjust the query in the Open command to just get the record you want.

But why not just use an Update Query?
 

FuzMic

DataBase Tinker
Local time
Today, 19:36
Joined
Sep 13, 2006
Messages
719
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:

Galaxiom

Super Moderator
Staff member
Local time
Today, 22:36
Joined
Jan 20, 2009
Messages
12,849
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.
 

FuzMic

DataBase Tinker
Local time
Today, 19:36
Joined
Sep 13, 2006
Messages
719
Thank you Sir, will follow your good suggestions. Have a good day!
 

Users who are viewing this thread

Top Bottom