I have a listbox (lstResult) which rowsource is q query (qryResult). In the listbox are 3 columns.
On the same form is a combobox, where the entries are "Column1", "Column2" and "Column3", and a checkbox (chkSort).
What I'm looking for is some code where I can sort the columns in the listbox, using the combobbox and the checkbox.
If I e.g. choose "Column1" in the combobox, then the listbox should be sorted after Column1. And so on when chosing "column2" and "column3" in the combobox. Columns should be sorted ascending by default. If the checkbox (chkSort) has the value 'True', the selected column should be sorted descending in stead.
I believe that a Select .... Case statement must be used, but I'm not quite sure about how the code should be:
-----------------------------------------------------
CODE:
Private Sub cboSort_AfterUpdate()
Select Case Me.cboSort
Case 1
Me.lstResult. ?????????
If chkSort = "True" Then
Something with sorting ascending/descending.
Case 2
Case 3
End Select
End Sub
----------------------------------------------------
I hope someone can assist.
Thanks.
/Anders
On the same form is a combobox, where the entries are "Column1", "Column2" and "Column3", and a checkbox (chkSort).
What I'm looking for is some code where I can sort the columns in the listbox, using the combobbox and the checkbox.
If I e.g. choose "Column1" in the combobox, then the listbox should be sorted after Column1. And so on when chosing "column2" and "column3" in the combobox. Columns should be sorted ascending by default. If the checkbox (chkSort) has the value 'True', the selected column should be sorted descending in stead.
I believe that a Select .... Case statement must be used, but I'm not quite sure about how the code should be:
-----------------------------------------------------
CODE:
Private Sub cboSort_AfterUpdate()
Select Case Me.cboSort
Case 1
Me.lstResult. ?????????
If chkSort = "True" Then
Something with sorting ascending/descending.
Case 2
Case 3
End Select
End Sub
----------------------------------------------------
I hope someone can assist.
Thanks.
/Anders