Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleList the tables in a database by using DAO
Keywordsdatabase, table, list tables, DAO
CategoriesDatabase
 
Iterate through the database's TableDefs collection.

Note that this method lists the system tables that start with MSys in addition to tables you have defined.

 
Private Sub Form_Load()
Dim db As Database
Dim qdef As QueryDef
Dim td As TableDef
Dim dbname As String

    ' Open the database.
    dbname = App.Path
    If Right$(dbname, 1) <> "\" Then dbname = dbname & "\"
    dbname = dbname & "data.mdb"
    Set db = OpenDatabase(dbname)

    ' List the table names.
    For Each td In db.TableDefs
        List1.AddItem td.Name
    Next td

    db.Close
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated