I would like to loop the below code to go through a list of tables, but when I try to define the current table as a string and pass that varible into the
Set tjTab =tjDB.TableDefs!MYCURRENTTABLENAME command
I get a syntax error.
(or, if anyone knows a really easy/clean way to get a list of all the fields in all the tables in your DB, please let me know)
Public Sub ListTable()
Dim tjDb As DAO.Database
Dim tjTab As DAO.TableDef
Dim tjFld As DAO.Field
Dim TableString As String
Set tjDb = CurrentDb
Set tjTab = tjDb.TableDefs!ORDERINFO
For Each tjFld In tjTab.Fields
Debug.Print tjFld.Name ' Do what you want with the name(s) here
Next
tjDb.Close
Set tjFld = Nothing
Set tjTab = Nothing
Set tjDb = Nothing
End Sub