title: How can I fill an array with a recordset of an unkown size?
body: <p>This is what I have right now.  I feel like this can't be the most efficient way, but I'm not sure how to do it without using the function to check if the array is empty for the first element.</p>
  
  <pre><code>marginrec.Open querystr, margincon
  
  Do Until marginrec.EOF
  
      If Not IsNull(marginrec.Fields("term")) Then
          If Isarrempty(termarray) Then
              ReDim termarray(0)
              termarray(0) = marginrec.Fields("term")
          Else
              Ut = UBound(termarray)
  
              ReDim Preserve termarray(Ut + 1)
  
              termarray(Ut + 1) = marginrec.Fields("term")
          End If
      End If
  
      marginrec.movenext
  Loop
  </code></pre>
  
  <p>-</p>
  
  <pre><code>Function Isarrempty(ByVal moagg As Variant) As Boolean
  
  Dim b As Integer
  
  On Error Resume Next
  
  b = LBound(moagg)
  
  If Err.Number &lt;&gt; 0 Then
      Isarrempty = True
  Else
      Isarrempty = False
  End If
  
  On Error GoTo 0
  
  End Function
  </code></pre>
  
  <p>Edit: I suppose I could count the records of the recordset too and then use one redim statement for that</p>