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!

Select from Listbox to a Textbox

Status
Not open for further replies.

jaw323

MIS
Sep 25, 2003
12
US
I am creating a database in which I have many options in a listbox that I can select. What I would like to do is to somehow populate a textbox with the selected items from the listbox separated by a comma. This sounds like something easy enough to me, but I have been away from access for a bit and can't find code for this anywhere. Anyone have tips on where I could find code to do something similar to this?

Thanks in advance!!
 
Take a look at the ItemsSelected property of your MultiSelect ListBox.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This is the code I would use in VB6. Presumably the same sort of thing in Access.

For n = 0 To List1.ListIndex
If List1.Selected(n) = True Then
Text1.Text = Text1.Text & List1.List(n) & ", "
End If
Next n

Hope this helps
Adam
 
Something like this ?
strList = ""
For Each varItm In theListBox.ItemsSelected
strList = strList & "," & theListBox.ItemsData(varItm)
Next varItm
theTextBox = Mid(2, strList)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top