Sub OrderByX()
Dim dbs As Database, rst As Recordset
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase("Northwind.mdb")
' Select the last name and first name values from
' the Employees table, and sort them in descending
' order.
Set rst = dbs.OpenRecordset("SELECT LastName, " _
& "FirstName FROM Employees " _
& "ORDER BY LastName DESC;")
' Populate the Recordset.
rst.MoveLast
' Call EnumFields to print recordset contents.
EnumFields rst, 12
dbs.Close
End Sub
让ACCESS表 任意字段排序的VBA代码