G
Guest
I am using ADO to retrieve and append data from the web to an Access table.
Is there a way to determine the order in which the fields of the table
recordset will be cycled? This is important so that I can ensure that the
columns of data retrieved from the web match the order of fields into which
that data will be appended.
I know that I can use the field names to set the order in which they are
used. That is NOT my question. For other considerations (fields may be
added or removed later), I would like to try to determine their order as
returned using the following For loop:
dim rst as adodb.recordset
set rst = new adodb.recordset
For j = 1 To rst.Fields.Count 'UBound(arTableDesc, 1)
vFNames(j) = rst.Fields.Item(j - 1).Name
Next j
The order in which they are returned here is different than the order the
fields are returned in a For each fld in rst.fields loop. The latter seems
to be in the order in which the fields were created, for former - I can't
figure out how the order was derived. Initially, it seemed it was based on
the column order in the table. Changing the field order in Table design,
however, did NOT change the field order as determined by the For J = 1 to
rst.Fields.Count loop.
I'm sure there are 50 different ways of solving this, and I may use one of
them, but if anyone knows where the ordinal numbers are stored (I can't find
them in any of the field object properties) or set, I'd really like to know.
Thanks for the help.
Is there a way to determine the order in which the fields of the table
recordset will be cycled? This is important so that I can ensure that the
columns of data retrieved from the web match the order of fields into which
that data will be appended.
I know that I can use the field names to set the order in which they are
used. That is NOT my question. For other considerations (fields may be
added or removed later), I would like to try to determine their order as
returned using the following For loop:
dim rst as adodb.recordset
set rst = new adodb.recordset
For j = 1 To rst.Fields.Count 'UBound(arTableDesc, 1)
vFNames(j) = rst.Fields.Item(j - 1).Name
Next j
The order in which they are returned here is different than the order the
fields are returned in a For each fld in rst.fields loop. The latter seems
to be in the order in which the fields were created, for former - I can't
figure out how the order was derived. Initially, it seemed it was based on
the column order in the table. Changing the field order in Table design,
however, did NOT change the field order as determined by the For J = 1 to
rst.Fields.Count loop.
I'm sure there are 50 different ways of solving this, and I may use one of
them, but if anyone knows where the ordinal numbers are stored (I can't find
them in any of the field object properties) or set, I'd really like to know.
Thanks for the help.