Find the number of tables or Queries in an access database

Posted by Dark Training on March 30, 2011 tags: | acess

Here is a random one that I recently came across, I was working on a report from an old Microsoft Access database and needed to know how many tables and queries it had. Counting by hand was wayyyy out of the question so I used this:

To get the number of tables:

select count(name) from msysobjects where type=1 and flags=0

To get the number of queries:

select count(name) from msysobjects where type=5 and flags=0

You can also do filtering, IE if you wanted to know how many tables that started with the word "dict" you could use:

select count(name) from msysobjects where type=1 and flags=0 and Name like "dict*"