Find tables with names with specific suffix in VBA

VBA code below finds tables which names end with specific sufix, e.g. tables with names ending with 'tab'.

Note that you can also do it with query.


Public Sub find_tables_with_tab_suffix()
  Dim t As TableDef
  For Each t In CurrentDb().TableDefs
     If Right(t.Name, 3) = "tab" Then Debug.Print (t.Name)
  Next t
End Sub


  • One row represents a table
  • Scope of rows: all found tables

Sample results

Immediate Window shows names of all tables that ends with "tab"

sample results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
There are no comments. Click here to write the first comment.