continued: multiple selections in a list-box

T

The_answer_is_42

There was a thread started on 9/15 about this (see below) where a list box
with multiple selections would be dropped into a text field separated by by
commas (or whatever you want).

The corrolary to this then is: now that I've got a text / memo item filled
with multiple values, how do I extract that back to the list-box if the form
is opened up later to that record.

Secondarily, is there a way to pull each of the values from the list box and
have it populate a different table that has the record number and choice.
For example, the main form (tbl_main) has you choose three or more items from
a list (tbl_list). that record is linked to another table (tbl_choices) that
will have 3 entries like:

1 tbl_main_042 Choice1
2 tbl_main_042 Choice2
....
7 tbl_main_044 Choice 1
....

If you can do that, how, and how do you get back to where the list-box shows
the selections when you come back later?

TIA,
answer_is_42
9/15/07 - Making multiple list selections in a drop-down list / menu
Help! I am trying to create a drop-down list from which a user can make more
two or more selections, both which will appear in the "response box." For
example, I want to create a box that askes the user to "Choose ALL that
apply." The user then has the option of highlighting two or more items in the
drop-down list by holding down the "Control" or "Shift" key. Once the user
has made his/her selections, and hits "Enter," the selections appear in the
response/answer box.

Any assistance will be appreciated.

A Drop-down list?
A control that drops down is a combo box.
A combo box is limited to 1 selection.

You can use a List box control (which does not drop down).
Set it's MultiSelect property to either Simple or Extended.

You then need code to extract the selected items.

Dim varItem as Variant
Dim strResult as String
For Each varItem In ListBoxName.ItemsSelected
strResult = strResult & Me!ListBoxName.ItemData(varItem) & ", "
Next varItem
strResult = Left(strResult, Len(strResult) - 2)
[SomeControl] = strResult

This should result in a strResult variable that looks like:
Joe, Steve, Anne, Mary, John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top