Sub SortRecordset()
Dim intCounter As Integer
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorLocation = adUseClient
rst.Open "Select * from Employees"
Debug.Print "NOT Sorted!!!"
Do Until rst.EOF
Debug.Print rst("EmployeeID")
rst.MoveNext
Loop
Debug.Print "Now Sorted!!!"
rst.Sort = "[EmployeeID]"
Do Until rst.EOF
Debug.Print rst("EmployeeID")
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
|