ordinal position of fields in ado recordsets



I want to populate an array with values from an ado recordset
(multiple rows)

I use the absolute position of the cursor in the recordset to define
the row of my array to be populated. I have a workaround for lack of
a way to define the ordinal position of a field (incrementing a
counter variable), but it feels so primitive:

dim Fld as Field
dim rst1 as new adodb.recordset
dim varArray()
dim intfieldmarker is integer

Redim varArray(rst1.recordcount, rst1.Fields.count)

rst1.MoveFirst

Do While Not rst1.EOF
intfieldMarker = 0
For Each Fld In rst1.Fields
varArray(rst1.AbsolutePosition, intfieldMarker) = Fld
intfieldMarker = intfieldMarker + 1
Next Fld
rst1.MoveNext
Loop

If I used DAO, I could call the ordinal position of each field, and
use that to indicate the column of my array. But that method isn't
available with ADO, it seems. Does anyone know something a little
less risky than incrementing a counter?

Is it possible, for instance to store the field names in the first row
of the array, and then somehow use those fieldnames as pointers to the
column of the array? Just a thought...

.



Relevant Pages

  • Re: ordinal position of fields in ado recordsets
    ... Dim varArray as variant ... You then have a two dimensional array the first dimension of which is the ... varArray(lngRowCount, intfieldMarker) = .fields ...
    (comp.databases.ms-access)
  • Re: ordinal position of fields in ado recordsets
    ... I use the absolute position of the cursor in the recordset to define ... dim Fld as Field ... dim intfieldmarker is integer ... use that to indicate the column of my array. ...
    (comp.databases.ms-access)
  • Re: ordinal position of fields in ado recordsets
    ... And what are you going to do with that array? ... dim Fld as Field ... dim intfieldmarker is integer ... For Each Fld In rst1.Fields ...
    (comp.databases.ms-access)
  • Re: ordinal position of fields in ado recordsets
    ... I take all the new records from tableA populate the array, ... dim Fld as Field ... dim intfieldmarker is integer ... For Each Fld In rst1.Fields ...
    (comp.databases.ms-access)
  • Re: Detecting a running process.
    ... Private Declare Function EnumProcessModules Lib "psapi.dll" _ ... (ByVal dwProcessID As Long, _ ... Dim nProcesses As Long ... 'fill an array of longs with the ...
    (microsoft.public.vb.winapi)