Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Selections in a Listbox

Status
Not open for further replies.

jabz

Programmer
Jan 9, 2002
115
US
I would like to put a list box in a form that will allow the user to select more then one item within a list box. I have tried putting up a list box with multiple selections have enabled the multiselect function but when you go to the next record it disappears and does not send the selected items to the table, please help....thanks in advance
 
Hey there

1st Create a function that will add the correct WHERE condition for your selected items ....

after use this loop
For Each varElt In lstEtiquettes.ItemsSelected
If lstEtiquettes.ItemData(varElt) <> &quot;&quot; Then Call AddCondition(&quot;PrimaryKEY = &quot; & lstEtiquettes.ItemData(varElt), &quot;OR&quot;)
Next varElt

This will add every selected item in your list to the where statement

Cheers
Vince
 
I'm having trouble figuring out what needs to be defined in the WHERE condition, I understand the loop but i'm still stuck, please help!!
 
Hi jabz!

First, what do mean by send the selected items to the table? If you want Access to store each item selected, then you will need to do that through code and I can show you how it is done. A few things I would need to know: Is there other data that will need to be stored in the record with the data from the list box? if so, where is the data? Does the list box have more than one column? Will each column become part of the record?

Jeff Bridgham
bridgham@purdue.edu
 
Okay I have a Master Table that stores Customer Information on various Accounts. I have an Add Account form which has all of the fields listed on it. Within this form I have a few fields in which multiple selections within a Listbox should be aloud. In the properties screen of the list box I have defined what selections I want in there.

My Promblem: I would like to be able to select(click) on more then one of these items and have them both show up in the Master Table.

Hope this makes it more clear, if not let me know.
 
Oh and there is only one column per list box, sorry I forgot to mention that
 
Hi again!

For the sake of the discussion let's build a scenario. Your customers may deal with multiple departments in your company and may have several locations and therefore more than one salesman, additionally, they purchase several of your products on a regular basis. Given a situation of this sort, what you would want to do is make new tables, i.e. CustomerProducts, which would store the multiple information for each customer, since you do not want to store the company address, name etc more than once. You would do similar things with the departments and salesmen. There could be potential refinements but we will ignor them for now. It may be easiest to just send me the database, with as detailed description of the problem as possible, and I will look at it and return code examples to accoplish what you want. If that is acceptable to you and your company you will need to zip the db first since our Outlook here will not accept Db's as attachments.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top