you don't need to use queries to sort - user can use the right click menu on a table, query or form or you can use the form order by and order by on load properties . Reports ignore any sorting done in a recordsource ahd you have to use the group by/sort by functionality provided by reports.
As far as your sample db is concerned, change the datatype from text to number
I don't want to go to a table and then right-click sort and sort
And I do not want to change the data type to a number. There are letters with numbers
I want to sort data with a button and a click
You can't give us sample data and not include pertinent examples. Can you provide a better sample set (with more representative data) and demonstrate how you want it to sort?
With your current example (no letters and numbers mixed) you could try
Code:
Private Sub ASC_Click()
Me.OrderBy = "val([number]) ASC"
Me.OrderByOn = True
End Sub
Private Sub Desc_Click()
Me.OrderBy = "val([number]) Desc"
Me.OrderByOn = True
End Sub
As said this could get much more complicated with a mix of letters and numbers.
Please tell us why you don't want to use a query since that is what every one of us would suggest because your data is in a recordset and queries are how you deal with recordsets. Think about what an in memory process using arrays would entail. Then think about how it would be displayed since it can't be displayed using the rows of the form. Start by looking up Bubble sort which is probably the simplest version of in memory sorting