Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get field names of a table 2

Status
Not open for further replies.

dbadmin

Programmer
Jan 3, 2003
147
US
Hi,

I am using access 97. There is a requirement which is to get the column names of a table. Is there any way to get it?

Thanks in advance
dbadmin
 
It is a long time since I use 97, but I think you should be able to get field names from a TableDef.

Code:
Dim tdf As TableDef
Dim db As Database
Dim fld

Set db = CurrentDB
Set tdf = d.TableDefs([i]"TableName"[/i])
For Each fld in tdf.Fields
   Debug.Print fld.Name
Next

Or there abouts.

You should also be able to get a field list from a recordset.
 
Or from a combobox with RowSourceType set to "Field list"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top