TRANSPOSE column of array

User avatar
sal21
PlatinumLounger
Posts: 4336
Joined: 26 Apr 2010, 17:36

TRANSPOSE column of array

Post by sal21 »

I use this code to fill array:

Erase strDBRows()
strDBRows = RS1.GetRows(RS1.RecordCount)

in the recordset are 7 column.

Now i need to traspose the column 4 of array in a new array, similar:

NewArray('12345','457','589',...'4578')

i need to loop all items in the column 4 and create a string, or exists a function similar application.transpose (strDBRow, 4?)

User avatar
HansV
Administrator
Posts: 78359
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: TRANSPOSE column of array

Post by HansV »

Code: Select all

    Dim I As Long
    Dim N As Long
    ...
    N = RS1.RecordCount
    Erase strDBRows()
    strDBRows = RS1.GetRows(N)
    ReDim NewArray(N - 1) As String
    For I = 0 To N - 1
        NewArray(I) = strDBRows(3, I)
    Next I
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4336
Joined: 26 Apr 2010, 17:36

Re: TRANSPOSE column of array

Post by sal21 »

HansV wrote:

Code: Select all

    Dim I As Long
    Dim N As Long
    ...
    N = RS1.RecordCount
    Erase strDBRows()
    strDBRows = RS1.GetRows(N)
    ReDim NewArray(N - 1) As String
    For I = 0 To N - 1
        NewArray(I) = strDBRows(3, I)
    Next I
Ok in this case if i have understand non possibile in one shot only?
I need strictlly to loop to create the transpostion of arry?

User avatar
HansV
Administrator
Posts: 78359
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: TRANSPOSE column of array

Post by HansV »

Yep.
Best wishes,
Hans