Select Multiple Values in one Combo Box?

P

Paul

Developing a database and I want the ability to select multiple values in a
combo box and store them. I tried using the multiple option in properties of
course, but it forgets which values are selected once you move to the next
record. Anyone know how to do this?
 
V

Van T. Dinh

Use ListBox with Multi-Select Property set to Simple or Extended.

See Access Help on Multi-Select ListBox.
 
S

Sandra Daigle

Hi Paul,

Using a combo box you can only select one value. You are probably talking
about a listbox which does allow for multiple selections. Multiselect
listboxes can not be bound to a field.

Regardless of how you want to use the data selected, you have to write code
to make it happen.

It sounds like you want to concatenate the values into one aggregate value.
This is rarely a good idea for data storage since it is not normalized (read
up on normalization for more on this). Regardless, here's some sample code
that will do it (this uses the selected values from the second column of the
listbox and strings them into a control named text10):

Dim varItem As Variant
Me.Text10 = Null
For Each varItem In Me.lstMyList.ItemsSelected
Me.Text10 = Me.Text10 & Me.lstMyList.Column(1, varItem) & ","
Next varItem
Me.Text10 = Left(Me.Text10, Len(Me.Text10) - 1)

Instead, it would be better to have a related table into which you add one
record for each selected value from your list. The code is similar but uses
DAO to create new records. Post back if you are interested in sample code
for this.
 
F

fredg

Developing a database and I want the ability to select multiple values in a
combo box and store them. I tried using the multiple option in properties of
course, but it forgets which values are selected once you move to the next
record. Anyone know how to do this?

Multiple selections is not supported by Combo Boxes.
Use a List Box with it's MultiSelect property set to simple or
extended.
Read Access Help.
 
Top