Querying Recordset

K

kdw

Is is possible to do a query on a recordset? I am accessing an Access DB with ADO connection, but the complexity of the query makes running the same query multiple times very costly. I would like to run the query against the database as few times as possible and then extract subsets by querying against the returned recordset.

Is this possible? I have done some researching but haven't found any posted answers. As I have seen very good tips here before, so I am hoping someone should have an answer.

Thanks in advance!
 
C

Chad DeMeyer

You probably want to use something like the GetRows method. For more
information to get you started, please see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthgetrows.asp

Regards,
Chad DeMeyer


kdw said:
Is is possible to do a query on a recordset? I am accessing an Access DB
with ADO connection, but the complexity of the query makes running the same
query multiple times very costly. I would like to run the query against the
database as few times as possible and then extract subsets by querying
against the returned recordset.
Is this possible? I have done some researching but haven't found any
posted answers. As I have seen very good tips here before, so I am hoping
someone should have an answer.
 
K

kdw

Thanks for the reply. However, my understanding is that the GetRows method doesn't allow me to specify any criteria. Is that not correct? Or would you suggest dumping the data in an array and then querying against it?
What I want to do is, let say, get all the customers who has orders in 2004 from a database, and then pinpoint those customers who may have ordered Product1, etc. My problem is that the first query is much more complicated than just Year so it take a long time to return an answer. Is there a better way to get around querying the database directly hundreds of times within a few minutes?

Thanks.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?a2R3?=,
Is is possible to do a query on a recordset? I am accessing an Access DB with ADO
connection, but the complexity of the query makes running the same query multiple times
very costly. I would like to run the query against the database as few times as possible
and then extract subsets by querying against the returned recordset.How about using a Filter? Extract from an article on Technet ("Working with the Data
Access Components of an Office Solution"):

"In ADO, the Filter property applies directly to the Recordset object on which you set the
filter. The ADO Filter property allows you to create a temporary view that can be used to
locate a particular record or set of records within the current Recordset object. When a
filter is applied to the current Recordset object, the RecordCount property reflects just
the number of records available after you apply the filter. The filter can be removed by
setting the Filter property to adFilterNone. "

Note that the data.ado newsgroup would probably be the better place to get answers
concerning ADO.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top