Sort listbox by clicking a control

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I have a listbox with several fields and would like the
end user to be able to sort the list by clicking a button
(e.g. DateButton, NameButton, CityButton, etc.).

Does anyone have a routine for this?
 
You could use code that would modify the Row Source property of the list
box. This property is basically a SQL statement that includes an Order By.
 
Duane,

Thanks. I searched links that I found on this newsgroup and found a sample that works. One thing that I had to 'figure out' was that the Row Source was a query and while it was a query the code was not working. Once I looked at the query in SQL view, copied the SQL and pasted it into the Properties/Row Source for the listbox, then the code worked.

The other thing I had to do was break up concantenated fields into separate fields (e.g. from InstallerName to InstallerFirstName and InstallerLastName). I believe that the separation should only be necessary if you wish to sort by one or the other. What do I have to do to sort by a concatenated string in the listbox - or is it even possible?

Thanks in advance for you help...

----- Duane Hookom wrote: -----

You could use code that would modify the Row Source property of the list
box. This property is basically a SQL statement that includes an Order By.
 
Back
Top