title: Populating dictionary from RecordSet
body: <p>I'm wondering if anyone can help me. I'm trying to populate a public dictionary from a recordset returned from an sql table.</p>
  
  <p>It all seems to work fine, except one part. I don't know if it's not counting the number of keys in the dictionary correctly, or they aren't being entered correctly but for whatever reason when I try and show the total count, it always comes back with only 1 (supposed to be around 15) and only displays the first row details.</p>
  
  <p>Can anyone help?</p>
  
  <pre><code>Public UserList As New scripting.Dictionary
  Sub UserDL()
  Dim USList As Range
  Dim USArr(0 To 11) As Variant
  
  Call ConnecttoDB
  
  Set Cmd = New adodb.Command: Set rs = New adodb.Recordset
  
  With Cmd
      .CommandTimeout = 30
      .ActiveConnection = cn
      .CommandText = "CSLL.DLUsers"
  
      Set rs = .Execute
  End With
  
  With rs
      If Not .BOF And Not .EOF Then
          .MoveLast
          .MoveFirst
          While (Not .EOF)
              For i = 1 To 11
                  USArr(i - 1) = rs(i)
              Next i
  
                  With UserList
                      If Not .Exists(rs("Alias")) Then
                          .Add Key:=rs("Alias"), Item:=USArr
                      End If
                  End With
              .MoveNext
          Wend
      End If
  End With
  
  IA = UserList.Items
  Debug.Print UserList.Count &amp; " Items in the dictionary"
  For Each element In IA
      For i = 0 To 10
          Debug.Print element(i)
      Next i
  Next element
  
  Set Cmd = Nothing: Set rs = Nothing ': Set UserList = Nothing
  End Sub
  </code></pre>