title: Return selected values in a listbox
body: <p>I have in Access a single column table, Table1 with cell values 11-20. </p>
  
  <p>I created a listbox on a form to multiselect cell values of this table.</p>
  
  <p><a href="https://i.stack.imgur.com/mUTkJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mUTkJ.png" alt="Listbox List38"></a></p>
  
  <p>I need those selected values to filter a column in another table. I tried to retrieve the selected values as below but it did not help, especially <code>ItemData(oItem + 1)</code> returning only Null. </p>
  
  <pre><code>    Dim oItem As Variant
      Dim sTemp As String
      Dim iCount As Integer
  
      iCount = 0
  
      Debug.Print Forms.frmPassQuer2.List38.ItemsSelected.Count
  
      If Forms.frmPassQuer2.List38.ItemsSelected.Count &lt;&gt; 0 Then
  
          For Each oItem In Forms.frmPassQuer2.List38.ItemsSelected
  
              Debug.Print oItem
  
              If iCount = 0 Then
                  sTemp = sTemp &amp; Forms.frmPassQuer2.List38.ItemData(oItem + 1)
                  iCount = iCount + 1
              Else
                  sTemp = sTemp &amp; "," &amp; Forms.frmPassQuer2.List38.ItemData(oItem + 1)
                  iCount = iCount + 1
              End If
  
              Debug.Print Forms.frmPassQuer2.List38.ItemData(oItem + 1)
  
          Next oItem
  
      Else
          MsgBox "Nothing was selected from the list", vbInformation
          Exit Sub  'Nothing was selected
  
      End If
  
  End Sub
  </code></pre>