Results 1 to 2 of 2

Thread: sort recordset

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    77

    sort recordset

    its not exactly database, but is manipulating an ado recordset.
    i create a rs, populate it and never save it to db, it is used for work only.
    after populating it i want to sort it but the sort isn't working
    the debugger doesn't complain about the sort stmt but it doesn't sort it???
    would it be easier/more expedient to try and open it ordering it?
    Code:
    rs1.CursorLocation = adUseClient
       Set rs1 = New ADODB.Recordset
       With rs1.Fields
          .Append "url", adChar, 50
          .Append "periods1-5", adDouble
          .Append "periods2-6", adDouble
          .Append "periods3-7", adDouble
          .Append "reach", adInteger
       End With
       rs1.Open
    ++later in program+++
                   With rs1
                      .AddNew
                      ![url] = rs.Fields(rs.Fields.Count - rs.Fields.Count).Value
                      ![periods1-5] = calc1Value
                      ![periods2-6] = calc2Value
                      ![periods3-7] = calc3Value
                      ![reach] = rs.Fields(rs.Fields.Count - 1).Value
                      .Update
                   End With
    ++later in program+++
       rs1.Sort = "periods1-5"
       rs1.MoveFirst
       Do Until rs1.EOF
          Debug.Print (rs1.Fields(rs1.Fields.Count - rs1.Fields.Count).Value)
          etc

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: sort recordset

    try
    rs1.Sort = "[periods1-5]"

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width