Full Version: Make from a multi select list box a single string
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
cablecity
Hello World!!

I have a multiselect listbox and i want to transfer the selected values to a text box to create a single string

I mean, if my list box have the values

value1
value2
value3
value4

and i have selected the values

value2
value4

with a clikc in a button, i want to sent these values to a textbox and create the string
value2, value4

How can i do this?????

Thanks for your time....
R. Hicks
You need something like the folllowing example ....

CODE
Private Sub YourButton_Click()

Dim ctl As Control

Dim varItem As Variant

Dim strTmp As String



Set ctl = Me.YourListboxName



For Each varItem In ctl.ItemsSelected

  strTmp = strTmp & ctl.ItemData(varItem) & ", "

Next varItem



strTmp = Left$(strTmp, Len(strTmp) - 2)

Me.YourTextboxName = strTmp



End Sub

Change the control names to the actual names of your controls ....

RDH

Edited by: R. Hicks on Sat Aug 19 13:35:36 EDT 2006.
cablecity
ok, thank you!!!
R. Hicks
No problem .. wink.gif

RDH
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.