Re: Sorting recordsets




"Griff" <Howling@xxxxxxxx> wrote in message
news:%23Amz2anyFHA.4032@xxxxxxxxxxxxxxxxxxxxxxx
>I create an empty recordset:
>
> ' Create an empty recordset for the results
> set oRSResults = CreateObject("ADODB.Recordset")
> ' Define it's structure
> with oRSResults
> With .Fields
> .Append "firstName", adVarChar, 150
> .Append "lastName", adVarChar, 150
> .Append "orderCount", adBigInt
> .Append "accountCount", adBigInt
> .Append "firstOrderDate", adDate
> .Append "latestOrderDate", adDate
> .Append "firstUpdateDate", adDate
> .Append "latestUpdateDate", adDate
> End With
> .Open
> end with
>
> I populate it with rows.
>
> I then attempt to sort it using:
> oRSResults.sort = "len(firstName) desc"
>
> And this errors telling me that the item can not be found in the
> collection. However, I can sort it using "firstName desc" and this works
> fine.
>
> The recordset has state = 1 and recordCount > 0. Interestingly though,
> using VB6's LOCALS window, when I expand the FIELDS property it shows a
> Count value of 8 (which is expected), but not the properties of any of the
> 8 fields.

You would need to add a separate field for the length, and populate it when
you populate the rest of the fields, ADO's internal client-side provider
does not support use of VBA functions in expressions.

-Mark



> Any ideas?
>
> Thanks, Griff
>


.



Relevant Pages

  • Sorting recordsets
    ... ' Create an empty recordset for the results ... set oRSResults = CreateObject ... .Append "accountCount", adBigInt ... .Append "latestOrderDate", adDate ...
    (microsoft.public.data.ado)
  • Re: Extract same text from file.
    ... Ryan Keeling wrote: ... > I have the following text file which I want to use to populate text ... a filename from fields 8 and 9 to append the current line to. ...
    (comp.lang.perl.misc)
  • Re: Access 2000 Appending records to a table
    ... So I would like to append the record with the data that is available at ... fields just to populate the blanks, ... around this process of adding bogus data just to poplate the fields so the ... append query works? ...
    (microsoft.public.access.security)
  • RE: Populating a table when a new record is entered in a form
    ... The user should populate four fields at which time when a ... > combo is populated it should trigger the After Update and run an append query ... Prev by Date: ...
    (microsoft.public.access.forms)
  • Re: WHERE 1=2 with performance nightmares
    ... this to get an "initialized" empty recordset which we can append ... You can combine the two to guarantee an empty result set without the ... Delphi/InterBase Weblog: http://blogs.teamb.com/craigstuntz ...
    (borland.public.delphi.non-technical)