martin05
asked on
Access iterating through tables and queries
Is there an easy way to iterate through access tables and get a count for every one on my system.
I would like to do it with queries as well
I would like to do it with queries as well
ASKER
the point in doing it for queries is to do comparisons with a database we have migrated to sql
Sorry - I see what you'r after but that isn't what was in my mind.
There are too many reasons why you can't call a query reliably in code.
Action queries, parameter queries just won't run; queries using form references won't run.
There are too many reasons why you can't call a query reliably in code.
Action queries, parameter queries just won't run; queries using form references won't run.
ASKER
I understand,is there any way of excluding linked tables in the table count one ?
try this query
SELECT Count(MSysObjects.Type) AS CountOfQueries, (SELECT Count(MSysObjects.Type)
FROM MSysObjects
HAVING ((MSysObjects.Name) Not Like "msys*") AND (MSysObjects.Type)=1) AS CountOfTables
FROM MSysObjects
HAVING ((MSysObjects.Name) Not Like "~*") AND ((MSysObjects.Type)=5);
SELECT Count(MSysObjects.Type) AS CountOfQueries, (SELECT Count(MSysObjects.Type)
FROM MSysObjects
HAVING ((MSysObjects.Name) Not Like "msys*") AND (MSysObjects.Type)=1) AS CountOfTables
FROM MSysObjects
HAVING ((MSysObjects.Name) Not Like "~*") AND ((MSysObjects.Type)=5);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanx folks
Dim db As Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
If Left(tdf.Name, 4) <> "msys" Then Debug.Print tdf.Name & ":" & DCount("*", tdf.Name)
Next tdf
Set db = Nothing
End Sub
This will do it for tables.
I can't see the point in doing it for queries.