List box multiple selection problem

D

dar

Below is my code for an unbound listbox. I also have a text box that should
receive
the selections. However, it only takes one. I need to be able to select 3
items
and have all three separated by a comma in the text box. I have set the
property to Extended in the Multi Select property. What am I missing.
Thanks in advance.

Private Sub CompensatoryTechniques_Click()
Dim ctl As Control, varItm As Variant, strVal As String
Set ctl = Me!CompensatoryTechniques
For Each varItm In ctl.ItemsSelected
strVal = strVal & ctl.ItemData(varItm) & ","
Next
Me!CompTextBox = strVal
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top