Trying to determine table columns

Posted on 2006-05-16
Last Modified: 2010-08-05
What is the query syntax for determining a table's column names in MS Access (I'm using 2003 if it matters)?

I have all the "system" tables (i.e. MSysObjects), but I can't figure how to query for a specified table's columns...

Thanks in advance,
Question by:pillbug22
    LVL 6

    Author Comment

    Now I'm thinking the column names may be hidden in the LVProp column of the MSysObjects table for each table...

    If I'm headed in the right direction, any clues on iterating through that coulmn (Long Binary Data) to get the table's columns? My first thought is that I'd need some VBA code and can't do it just from a query...
    LVL 142

    Accepted Solution

    run this query for the table you are looking for the columns:
    select * from yourtable where 1=0

    this will return an empty recordset (no rows), but the fields collection is defined, simply loop the fields collection of the recordset
    LVL 6

    Author Comment

    See? It's alwasy the over-obvious simple things that rack your brain after staring at the screen for too long...

    Thanks for the kick in the pants!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
    Creating and Managing Databases with phpMyAdmin in cPanel.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now