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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NYprmr

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

    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!lstProblemTy pe.ListCount
    For varItem = 0 To lCount
    If Me!lstProblemTy pe.Selected(var Item) = True Then
    strDescr = strDescr & "," &
    Trim(Me!lstProb lemType.ItemDat a(varItem))
    End If
    Next
    =============== =============== ============
    Please advice if you have any expirience.

    Regards...
  • Salad

    #2
    Re: Get multiple values from Listbox with Multi Select property setto 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!lstProblemTy pe.ListCount
    > For varItem = 0 To lCount
    > If Me!lstProblemTy pe.Selected(var Item) = True Then
    > strDescr = strDescr & "," &
    > Trim(Me!lstProb lemType.ItemDat a(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

    Comment

    Working...