Skip Navigational Links
LISTSERV email list manager
LISTSERV - PEACH.EASE.LSOFT.COM
LISTSERV Menu
Log In
Log In
LISTSERV 17.5 Help - VISBAS-BEGINNERS Archives
LISTSERV Archives
LISTSERV Archives
Search Archives
Search Archives
Register
Register
Log In
Log In

VISBAS-BEGINNERS Archives

Visual Basic Beginner's List

VISBAS-BEGINNERS@PEACH.EASE.LSOFT.COM

Menu
LISTSERV Archives LISTSERV Archives
VISBAS-BEGINNERS Home VISBAS-BEGINNERS Home

Log In Log In
Register Register

Subscribe or Unsubscribe Subscribe or Unsubscribe

Search Archives Search Archives
Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
Re: VB6 ADO Record Sort
From:
John Warner <[log in to unmask]>
Reply To:
Visual Basic Beginner's List <[log in to unmask]>
Date:
Sat, 29 Mar 2008 06:23:48 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (89 lines)
<Quote>
The Sort property A recordset Sort property can affect the results of both
the Find and Move methods. This property designates one or more fields
that can determine the order in which rows display. The Sort property
setting allows the designation of an ascending or descending order for any
field. The default is ascending order. The Sort property settings do not
physically rearrange the rows-they merely determine the order in which a
recordset makes its rows available.
</Quote>

John Warner
> 
> Date:    Fri, 28 Mar 2008 11:50:33 -0400
> From:    Robert Gillespie <[log in to unmask]>
> Subject: VB6 ADO Record Sort
> 
> My question is why does a record sort on a field where the value is the
s=
> ame=20
> for all records change the order that the records were inserted?  The
fol=
> lowing=20
> is an example of the code and results:
> 
> Option Explicit
> Public grsParetoOrg As New ADODB.Recordset
> 
> Private Sub CreateParetoOrgRs()
>   Dim ErrorTitle    As String
>   Dim ErrorText     As String
> =20=20=20=20
>   ErrorTitle =3D "FISPE - CreateParetoOrgRs"
>   On Error GoTo ErrorHandler
> =20=20=20=20
>   '  Create the Rejects recordset
>   Set grsParetoOrg =3D New ADODB.Recordset
>   With grsParetoOrg.Fields
>     .Append "MachineId", adBSTR
>     .Append "StationId", adBSTR
>     .Append "MachineName", adBSTR
>     .Append "Avail", adDouble
>   End With
>   grsParetoOrg.Open
> 
>   Exit Sub
> ErrorHandler:
>  End Sub
> 
> Private Sub Form_Load()
>   Dim x As Integer
> 
>   Call CreateParetoOrgRs 'Create original Pareto record set
> =20=20
>   For x =3D 0 To 2
>     grsParetoOrg.AddNew
>     grsParetoOrg("MachineName") =3D "A" & Str(x)
>     grsParetoOrg("Avail") =3D 10
>   Next x
> 
>   grsParetoOrg.MoveFirst
> =20=20
>   While Not grsParetoOrg.EOF
>    Debug.Print grsParetoOrg("MachineName")
>    grsParetoOrg.MoveNext
>   Wend
> =20=20=20=20
>   grsParetoOrg.Sort =3D "Avail DESC"
> 
>   While Not grsParetoOrg.EOF
>    Debug.Print grsParetoOrg("MachineName")
>    grsParetoOrg.MoveNext
>   Wend
> 
> End Sub
> A 0
> A 1
> A 2
> A 2
> A 1
> A 0

------------------------------------------------------------
- The VISBAS-BEGINNERS list is hosted on a Windows NT(TM) system
  running L-SOFT International's Listserv(R) software.
- The List Archive can be found at:
  http://peach.ease.lsoft.com/archives/visbas-beginners.html
- To unsubscribe from this list simply use this link:
  mailto:[log in to unmask]

ATOM RSS1 RSS2

PEACH.EASE.LSOFT.COM CataList Email List Search Powered by LISTSERV