Shawn
asked on
list box values with multi select
I have a list box called Me!listFiles. The multi select value is extended.
How do I copy the selected values to a text box?
Let's call the text box Me.temptxt.
How do I copy the selected values to a text box?
Let's call the text box Me.temptxt.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i think we are on the same page. I just got it to work with the code below
I found it here: harfang: Q_21827430 #16539856.
I found it here: harfang: Q_21827430 #16539856.
Function ListFromBox(pListBox As ListBox, Optional pfText As Boolean)
'
' Build a list of selected items from a ListBox,
' suitable for SQL and filters.
'
Dim varItem, varList, varData
varList = Null
With pListBox
For Each varItem In .ItemsSelected
varData = .ItemData(varItem)
If Not IsNull(varData) Then
If pfText Then _
varData = "'" & Replace(varData, "'", "''") & "'"
varList = varList + ", " & varData
End If
Next varItem
End With
ListFromBox = varList
End Function
You may be able to use it or it may give you some ideas
You could then loop through the array and append values to a string and then do Me.TextBox = string
Open in new window