title: access vba to create array
body: <p>I have a loop with array and want to create [mesAmis] as "Alpha, Beta, Charlie, Delta Echo, Foxtrot, Golf". However, it returns the friends' names along with 19 commas.</p>
  
  <p>Since my loop reads from my recordset [tblFriendsList], we don't know how many friends we have. Is there anyway I can rewrite my codes below so I don't have to set it as 19 but using a record count? I have tried a lof of times but can't work out the bunches of "monAmie". Thanks in advance! </p>
  
  <pre><code>Dim monAmie(0 To 19) As String, lngPosition As Long
  Dim mesAmis As String
  If Not (rs2.EOF And rs2.BOF) Then
   rs2.MoveFirst 'Unnecessary in this case, but still a good habit
   ' LOOPING STARTS
   Do Until rs2.EOF = True        
   intCounter = intCounter + 1        
   monAmie(intCounter) = rs2!TaskDetailedInfo
   rs2.MoveNext
   Loop
   ' LOOPING ENDS
   mesAmis = Join(monAmie, ", ")
   MsgBox ("intCounter: " &amp; intCounter)
   MsgBox ("mesAmis: " &amp; vbCrLf &amp; mesAmis)
  ' mesAmis is created as :
  'Alpha, Beta, Charlie, Delta, Echo, Foxtrot, Golf
   Me.ShowMeAllYourFriends = mesAmis 'display the friends in this textbox
  Else
   MsgBox "There are no records in the recordset."
  End If
  </code></pre>