ajetrumpet
Banned
- Local time
- Today, 15:16
- Joined
- Jun 22, 2007
- Messages
- 5,638
Can someone tell me if there is a declaration error of the dynamic array in the following code please:
I am getting a subscript out of range error on the "= !Abc" LINE OF CODE. thanks for any help!
Code:
Option Compare Database
Option Explicit
Function t()
Dim db As Database
Dim rs As Recordset
Dim myarray() As String, i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("tableTEST", dbOpenDynaset)
i = 0
With rs
.MoveFirst
While Not .EOF
myarray(i) = !Abc
Debug.Print myarray(i)
.MoveNext
Wend
.Close
End With
Set rs = Nothing
Set db = Nothing
End Function