Using Access 2000, I did the following:
Created a table with:
Date
Name
Number
Created a form with a listbox (List0) and a combobox (Combo2). The combobox was populated with manually entered data of Date, Name, and Number. The listbox was populated from the table.
Using the afterupdate event for the combobox, I entered the following code:
' *************** Start Code ****************
Select Case Combo2.Value
Case "Date"
List0.RowSource = "SELECT Table1.Id, Table1.Date, Table1.Name, Table1.Number FROM Table1 ORDER BY Table1.Date;"
Case "Name"
List0.RowSource = "SELECT Table1.Id, Table1.Date, Table1.Name, Table1.Number FROM Table1 ORDER BY Table1.Name;"
Case "Number"
List0.RowSource = "SELECT Table1.Id, Table1.Date, Table1.Name, Table1.Number FROM Table1 ORDER BY Table1.Number;"
End Select
List0.Requery
' *************** End Code *****************
Then I tested it. By selecting the appropriate field from the combobox, the listbox was resorted...
I can send an example db if you need it. Just send me an e-mail and I will forward you.
Hope this gets you where you want to be... Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Albert Einstein)
Robert L. Johnson III, MCSA, Network+, A+
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com