By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

Select multiple items from drop-down list

P: n/a
Hello all...

I am using Access 2002, and am trying to find a way for a user to be
able to select multiple entries from a drop-down list. I am hoping
that given a list as such:

a
b
c
d
e

the user could select a, c and d, and have the field be saved as
a;c;d.

Is something like this possible? It doesn't have to be a drop-down
list, but some mechanism for the user to just select the desired
options without having to resort to check boxes for each option that
could be available. If so, how would I do the searching for queries,
ie, be able to select this record when searching for a, c or d.

Thanks in advance!
Therese
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Therese A. Sorna" <ta*****@yahoo.com> wrote in message
news:be**************************@posting.google.c om...
Hello all...

I am using Access 2002, and am trying to find a way for a user to be
able to select multiple entries from a drop-down list. I am hoping
that given a list as such:

a
b
c
d
e

the user could select a, c and d, and have the field be saved as
a;c;d.


This violates proper database design. Fields should store one and only one value.
If you need to associate multiple values with a record you should add another table
with a one-to-many relationship between the current table and the new one. Then you
can have as many associated records as you need and still have each value in its own
row/field.

--
*******************************
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
*******************************
Nov 12 '05 #2

P: n/a
Therese,

If that is what you really want to do, you can write code like

ValueToSave =""
For each i in DropDownList.selected
If ValueToSave <> "" then
ValueToSave = ValueToSave & ", "
End If
ValueToSave = ValueToSave & DropDownList.Column(1,i)
Next i

ValueToSave should be bound to the table item where you want to store the
list.

Hope this helps,

Gary

"Therese A. Sorna" <ta*****@yahoo.com> wrote in message
news:be**************************@posting.google.c om...
Hello all...

I am using Access 2002, and am trying to find a way for a user to be
able to select multiple entries from a drop-down list. I am hoping
that given a list as such:

a
b
c
d
e

the user could select a, c and d, and have the field be saved as
a;c;d.

Is something like this possible? It doesn't have to be a drop-down
list, but some mechanism for the user to just select the desired
options without having to resort to check boxes for each option that
could be available. If so, how would I do the searching for queries,
ie, be able to select this record when searching for a, c or d.

Thanks in advance!
Therese

Nov 12 '05 #3

P: n/a
ta*****@yahoo.com (Therese A. Sorna) wrote in message news:<be**************************@posting.google. com>...
Hello all...

I am using Access 2002, and am trying to find a way for a user to be
able to select multiple entries from a drop-down list. I am hoping
that given a list as such:

a
b
c
d
e

the user could select a, c and d, and have the field be saved as
a;c;d.

Is something like this possible? It doesn't have to be a drop-down
list, but some mechanism for the user to just select the desired
options without having to resort to check boxes for each option that
could be available. If so, how would I do the searching for queries,
ie, be able to select this record when searching for a, c or d.

Thanks in advance!
Therese

Are you planning on saving the selections somewhere? (in a table)? If
so, use a subform. If you're just using these for query criteria or
something, there's code on www.mvps.org/access that has code that does
that.
Nov 12 '05 #4

P: n/a
ta*****@yahoo.com (Therese A. Sorna) wrote in message news:<be**************************@posting.google. com>...
pi********@hotmail.com (Pieter Linden) wrote in message news:<bf**************************@posting.google. com>...

Are you planning on saving the selections somewhere? (in a table)? If
so, use a subform. If you're just using these for query criteria or
something, there's code on www.mvps.org/access that has code that does
that.


I am not really familiar with subforms, but that sounds like it is
what I need. How would I do that? I don't want to have multiple
records to account for the multiple selections.

Thanks,
T


If you create two tables, say tblPerson and tblSelections

CREATE TABLE tblPerson(
PersonID AutoNumber PRIMARY KEY,
FirstName Text(20) NOT NULL,
LastName Text(20) NOT NULL);

CREATE TABLE tblSelections(
SelectionID Long NOT NULL,
PersonID Long NOT NULL,
PRIMARY KEY (SelectionID, PersonID));

You'd create a subform based on tblSelections and make SelectionID a
combobox and as the RowSource of the combobox, create a query (the
wizard will just about walk you through the whole thing)...

SELECT tblChoices.ChoiceID, tblChoices.ChoiceText
FROM tblChoices
ORDER BY tblChoices.ChoiceText;

Then you'd have 2 columns in your combobox, and the first column
bound. To hide the ChoiceID in the interface, set the ColumnWidths
property to 0;1 or something... the first column width = 0 to hide it.
Then you're pretty much off to the races. You can enter as many
UNIQUE values in the subform as you want... (Unique meaning the
combination of (PersonID and SelectionID) has to be unique.

HTH.
Pieter
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.