• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Is it possible to query a disconnected recordset?

I have created and populated two disconnected ADO recordsets.  I would like to query them and produce a third recordset.  (This is temporary data, so saving it to SQL is just extra overhead).  Is this even possible?
1 Solution
Well Fred,
Depending on the numbers of records that your talking about you could cycle through your recordsets and apply your logical criteria to them as you go.  Then when something matched your criteria/query you could put that record into an array for later use.  To cycle through the records use logic to the effect of:
Do until Rec.EOF=True
'See if record matches criteria
If its too many records this may not be a desireable approach though.  Anyway just an idea.
bfredricksonAuthor Commented:
Records range from 200 to 750,000.  I'm hoping for a SQL type statement like: rDisconnRS3.Open "SELECT * FROM rDisconnRS1"
No its not possible to query a recordset. This is becuase when you run a SQL query the result returned by the server is a resultset (recordset). So recordset is a result of a query and its not possible to query it. However, you can use Filter property to achieve what you want. According to MSDN: "Filtering involves identifying all the records in a Recordset that meet a specified criteria. Although it might sound similar to finding records or fetching records, it is not. To fetch the records we use the SQL query and filtering is performed on the records already fetched i.e it comes after the SQL query has been used."
This is how we use Filter property:
NameOfTheRecordSet.Filter = Criteria
The criteria string has following format:
FieldName Operator Value (for example, "LastName = 'Smith'").
You can also create compound clauses by concatenating individual clauses with 'AND' 'Or' keywords. For example:
"LastName = 'Smith' AND FirstName = 'John'") OR (for example, "LastName = 'Smith' OR Age > 20").
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
Moderator, my recommended disposition is:

    Accept Sethi's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now