Thank you, Sandra. This seem to work well with an error
For example, if I select A,B,D,E in the first record,
EVERY OTHER record retains that selection. Any way to
clear this? Also give a compile error where there is an
invalid use of Null (last line of code)
I am not sure what kind of information you would need
about the table; the goal is for somebody to look at this
field and make a decision about that record.
Out of curiosity, is there any way to display the list box
horizontal vs. vertical (running out of room !!)
-----Original Message-----
Sorry - hit send too soon -
You have to write some code to do this. For example, the following
will take the selected items from list0 and string them together
in a textbox:
Dim varItem As Variant
With Me.List0
For Each varItem In .ItemsSelected
Me.MyText = Me.MyText & .ItemData(varItem) & ", "
Next varItem
End With
Me.MyText = Left(Me.MyText, Len(Me.MyText) - 2)
To get the value from the second column you could modify this to:
Dim varItem As Variant
With Me.List0
For Each varItem In .ItemsSelected
Me.Text5 = Me.Text5 & .Column(1, varItem) & ", "
Next varItem
End With
Me.Text5 = Left(Me.Text5, Len(Me.Text5) - 2)
Now, having said all this I'd suggest not aggregating values into a
single string like this. It's not normalized and eventually, you
are going to need to break that string appart to make use of the
data in it. You would really be better off creating a new row in a
related table for each selection. Give more information about your
table if you'd like some help doing this. The concept is the same
- you loop through the ItemsSelected collection and instead of
building a string, you insert records in a table.
--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.
Luther wrote:
Hello everyone,
How can I get a list box multiple selections to store in
the underlying table; I have it's Control Source set to a
field named "SOURCE" in the table, but when I test it by
selecting 2 or 3 items, nothing happens !!! I would like
the table to show something like A;B;C;D in that field.
Any help would be appreciated.
Thanks.
.