Cosmos75
Registered User.
- Local time
- Today, 06:27
- Joined
- Apr 22, 2002
- Messages
- 1,281
Is there a way using DAO to loop through the back end files and get the path/file name infomation?
I know that I can accomplish the same thing by using a SQL string and recordset and parsing the 'Database' field
What I am trying to accomplish is to loop through the tables but I want to loop through the table in order of the back end file. If I loop through the tabledefs using DAO I end up accessing the tables in alphabetical order of their name in the current database.
The way I am doing is now is by using a SQL string as a recordset.
Type = 1 returns local tables and there are not values for 'Database' or 'Connect' fields.
I know that I can accomplish the same thing by using a SQL string and recordset and parsing the 'Database' field
Code:
SELECT Database
FROM MSysObjects
GROUP BY Database, Type
HAVING Database Is Not Null AND Type=6;
What I am trying to accomplish is to loop through the tables but I want to loop through the table in order of the back end file. If I loop through the tabledefs using DAO I end up accessing the tables in alphabetical order of their name in the current database.
Code:
Dim thisDb As DAO.Database
Dim tdf As DAO.TableDef
Set thisDb = CurrentDb
For Each tdf In thisDb.TableDefs
Debug.Print tdf.Name
Debug.Print tdf.Connect
Next tdf
thisDb.Close
Code:
SELECT Database, Connect, ForeignName, Name, Type
FROM MSysObjects
WHERE Name Not Like "MSys*" AND Type In (1,6)
ORDER BY Database, ForeignName;
Last edited: