PDA

View Full Version : Field name from ordinal position?



mud2
07-12-2009, 08:50 AM
How do I get the name of a field (in a table) from its ordinal position? The data can be found by:
data = MyrecordSet.Fields(Ordinal Position)
But the name of the field?

A "reverse" is available through the "Fieldnames" property, where one can set the names as a function of the ordianl position...when setting up the table..but this is not what I want!
Thanks.
By the way, nobody has commented on my discovery(?) that a sort Query is inconsistent with a "strcomp(str1,str2,0)" of the sorted table!

OBP
07-12-2009, 12:39 PM
Have you tried

data = MyrecordSet.Fields(Ordinal Position).name

You can certainly use this in a Form
ctl.Name = rs(count).Name
to match the name of a Form Field to the name of the same field in a Recordset

mud2
07-12-2009, 07:19 PM
OBP:
Thanks...It was (for ACCESS) so natural, or obvious, that i didn't think of it!. I'm posting another, more difficult problem, concerning Refrences.