Sorting Contents of Listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have 2 option groups where based on the selection of each option group, a
certain number of courses will display in the listbox. By default, the
display is sorted by Course Code. I want to add another option group of
toggle type so that I can display the listbox sorted by Course Code or Course
Number.

In other words, I have already made the selection in the earlier option
groups and the output is displayed in the listbox sorted by Course Code. I
want to add a button so that on clicking it, the contents will re-sort itself
by Course Number. Can this be done without having to resort to SELECT
statements again? Thanks.
ck
 
Hi,
I have 2 option groups where based on the selection of each option group, a
certain number of courses will display in the listbox. By default, the
display is sorted by Course Code. I want to add another option group of
toggle type so that I can display the listbox sorted by Course Code or Course
Number.

In other words, I have already made the selection in the earlier option
groups and the output is displayed in the listbox sorted by Course Code. I
want to add a button so that on clicking it, the contents will re-sort itself
by Course Number. Can this be done without having to resort to SELECT
statements again? Thanks.
ck

You'll have to use a different Select statement in the rowsource of
the list box each time you wish to re-sort.

Add a toggle button (caption "CourseCode" to the form:

If Me!ToggleName.Caption = "CourseCode" then Then
ListBoxName.Rowsource = "Select TableName.* from TableName Order
By TableName.CourseCode;"
Me!ToggleName.Caption = "CourseNumber"
Else
ListBoxName.Rowsource = "Select TableName.* from TableName Order
By TableName.CourseNumber;"
Me!ToggleName.Caption = "CourseCode"
End If
 
Back
Top