databasedev.co.uk - database solutions and downloads for microsoft access

Listing Tables in a Microsoft Access Database

How to list All tables contained in a Database

You may at some point want to view a list of all of the tables contained within your Microsoft Access Database. Using the following code will allow you to quickly view all of the database table names that are stored:

Public Sub ListTables()

    Dim i As Integer
    
    On Error Resume Next
    
    For i = 0 To CurrentDb.TableDefs.Count - 1
        Debug.Print "Table: " & CurrentDb.TableDefs(i).Name
    Next
    
End Sub

If you now call ListTables from the Immediate window you'll now see a full list of tables listed.

See the following article on - How do I use the Immediate window?