Need SQL Code to list tables in database , Thanks...

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

--


---------------------------------------------------------------------
This email and any files transmitted with it from Dave Elliott are
confidential and intended solely for the
use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the
sender.
All Mail is pre-scanned with Norton Antivirus 2004 for your protection.

http://[email protected]
 
You do not need SQL code if you have a newer version:

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
 
SELECT MsysObjects.Name FROM MsysObjects
WHERE (([Type] = 1) AND ([Name] Not Like "~*") AND ([Name] Not Like
"MSys*"))
ORDER BY MsysObjects.Name;

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
Back
Top