Export Field Names

mlr0911

Registered User.
Local time
Yesterday, 17:32
Joined
Oct 27, 2006
Messages
155
I need to capture the field names from a linked table and copy them into an excel spreadsheet. Does anyone have an idea how I can accomplish this?

Thanks.
 
Open a recordset for the table. Step through the Fields() collection of that recordset. For each field, get Recordset.Fields(n).Name

Or, you can TRY to directly open the TableDefs collection for that table, find the Fields collection for the table in question, and again step through the collection for Fields(n).Name. I've never tried this with a linked table but it should work.
 
If you only need to do this once (and not multiple times through multiple tables), then just select the first record of the table (the whole row), copy it, go to Excel and paste it. The field names are included in the paste.

If you need the field names vertically, select all the field names in Excel, copy them, and then do a Paste Special and check the "Transpose" checkbox.
 
You could try my CSD Tools Access add-in. One of the many functions allows you to document the table field names and a few properties. You can optionally export the contents to Word or Excel.

You can find my free add-in here:
http://www.accessmvp.com/JConrad/accessjunkie/csdtools.html

--------------------
Jeff Conrad - Access Junkie - MVP Alumni
SDET - XAS Services - Microsoft Corporation

Co-author - Microsoft Office Access 2007 Inside Out
Presenter - Microsoft Access 2007 Essentials
http://www.accessmvp.com/JConrad/accessjunkie.html
Access 2007 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------
 

Users who are viewing this thread

Back
Top Bottom