Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiselect Listbox Order And Click Event 1

Status
Not open for further replies.

waldemar

Programmer
Nov 15, 2001
245
DE
I am using a listbox to enable the user to select one or many entries via the multiselect option. The rowsource table contains a boolean value [blnSelected] that marks a record as either selected ot not selected. The question now is how to keep these two elements synchronized.

Stepping through all the records of the rowsource and settint the listbox.selected(currentrecord) to TRUE is no problem (happens on the current event of the form).

But two questions remain:
1. How do I know on which entry the user just clicked in the listbox?? Do I have to step through all rows and compare the selection with the table? Or is there some property like "the just clicked row"?
2. How do I reorder the listbox entries? I have several buttons above the listbox that should reorder the rowsource. In a continious form these buttons modified the OrderBy property of that form. However the listbox doesnt have such a property. Do I really have to append an "ORDER BY" to the rowsource sql?

Thanks in advance
waldemar
 
Use this code to update every selected item on the list.

Code:
Dim varItem
With lstListBox
    For Each varItem In .ItemsSelected
    #### SET BOOLEAN VALUE HERE ####
    Next varItem
End With

I have never seen a way to reorder a listbox other than in the SQL.

Hope that helps a bit.

Sim ----------------------------------------
Of all the things I have lost in my life, the thing I miss the MOST is my mind!
----------------------------------------
 
Thank you Mute101,

I went back to using an endless (continous?) form because I need an extra filter (like the filter property of forms) and orderby.

The code seeems perfect, I guess I will use it at some other points in the application. Thanks a lot!

Regards
waldemar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top