Sorting a memory-only recordset object

Results 1 to 2 of 2

Thread: Sorting a memory-only recordset object

  1. #1
    Join Date
    Dec 1969

    Default Sorting a memory-only recordset object

    I have a recordset object that I created w/out using a connection - a handy way to have the flex of a recordset object without having to connect to a database/table. In that recordset I&#039;ve stored some data that I want sorted. Since the data isn&#039;t stored in a database anywhere - just in memory - I have to use the Sort property of a recordset to sort the information. When i try to sort the recordset, I get an error saying <BR><BR>Wrong number of arguments or invalid property assignment: &#039;Sort&#039; <BR><BR><BR>Here&#039;s the short version of the code:<BR><BR>Dim oReport<BR>Set oReport = CreateObject("ADODB.RecordSet")<BR>&#039;Create blank recordset and set cursor location<BR>oReport.CursorLocation = 3<BR>oReport.Fields.Append "MachineID", 3<BR>strTableName = "TableDescription"<BR>intType = 8<BR>oReport.Fields.Append strTableName, intType<BR>strTableName = "TableData"<BR>intType = 8<BR>oReport.Fields.Append strTableName, intType<BR>&#039;Open the new record set<BR>oReport.Open<BR>...<BR>Add a bunch of new records<BR>...<BR>oReport.UpdateBatch<BR>oReport.S ort "MachineID ASC"<BR>oReport.MoveFirst<BR>While Not oReport.EOF<BR> Response.Write "Machine " & oReport("MachineID") & "&nbsp"<BR> Response.Write oReport("TableDescription") & "<BR>"<BR> Response.Write "&#060;table border = 1&#062;"<BR> Response.Write oReport("TableData")<BR> Response.Write "&#060;/table&#062;&#060;p&#062;"<BR> oReport.MoveNext<BR>Wend<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Sorting a memory-only recordset object

    It&#039;s because the "Sort property" is a PROPERTY, not a method. Currently you have:<BR><BR>oReport.Sort "MachineID ASC"<BR><BR>as if sort is a method taking in a string property. Rather, Sort is a PROPERTY, so you should say:<BR><BR>oReport.Sort = "MachineID ASC"<BR><BR>(note the equals sign)<BR><BR>hth

Posting Permissions

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