Function CopyRecordsetColumnToArray(ByVal adoRecSet As ADODB.Recordset, ByVal columnName As String) As Variant
'Description: Saves one column af a Recordset to an Array
'Input: Recordset object; column name (string)
'Output: 1 column wide 2D Array
'****** DEKLARÁCIÓK ********************
Dim tempArr() As Variant
Dim i As Long
'*******************************************
With adoRecSet
ReDim tempArr(0 To .RecordCount - 1, 0 To 0)
.MoveFirst
i = 0
Do While Not .EOF
' Save record value
'if value is NULL then relace it to vbNullString
If IsNull(.Fields(columnName).Value) Or .Fields(columnName).Value = "NULL" Then
tempArr(i, 0) = vbNullString
Else
tempArr(i, 0) = adoRecSet.Fields(columnName).Value
End If
adoRecSet.MoveNext
i = i + 1
Loop
End With
' RETURN
CopyRecordsetColumnToArray = tempArr
End Function