Solved

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

Posted on 2006-11-28
9
25,963 Views
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].
0
Comment
Question by:ccsgc
9 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 25 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.

Pete
0
 
LVL 44

Assisted Solution

by:Leigh Purvis
Leigh Purvis earned 25 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.)
0
 
LVL 15

Assisted Solution

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

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

List0.Height = xheight
End Sub
0
 
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.
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 15

Expert Comment

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

Accepted Solution

by:
stevbe earned 25 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.

Steve
0
 

Author Comment

by:ccsgc
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.
0
 

Author Comment

by:ccsgc
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.
0
 
LVL 15

Expert Comment

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now