Select More Than One Item from a List Box

  • Thread starter Thread starter JZ
  • Start date Start date
J

JZ

I would like the user to be able to select more than one
item from a list box. How do I make this happen on a form?

Thank you for your advice,

JZ
 
Set the list box's MultiSelect property to Simple (if you just want the user
to click items on or off) or Extended (if you want them to be able to
Shift+Click a range of values, and Ctrl+Click items on/off).

Do not use this to store values in a table. Multiple values belong in a
*related* table, and a subform is the appropriate interface.

If you are trying to use with an unbound listbox to offer the user the
choice of multiple criteria, you will need to write code to loop through the
ItemsSelected collection of the listbox to build up a string to use with the
IN list in a WHERE clause of a SQL statement.
 
Allen - thanks for the info! This brings up another issue for me

"Do not use this to store values in a table. Multiple values belong in a *related* table, and a subform is the appropriate interface.

So I need to make another table that has all the values I want - relate it to my main table and then make a subform for this?


----- Allen Browne wrote: ----

Set the list box's MultiSelect property to Simple (if you just want the use
to click items on or off) or Extended (if you want them to be able t
Shift+Click a range of values, and Ctrl+Click items on/off)

Do not use this to store values in a table. Multiple values belong in
*related* table, and a subform is the appropriate interface

If you are trying to use with an unbound listbox to offer the user th
choice of multiple criteria, you will need to write code to loop through th
ItemsSelected collection of the listbox to build up a string to use with th
IN list in a WHERE clause of a SQL statement
 
Yes.

Typically this new table has a foreign key to the existing one, and a
foreign key to another one. For example, to store people's choices in music
you would need:
- a Music table (one record for each type of music);
- a People table (one record for each person);
- a PeopleMusic table (one record for each combination of person + music).

The form you use for People has a subform bound to PeopleMusic.
The subform has a combo box (choices from Music table).
For the person in the main form, add as many rows as you need to cover all
their tastes in music.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

John Lute said:
Allen - thanks for the info! This brings up another issue for me:

"Do not use this to store values in a table. Multiple values belong in a
*related* table, and a subform is the appropriate interface."
So I need to make another table that has all the values I want - relate
it to my main table and then make a subform for this?
 
Thanks

----- Allen Browne wrote: ----

Yes

Typically this new table has a foreign key to the existing one, and
foreign key to another one. For example, to store people's choices in musi
you would need
- a Music table (one record for each type of music)
- a People table (one record for each person)
- a PeopleMusic table (one record for each combination of person + music)

The form you use for People has a subform bound to PeopleMusic
The subform has a combo box (choices from Music table)
For the person in the main form, add as many rows as you need to cover al
their tastes in music
 
Back
Top