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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get all column names for each table? 1

Status
Not open for further replies.

rao1soft

Programmer
Nov 7, 2002
17
US
Hi,
I would like to output all column names for each table in an Access2000 database. This would be similar to the ssql query in oracle, "select column_name from user_tab_columns". A query or vba code is ok. I have searched around but didn't find any answer. Thanks for the help.
--Rao.
 
look into the (nidden) MSys* tables. MSysObjects lists ALL objects in the app, while other members of the groups provide info on the serperate object types.

another approach is to (programattically) refview the tables "document" collection, via the tabledef objects and the Fields collection of each tabledef object.

finally, unless this is for a VERY demanding documentation effort, I would not generally place the info in a table, as it is (during design, test and debug at least) hardly static and would require frequent refreshing. Also, not that IF you actually have a use for the field names, you will almost certainly need to expand the thought to include at least SOME additional info, such as the table, data type and (at least for text fields) the defined length. Less commonly, you may need to list any default values, format strings, wheather the field accepts "Null", etc, etc,


All of these are available to the intrepid programmer through the Documents collection of Tables and the various properties and subsets exposed.

Lastly, this has been somewhat extensively discussed in htese fora in the past and can sometinmes be found vis hte local search engine. A more robust approach appears to use GOOGLE to search for topic words on Tek-Tips. I haven't tried this part, but I am sure you can find some examples using the local search with "Google" as the term to search for while setting the remaining search parameters.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top