Solved

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

Posted on 2006-11-28
9
26,016 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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
 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

820 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