
Don't know the field name but do know the column order
The Names of the fields are included in the META data from the recordset.
One method that I have used is to execute the following:
recordSet.Open "SELECT * FROM MyTable WHERE 1=2", ConnectionString
1 will never equal 2, so what is returned is an empty recordset that still
contains all of the META data.
recordSet(3).name will be the name of the column.
--
Rob Morrone
http://www.webstrands.com
Quote:
> Hi All,
> I need to write a select statement that will select columns from a table
> based on the column order.
> For instance:
> If I had a table called (MyTable) and it had 3 fields call MyField1,
> MyField2 and MyField3
> I would like to write a select statement the selects the data from
MyField3
> with a select statement like this:
> SELECT 3 FROM MyTable.
> I need to do this because I do not have the name of the field at run time
> but I will know the position of the column in the table.
> Thanks, John