How to create a drop-down list box (not a combo box!)

Posted on 2006-11-28
Medium Priority
Last Modified: 2011-08-18
My understanding is that a list box allows multiple selections but a combo box allows just one selection. For reasons of space I want a list box that has drop-down functionality. The Access 2002 help refers to 'Create a list box, combo box, or drop-down list box' and I assume a drop-down list box is what I need. The instructions are:

3. Click the List Box tool [icon1], the Combo Box tool [icon2], or the Dropdown List tool [icon3] in the toolbox.

I can't see any difference between icon 2 and icon 3, they both look like the Combo Box tool. However, if I use the Combo Box tool I can't find any way to set it up as a drop-down list box (ie, a drop-down that allows the user to click, highlight and accept more than one entry in the drop-down section).

I wonder if Microsoft are using combo box and drop-down list to mean the same thing - a single-select combo box. If so, is there another way to space-save on a form with a list box yet display all the possible selections when required by the user without the need to scroll?

[PS - I know a little vba so could probably cope with a programmatic solution].
Question by:ccsgc
LVL 77

Assisted Solution

peter57r earned 75 total points
ID: 18026775
Hi ccsgc,
In a normal Access form you can use a list box or a combo box.
In a Data Access Page you can use a drop-down list.
If you need multi-select you have to use a listbox.

LVL 44

Assisted Solution

by:Leigh Purvis
Leigh Purvis earned 75 total points
ID: 18026780
It would ultimately have to be just a listbox that is displayed and hidden upon certain conditions.
Sometimes a textbox is placed above a listbox - to give the illusion of a combo type control.
You would have to decide what you wanted displayed in the textbox - as you're selecting multiple values in the list.  A concatenated list of the selected items would be most likely.

(Or you could just have it completely hidden - and a command button to display it for selecting options when the user so desires - then problem then is knowing what's selected when it's hidden.  But if you've a good few items selected - I don't see how a textbox will be much help at that ether.)
LVL 15

Assisted Solution

by:Simon Ball
Simon Ball earned 75 total points
ID: 18026787
Private Sub List0_Click()
Dim xheight As Integer

xheight = List0.Height
xheight = xheight * List0.ListCount

List0.Height = xheight
End Sub
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

LVL 15

Expert Comment

by:Simon Ball
ID: 18026789
i got a phone call inbetwen writing question and posting it, my list0 was condensed on the form.  the initial hieght value was 227.
LVL 15

Expert Comment

by:Simon Ball
ID: 18026793
on click event not thebest i suppose, as it will fire when selecting...
LVL 39

Accepted Solution

stevbe earned 75 total points
ID: 18026893
What is the functional purpose for your multi-selection? I hope you are not trying to store multiple values in a single field :-) If you are using this for filtering data on a form or a report there are a couple of approaches you could use to save space ... pop a seperate form with just the multi-select listbox when they click a button ... I have a report riteria builder ... most of the time I only need to run reports where I own a task record in our application but sometimes my boss likes to run reports on everyone in our group ... what I did in builtind the UI is to make a combobox for when people only need to make 1 selection and put a little button with the    ...   on it just to the right of the combobox and trained everyone that they need to click the button to make *multiple* selections for that particular field. When they click that button a simple form pops up (modal) with a multi-select listboxn and I return the results of their selection back to the main form in the Close event of the multi-select form. I am working on another project where they tend to make many multiple selections and while I have a bit of space they need multiple, multiple selection fields :-) On this project I used subforms bound to temp tables displayed in datasheet and made the data entery control inside the datasheet be a combobox ... this way they get auto-complete and the *entered* list grows and adds the scrollbar automagically because it is a datasheet. Of the two options the first one is more space conservative but the users really like the second one.


Author Comment

ID: 18029481
The functional purpose is to read the list box programatically and put the values in an IN() statement of the SQL to be executed.

Your answers are all pertinent so I will split the points. Thanks for the tips how to rig it. I think the Microsoft online documentation is misleading about the drop down list box - it seems they mean a drop-down-list box (a box that gives a drop-down list) and not a drop-down list-box (a list-box that can be opened from a combo-like control). Thanks again.

Author Comment

ID: 18035310
I am a newbie on the site. I think I managed to split the points between you (25 each) and a moderator confirms that I closed the question with 4 comments but can't confirm the percentage of points each. Let me know if you didn't get them.
LVL 15

Expert Comment

by:Simon Ball
ID: 18035500
i think it worked because it says all the assisted answers in green.

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Audit trails are very important in any system to hold people responsible for certain transactions and hold them to take ownership of their actions. This article is dedicated to all novice "Microsoft Access" developers.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question