Listbox - selected property?

MaximusArcher

Registered User.
Local time
Today, 09:10
Joined
Apr 7, 2005
Messages
15
I've a listbox control on a form which has a sql query as the row source.
The query returns 3 columns, ID, Name and value from TableA.

A user multi-selects items from the listbox and can then click to save their selections; this inserts the selected information into another table - TableB.

TableB contains information relating to the users' selections, specifically, the tablename and row ID relating to the listbox selections. In this example, a single row would contain TableA (the table from which the selection originates from) and a rowID (relating to the the RowID in TableA of the selection.)

TableB can store as many or as little selections from the listbox.

When opening the form, I would like to set the listbox selections according to the saved data in TableB.

However, the selected property of a listbox "selects" the item based on its relative position in the list, i.e. ListBox.Selected(4) = True, selects the fourth item in the list.

How can I instead select the item by using the ID from the TableB?
psuedo - ListBox.Selected(where listbox.rowsource.ID= TableB.ID)

cheers,
Matt.
 
Last edited:
Problem solved.

I added an extra column in TableB to hold the relative position in the listbox.
 

Users who are viewing this thread

Back
Top Bottom