Custom Search
 


How to easily get a list of field names in MS Access



If you have a MS Access table that has 100 fields (also known as columns), what is the easiest way to get a list of all the field names? One option is to use Database Documenter.

Access database documenter is a database tool used to document the various database objects such as tables, queries, forms, reports, macros, and so on.

Database Documenter:

Here is what you can document for a table object:

In regards to the problem we're going to solve, the documenter is a bit overkill because, in addition to the field names, the documenter also exports data types and field sizes in the file exported and the file is separated into multiple pages if there are too many things that is impractical to fit into one page. What if the only thing we'd like to get is a list of field names and nothing else? I happened to discover a way to easily accomplish this.

Export the list of field names

Suppose I need to get a list of the field names for Employees table in Northwind database. Below is the method I have been using.

Step 1: Open Northwind database. Right click on Employees table and select Export -> Excel.

Step 2: Select a destination folder and file name. Then click OK to export.

Step 3: Open the exported file Exmloyees.xlsx and highlight the first row for the column names.

Step 4: Right click on the first row and select Copy.

Step 5: Right click in cell A13 and select Paste Special.

Step 6: On the Paste Special window, tick Transpose checkbox and click OK.

Step 7: Now the field names in Employees table are pasted in column A as a list.

Even better way for large tables

You may have noticed that the data in Employees table were also exported to Excel spreadsheet. What if the table has half a million rows of data? Will that need to be exported as well? Of course not. There is a way to export only the field names without the data - duplicate Employees table but for structure only and then only export the duplicated table.

Step 1: Open Northwind database. Right click on Employees table and select Copy.

Step 2: Right click and select Paste.

Step 3: Paste the Employee table and select Structure Only. Name the new table Employees_copy.

Step 4: Export the new table Employees_copy.

Then the rest of the steps are the same as shown before. In the Excel spreadsheet, you'll only see field names and no data is exported because table Employees_copy does not contain any data. This technique is particularly useful for large Access tables.

Happy Exporting!


Copyright© GeeksEngine.com



Other Recent Articles from the MS Access category:

1.Solved - the size of the Access query result is larger than the maximum size of a database (2 GB)
2.How to count distinct records in MS Access
3.How to do transaction based processing in MS Access
4.How to open a document (local/network file or web page) from MS Access
5.How to use ADOX to create unique composite index - the VBA approach
6.How to do cross-table update queries in MS Access - the right way
7.Three efficient ways to get the number of records by using VBA
8.How to create a composite unique index (not as a primary key) in MS Access
9.Use VBA to get the correct number of records in a Recordset object
10.Disable Access Prompt when a record is changed, table deleted, or action queries run
11.How to hide and unhide a MS Access object
12.How to return multiple values from a VBA function (Part 3)
13.How to return multiple values from a VBA function (Part 2)
14.How to return multiple values from a VBA function (Part 1)
15.Three ways to programmatically duplicate a table in MS Access by VBA
16.Create a DLL by CSharp or VB.Net for VBA
17.How to correctly reference and call a DLL
18.How to register a C# or VB.Net DLL
19.Email address validation by Regular Expressions using VBA
20.Fix MS Access error: Query must have at least one destination field
21.How to unselect radio buttons in MS Access after it has been selected
22.How to Change Query Timeout Value for MS Access SQL Queries
23.What is Northwind Traders database

Copyright © 2017 GeeksEngine.com. All Rights Reserved.

This website is hosted by HostGator.

No portion may be reproduced without my written permission. Software and hardware names mentioned on this site are registered trademarks of their respective companies. Should any right be infringed, it is totally unintentional. Drop me an email and I will promptly and gladly rectify it.

 
Home | Feedback | Terms of Use | Privacy Policy