Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you sort an array in Access?

Status
Not open for further replies.

BlindPete

Programmer
Jul 5, 2000
711
US
Is there a function or quick-n-dirty routine for sorting an array?

...Or does anyone know how to control the order of objects when enumerating using FOR EACH loop?

Answer to either would solve my problem.


-Pete
 
Well since you are in Access and it handles recordsets so well just put it in a table.
then you can sort the table or whatever.

----------------- here is a sample -----------

Dim db As Database, rst As Recordset, SQL As String
Dim A As Integer
Set db = CurrentDb
' SQL string.
SQL = "SELECT * FROM YourTable WHERE yourfield = SomeValue Order by yourfield"
Set rst = db.OpenRecordset(SQL)
rst.MoveLast
rst.MoveFirst

For A = 1 To rst.RecordCount
'do whatever here
Next

rst.Close
db.Close






DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
You could also look up [Sort | Sorting] in the search. There was a recent rather exhaustive 'tutorial' posted by one of hte tip-masters. Excellent expliniation(s) which went along with several example routines for various categories/type of sorts. Missed my favorite for industrial strength needs (the heap sort), but very well done.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Unfortately Doug the info is a collection and not table based.

I look more in forum

thanxs
-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top