Access VBA Get Field Names
In this article I will explain how you can get the names of all the fields in a table an access database using VBA.
The first step would be to get the name of the table. The article below explains how you can get the name of all the tables in an access database:
Get Field Names:
In the example below it is assumed the database has a table with the name “MyTable1”:
Note: In order to work with the Recordset object you may need to add reference to the Microsoft ActiveX Data Object Library. This has been explained in the article below:
Note: If you do not wish to add reference to the Microsoft ActiveX Data Object Library you could use late binding to initiate the recordset object:
You can download the file and code used in this article from the link below: