Hello,
I use this code to populate data from a table into a listbox.
The problem is that I have a column containing the following data:
E 1, E 2, E 10, A 1, A 3, A 10 ect.....
When I put my sort order on this column I would like to see:
A 1, A 3, A 10, E 1, E 2, E 10 ect...
But I see:
A 1, A 10, A 3, E 1, E 10, E 2 ect...
How can I modify the sort order in order to make this work?
Thanks in advance.
I use this code to populate data from a table into a listbox.
Code:
Public Sub PullData()
'Purpose: to refresh the contents of the list box based on the text entered into the TxtCriteria control
On Error Resume Next
Dim StrSql As String 'SQL statement for the record source
sText = Trim(Me.TextSearchString.Text)
StrSql = "SELECT * FROM TblChemicals "
'Is there any text to test?
'If Not sText = "" And IsDelOrBack = False Then
StrSql = StrSql & "WHERE " & Me.ComboCat.Column(1) & " Like '" & "*" & sText & "*" & "*' ORDER BY " & Me.ComboFiltered.Column(1) & ";"
'Refresh the rowsource with the new SQL
Me.ListTest.RowSource = StrSql
'End If
'Requery the list box to show results
Me.ListTest.Requery
End Sub
E 1, E 2, E 10, A 1, A 3, A 10 ect.....
When I put my sort order on this column I would like to see:
A 1, A 3, A 10, E 1, E 2, E 10 ect...
But I see:
A 1, A 10, A 3, E 1, E 10, E 2 ect...
How can I modify the sort order in order to make this work?
Thanks in advance.
Last edited: