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!

Append a List Box

Status
Not open for further replies.

ztm

IS-IT--Management
Jul 19, 2001
34
US
I have a multi select list box that I want to be populated by items selected in a drop-down combo box. We have thousands of job/part numbers and I want a form to generate reports for each selected part number. If I have the list box populated by a query of all job and/or part numbers, it takes too long to scroll up and down the list to select the items. So I have a drop down combo box populated by the query, and you can enter the first few digits and the combo box goes directly to that number. What I want is to click one number in the combo box, it goes to the list box - click another number in the combo box, it goes to the list box without erasing the previous one, and so on until a group of numbers are in the list box. Then I can select them all and run my reports. How do I append the contents of the list box?
 
Dear ztm ,

if you are talking about an access listbox, it has certain a property rowsourcetype which is set to valuelist for unbound controls.
it has also a property rowsource which takes the items to be displayed seperated by semicola

now you can take the values of your combo whenever it changes and fill them into that property.

if list0.rowsource = "" then

list0.rowsource = combo.text
else
list0.rowsource = list0.rowsource & ";" & combo.text
end if

you should also make sure to avoid duplicates by a loop through all values already in your list

HTH
regards Astrid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top