|
|
Title | List the tables in a database by using DAO |
Keywords | database, table, list tables, DAO |
Categories | Database |
|
|
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
|
|
|
|
|
|