badgers
Nov 11th, 1999, 04:02 AM
I want to find the names of all the tables a database contains. The following code gives me the names of the tables and a whole lot of other info that I don't want. Can anyone tell me how to get the table names out of a database? The database is called test.mdb and it has two tables one called "Table One" the other is called "Electrical"
Dim DB As Database
Private Sub Command1_Click()
Set DB = opendatabase("c:temp\customers.mdb")
Dim i As Integer
For i = 0 To DB.TableDefs.Count - 1
Debug.Print DB.TableDefs(i).Name
Next i
DB.Close
Set DB = Nothing
End Sub
This code gives me the following:
Electrical
MSysACEs
MSysModules
MSysModules2
MSysObjects
MSysQueries
MSysRelationships
Table One
The trouble is that if I use a different database it is a different layout. A database with three tables gives me this:
MSysACEs
MSysModules
MSysModules2
MSysObjects
MSysQueries
MSysRelationships
Names
Stock
Transactions
here the names of the tables all come at the end.
There has to be a way to get this info out of access. :D
thank you for your time and have a good day
------------------
warning do not "upgrade" from girlfriend V1.0 to Wife V1.0.
Dim DB As Database
Private Sub Command1_Click()
Set DB = opendatabase("c:temp\customers.mdb")
Dim i As Integer
For i = 0 To DB.TableDefs.Count - 1
Debug.Print DB.TableDefs(i).Name
Next i
DB.Close
Set DB = Nothing
End Sub
This code gives me the following:
Electrical
MSysACEs
MSysModules
MSysModules2
MSysObjects
MSysQueries
MSysRelationships
Table One
The trouble is that if I use a different database it is a different layout. A database with three tables gives me this:
MSysACEs
MSysModules
MSysModules2
MSysObjects
MSysQueries
MSysRelationships
Names
Stock
Transactions
here the names of the tables all come at the end.
There has to be a way to get this info out of access. :D
thank you for your time and have a good day
------------------
warning do not "upgrade" from girlfriend V1.0 to Wife V1.0.