here is some code to loop through the tables in the current db.
I want to write a similar function, but I want to list the tables in another mdb file on an external drive.
The full Path and Name of the external file is in the variant varPathName....
eg: varPathName = "E:\2012_ARCHIVE\Semester_1\CurriculumGuides.mdb".
From the mdb file I'm currently running, I want to loop through the tables in varPathName.
I assume I need to change the code line "Set db = CurrentDb" to something else so that the code looks at the TableDefs in the external mdb file, but I can't get the syntax right. Any hints?
Thanks in advance
Code:
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
If Not (tdf.name Like "MSys*" Or tdf.name Like "~*") Then
Debug.Print tdf.name
... DO STUFF HERE ...
End If
Next
Set tdf = Nothing: Set db = Nothing
I want to write a similar function, but I want to list the tables in another mdb file on an external drive.
The full Path and Name of the external file is in the variant varPathName....
eg: varPathName = "E:\2012_ARCHIVE\Semester_1\CurriculumGuides.mdb".
From the mdb file I'm currently running, I want to loop through the tables in varPathName.
I assume I need to change the code line "Set db = CurrentDb" to something else so that the code looks at the TableDefs in the external mdb file, but I can't get the syntax right. Any hints?
Thanks in advance