Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
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-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated