Link to home
Start Free TrialLog in
Avatar of dwe0608
dwe0608Flag for Australia

asked on

URGENT : Getrows with Fieldnames

Hi all

I need to get fieldnames and values into an array so I can cycle through them - I know I can get the recordset values into an array using GetRows

dim arr()
arr = rs.getrows(rs.recordcount)

But that doesnt get the field names.  What I would like to do is get the fieldname, and the fieldvalue, and place it into an array which I can reference in a for ... next statement getting the fieldname and value at the same time

I am not very good with arrays so commented coded answers would be appreciated

MTIA

Darrin

Avatar of dwe0608
dwe0608
Flag of Australia image

ASKER

ok - I have worked out a way ... using the following code, where rs is a valid recordset object  

    Dim vFieldNames()
    Dim i
    i = 0
    ReDim vFieldNames(rs.Fields.Count, 1)
    For i = 0 To rs.Fields.Count - 1
        arr(i, 0) = rs.Fields(i).Name
        arr(i, 1) = rs.Fields(i).Value
    Next i

Avatar of Jorge Paulino
So, no help required!
Avatar of dwe0608

ASKER

DanRollins - I answered my own question - please set to zero points and leave in tact for others to view (I couldnt find an answer on this topic)

MTIA

Darrin
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial