Results 1 to 3 of 3

Thread: Access Database Tables

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Access Database Tables

    How can I retrieve a listing of tables in an Access Database?

    Cheers,


    Matt

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. 'Add a reference to Microsoft ADO Ext. X.X For DLL And Security
    2. 'Add a reference to Microsoft ActiveX Data Objects X.X Library
    3. Option Explicit
    4.  
    5. Private cat As ADOX.Catalog
    6. Private tbl As ADOX.Table
    7. Private cnn As New ADODB.Connection
    8. Private col As New Column
    9.  
    10. Private Sub Command1_Click()
    11.     Set cat = New ADOX.Catalog
    12.     Set tbl = New ADOX.Table
    13.    
    14.     'setup db connection
    15.     cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\BIBLIO.MDB"
    16.     Set cat.ActiveConnection = cnn
    17.    
    18.     'loop through all tables, and all fields in each table.
    19.     For Each tbl In cat.Tables
    20.         Debug.Print tbl.Name
    21.         For Each col In tbl.Columns
    22.             Debug.Print vbTab & vbTab & col.Name
    23.         Next col
    24.     Next tbl
    25.    
    26.     'close the connection
    27.     cnn.Close
    28.     Set cnn = Nothing
    29. End Sub

    is one way of doing it
    -= a peet post =-

  3. #3
    Lively Member
    Join Date
    Sep 2000
    Posts
    79
    The problem with designing something completely foolproof is to underestimate the ingenuity of a complete fool. - Douglas Adams

    I know the human being and fish can coexist peacefully. - GWB

    I think we agree, the past is over. - GWB

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