Multiple select in combo box?

lorenzoaj

Registered User.
Local time
Today, 16:50
Joined
Nov 26, 2001
Messages
32
Is it possible to select multiple entries in a combo box or should I use a list box? How would I accomplish this. Thanks in advance.

AJ
 
You need to use a listbox.
Among listbox control properties, one allows to enable multiple selections.
 
I have a table (tblDistribution) that has 28 records in it. I have used that for my list box. On my form I have a list box and a combo box. In the list box when multi select is none and I click on an item it puts it in the combo box. If I change it to simple or extended it does not put it in the combo box.

I have created a distribution list for a Memo. At any time you will need to select at least 5 records.

What am I doing wrong and how can I fix it? If there is an easier way to do this I will change it. If you need more information I will try to provide more info. Thanks in advance for all your help.

AJ
 
You lost me. What are you trying to do exactly?
You set up a listbox and a combo so that when the user selects one item in the listbox, it is transferred to the combo? What for?
 
Initially I had set up a combo box and to be able to select multiple entries I added a list box. I was basically testing it out to see if it worked. It doesn't necessarily have to be that way. When I select entries in the list box it doesn't show up in the table either. Eventually I will need it in a report. I hope this explains better.
 
I believe I understand now where you are standing.
When you use a combo in multiselect mode (either simple or extended), nothing will happen automatically with the items selected. This is because, at the contrary of the single selection mode, there is no way to determine whether the user has finished selecting items or not.
So you have to create a 'validate' command button that the user will click after having selected all wnated items, and from where you will get and act with the selected items (open a report, save into a table, etc.)

here you will find a code snippet illustrating how to manipulate multiple selected items from a listbox:
Action query based on listbox selection
 
Last edited:
Alex,

I have copied the Function over but do I put it in a seperate module? I am also confused about what I put here.

DoCmd.SetWarnings False
dbEngine(0)(0).Execute YourSQLStringHere, dbFailOnError
DoCmd.SetWarnings True

What do I put in place of YourSQLStringHere? and do I put this in the OnClick event?

AJ
 
lorenzoaj,

That code snippet was just meant as an example. It probably won't answer your specific case. I still do not know what you intend to do with the selected values anyhow. The part of the code you quoted is intended to open a query. Is that your purpose?

That code can only help you to see how to get and manipulate multiple selected items from a listbox.
What is your knowledge of VB?
If you are a beginner, I may set up a small sample DB so you can study how the code works. A good method is to put breaking point in the code or execute it step by step and look at the content of the variables, + look at the help for each property/method to learn about it.

BTW, yes the code should go into a global module.

Alex
 
Last edited:
Alex,

The more I think I keep learning about VB and Access the more confusing it gets. I'm not sure how to go about putting breaking points in the code or executing it step by step. My knowledge of VB is very basic. I am very interested in learning all that I can. If you can help with this I would be greatly appreciated. The good news is I start working on my Programming/Analyst degree in Aug. One day I hope to be able to put into this forum as much as I have received from it.

I want to be able to put the selected values from the listbox into a table so I can run a query then a report from the query.
 
lorenzoaj said:
I want to be able to put the selected values from the listbox into a table

that's the exact problem I have too!!

can somebody help ?

thanks in advance!!

Schorsch
 

Users who are viewing this thread

Back
Top Bottom