Database, DatabaseName Properties Example

The example examines the Database property of a data control and prints the name of each Table in the Debug window.

Sub PrintTableNames ()
  Dim I
  Data1.DatabaseName = "BIBLIO.MDB"      ' Set Database file.
  Data1.Refresh                          ' Open the Database.
  ' Read and print the name of each table in the Database.
  For I = 0 To Data1.Database.TableDefs.Count - 1
    Debug.Print Data1.Database.TableDefs(I).Name
  Next I
End Sub