Connecting Tech Pros Worldwide Forums | Help | Site Map

Get multiple values from Listbox with Multi Select property set to Simple

NYprmr
Guest
 
Posts: n/a
#1: Nov 12 '05
Hi All,
I'm trying to get value from Listbox where Multi Select property is
set to Simple, meaning multiple values can be selected.
Doing regular loop like following, retuns NULL value for each data
item.
==========================================
lCount = Me!lstProblemType.ListCount
For varItem = 0 To lCount
If Me!lstProblemType.Selected(varItem) = True Then
strDescr = strDescr & "," &
Trim(Me!lstProblemType.ItemData(varItem))
End If
Next
==========================================
Please advice if you have any expirience.

Regards...

Salad
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Get multiple values from Listbox with Multi Select property set to Simple


NYprmr wrote:
[color=blue]
> Hi All,
> I'm trying to get value from Listbox where Multi Select property is
> set to Simple, meaning multiple values can be selected.
> Doing regular loop like following, retuns NULL value for each data
> item.
> ==========================================
> lCount = Me!lstProblemType.ListCount
> For varItem = 0 To lCount
> If Me!lstProblemType.Selected(varItem) = True Then
> strDescr = strDescr & "," &
> Trim(Me!lstProblemType.ItemData(varItem))
> End If
> Next
> ==========================================
> Please advice if you have any expirience.
>
> Regards...[/color]


I usually use ItemsSelected. Air code
Dim var As Variant
Dim strDesc As String
For each var in Me.ListBoxName.ItemsSelected
'specify column, row. In this case, column zero
strDesc = strDesc & Me.ListBoxName.Column(0,var)
Next

Closed Thread