Looping to identify tables

W

Wylie C

Could you help me with code to loop thru the current database to identify all
the table names in that database?
Thank you.
 
D

Dirk Goldgar

Wylie C said:
Could you help me with code to loop thru the current database to
identify all the table names in that database?
Thank you.

If you're using Access 2000 or later:

Dim ao As AccessObject

For Each ao In CurrentData.AllTables
If Left(ao.Name, 4) <> "MSys" Then
Debug.Print ao.Name
End If
Next ao

If you're using Access 97:

Dim db As Database
Dim tdf As TableDef

Set db = CurrentDb

For Each tdf In db.TableDefs
If Left(tdf.Name, 4) <> "MSys" Then
Debug.Print tdf.Name
End If
Next tdf

Set db = Nothing
 

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