I have a problem with a listbox.
Sorry for the large text, but I wanted to be so clear as possible.
Hope anybody has the courage to read it through and can give me an answer.
Thanks in advance.
I have a listbox based on a table (names of people).
Now I want to move some of the items to an other listbox by double-clicking.
The people in the second listbox are used for adding to a table. (courses)
For example listbox1 contains 100 people.
I select a course from a combobox and move 50 people to listbox2 (by double-clicking them in listbox1).
Pressing a button will add all the users of listbox2 to a table.
This all works fine, except I invented some gadgets.
All the people belong to a group.
To avoid searching 50 people from the list manually I put some checkboxes beneath the listbox. (group1 / group2 /group3)
Selecting one or more checkboxes will filter all the names till only those who belong to the selected groups are shown in listbox1.
Now the list of available people in listbox 1 is reduced so it's easier to select them and to move them to listbox2.
Problem is that for example I moved all the people from group1 to listbox 2, and I select checkbox 'Group1' again, the users appear again in listbox1. If I move them again to listbox2 and press the 'add'-button, every user is added twice to the table.
Enabling the checkbox is not an option because it's not necessary to select all the people from that group.
Let's say group1 contains 15 people. Selecting checkbox 'group1' displays 15 names instead of the 100 original ones.
I move 10 of them to listbox2.
Then I select checkbox 'group2' and do the same thing.
Now I have to be able to select checkbox 'group1' again. It has to show the 5 names which are not moved yet in the previous session.
So I thought of making a copy of my original people-table using a recordset or collection or I don't know what else is possible, to use as the rowsource of my listbox.
Let's suppose it's possible by using a collection.
Everytime I move a person from listbox1 to listbox2 I remove the person from the collection.
Everytime I move a person from listbox2 to listbox1 I add the name to the collection again.
So it's not longer possible to select a person twice, because once selected, they're removed from the collection.
My question is : what do I need to make a copy of my table?
It has to be something I can use as a rowsource for my listbox.
It has to be something I can query using my checkboxes.
Perhaps I can use a table as a copy, but I don't know if it makes sense, because I have to delete and add records very often (what about performance)