Query to List Tables

  • Thread starter Thread starter Brad Newman
  • Start date Start date
B

Brad Newman

I believe there is a way to run a query against the
current database that will list all the tables in that
database. Can anyone tell me what the name of the table
is that I would write the table against?

Thanks.
 
Brad Newman said:
I believe there is a way to run a query against the
current database that will list all the tables in that
database. Can anyone tell me what the name of the table
is that I would write the table against?
Hi Brad,

I believe this is what you are asking for:

SELECT MSysObjects.Name AS TableName
FROM MSysObjects
WHERE (((MSysObjects.Type)=1)
AND ((MSysObjects.Flags)=0));

Please respond back if I have misunderstood.

Good luck,

Gary Walter
 
In 2002, there are some nice collections that can be accessed from
CurrentProject and CurrentData.
CurrentData includes: AllQueries, AllTables
CurrentProject includes: AllForms, AllReports, AllMacros, AllModules,
AllDataAccessPages

Here is how to list all tables:

Public Sub ListTables()
Dim obj As AccessObject
With CurrentData
For Each obj in .AllTables
Debug.Print " " & obj.Name
Next obj
End With
End Sub

Public Sub ListModules()
Dim obj As AccessObject
With CurrentProject
For Each obj In .AllModules
On Error Resume Next
Debug.Print " " & obj.Name
Next obj
End With
End Sub
 
Back
Top