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

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]
 
J

Joe Fallon

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
 
A

Allen Browne

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]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top