Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: Access Tables and Relationships FAQ

Tables and Relationships

VBA code to print a list of tables (with fields) by randysmid
Posted: 15 Oct 03

Here is VBA code that will print a list of non-system tables within a database.  Optionally, it will print a list of all fields as well.  The output for this will go into the Immediate Window, which is accessible via CTRL-G.  The results of this can be dropped into Word, or even Notepad for printing.

You may want to place this code into a new Module, perhaps called "modTableInfo".

Public Sub GetTableInfo()
   Dim db As Database, tbl As TableDef, fld As Field
   Set db = CurrentDb
   Debug.Print "            ", db.Name
   Debug.Print "      "
   Debug.Print "Table         Created          Modified              # Recs"
   Debug.Print "-----         -------          --------              ------"
   For Each tbl In db.TableDefs
     If Left$(tbl.Name, 4) <> "MSys" Then
       Debug.Print tbl.Name & "      " & tbl.DateCreated & "      " & _
        tbl.LastUpdated & "     " & tbl.RecordCount
       ' optional code to print all the fields
         'For Each fld In tbl.Fields
         '   Debug.Print fld.Name
         'Next fld
     End If
   Next tbl
End Sub

Back to Microsoft: Access Tables and Relationships FAQ Index
Back to Microsoft: Access Tables and Relationships Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close