1 Attachment(s)
Take elements from database table to array using VBA
Hi in order to do that I use this code
Code:
Sub test()
Dim rstData As DAO.Recordset
Dim a1 As Variant
Set rstData = CurrentDb.OpenRecordset("select value_a from Population")
rstData.MoveLast
rstData.MoveFirst
a1 = rstData.GetRows(rstData.RecordCount)
Debug.Print Join(a1, " ")
End Sub
But I get error Invalid Procedure call or argument.
Whta's wrong with my code?
EDIT1 Seems this code gives two dementional array, kinda a1(0, 0)
Is it possible to get one dementional array straight away? Without looping