Results 1 to 3 of 3

Thread: Get table column names from Access...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Posts
    170

    Get table column names from Access...

    I am really struggling with getting the column names from a MS Access table, I have been googling for some time now and can not seem to find an example that works.

    Any help would be really apreshiated

    Thanks in advance

    Simon

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Get table column names from Access...

    If you are using ADO call the OpenSchema method of the Connection object.

    Code:
        Dim db As New ADODB.Connection
        Dim rs As ADODB.Recordset
        
        db.Open "provider=microsoft.jet.oledb.4.0;data source=m:\testing\nwind2.mdb"
        Set rs = db.OpenSchema(adSchemaColumns)
        rs.Filter = "Table_Name='Customers'"
        Do Until rs.EOF
            Debug.Print rs.Fields("Column_Name").Value, rs.Fields("Data_Type").Value
            rs.MoveNext
        Loop

  3. #3
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: Get table column names from Access...

    OR you can use TableDef object of DAO

    I know people dont like using DAO as it is an isolated technology, but I am in love with it
    Microsoft Techie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width