You are creating an empty array.
You should set the size when you declare the array (assuming that you are not assigning a different array like in the second code snippet):
Dim a1(6) As String
For i = 0 To 5 '5 could be any number dependent on the data base input
...