473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Select multiple items from drop-down list

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
4 17602
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rowland Hills | last post by:
I have a table which is returning inconsistent results when I query it! In query analyzer: If I do "SELECT * FROM TABLE_NAME" I get no rows returned. If I do "SELECT COL1, COL2 FROM...
6
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
3
by: rhamlin | last post by:
I'm fairly new to creating complex sql statements and need a little help. In plain english I want to do this: Select menu rows where the row's userGroupIDs equal the user's userGroupIDs. ...
2
by: Tom Bray | last post by:
Ok I am baffled I can not figure out this problem. I am getting the following error: Portal Error - A DropDownList cannot have multiple items selected. Error information Name Value Message...
2
by: Henry Padilla | last post by:
I'm trying to select multiple items in a listbox and the demo from the help file is not working. What do I do to select multiple items in a listbox? Code sample below. Tom P. ...
2
by: Rob Long | last post by:
Hi I have an HTML select element in my page and it's multiple property is disabled (one item at a time mode) but I still want to transfer all the items in the select to the server when the form...
4
by: Matt Ratliff | last post by:
Hello, I would appreciate any assistance you have with the following problem: I have (as an example) an array of values as follows: arrayvalues=new Array("0001","0003","0005") where each is the...
2
by: Rowan | last post by:
I have a form that has several multiple select menus. I would like to save the multiple selections but be able to show them as selected items when the form data is updated. <select...
2
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've...
25
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.