I want to reference the table names in one Access DB from another Access DB
via code. Any suggestions on how to do this?
This will list out all the tables in a database:
Option Compare Database
Option Explicit
Sub ListFieldsinRemoteDB()
Dim db As Database
Dim tdefs As TableDefs, tdef As TableDef
Set db = DBEngine.OpenDatabase("C:\BC\BSS\Moore\DOP Data.mdb")
For Each tdef In db.TableDefs
Debug.Print tdef.Name
Next tdef
db.Close
Set db = Nothing
End Sub
You can, of course, use a variable for the name of the remote database.
This will list out all the tables, including the system tables. You can add
some logic to exclude the system tables, if you choose.