Click to See Complete Forum and Search --> : Extracting a field header from Access


erin
June 8th, 2004, 03:28 AM
Hi,

Could someone tell me how to extract the header name of a field from MS Access using a recordset?

Eg, suppose I have a table called AttrDefn

The Fields are:

Attribute (Field Name) Text (Field Type)
Attrtype (Field Name) Name (Field Type)

How can I extract this?

Thanks!
Divya

hspc
June 8th, 2004, 03:39 AM
ADO recordsets has the Fields Collection which can be used to access individual fields objects..

fields objects in turn has properties like :
Name
Type
Value
Attributes
and the Properties collection...

from MSDN :
Dim objProp As ADODB.Property

For intLoop = 0 To (objFields.Count - 1)
Debug.Print objFields.Item(intLoop).Name

For Each objProp In objFields(intLoop).Properties
Debug.Print vbTab & objProp.Name & " = " & objProp.Value
Next objProp
Next intLoop

check MSDN about (Field Object ADO) to get full info about it.