You are creating a 2 dimensional array (i,1) but only using one field, plus you need to set the array size, which you don't always know when a recordset is involved. So you could do something like
Code:
Dim rs As dao.Recordset
Dim myArray() As Variant
Dim i As Integer
Set rs = CurrentDb.OpenRecordset("qryAuditRule")
If Not (rs.BOF And rs.EOF) Then
rs.MoveLast 'necessary to get the record count
rs.MoveFirst
ReDim myArray(rs.RecordCount - 1)
Do Until rs.EOF
myArray(i) = rs.Fields(0)
rs.MoveNext
i = i + 1
Loop
End If
However, if you have a recordset, why do you want to put it in an array? It seems unnecessary. Also, you want to Set rs = Nothing but that's usually done in an error handling block.
Last edited by Micron; 02-16-2020 at 05:34 PM.
Reason: added info
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.