How count number of tables, queries, forms, reports, macros, and modules

Is there a way to get a count of the number of tables, queries, forms, reports, macros, and modules in a mdb file?
SteveL13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
I just did this recently.
Past this SQL into a query:

SELECT Sum(IIf([Type]=1,1,0)) AS Tables, Sum(IIf([Type]=6 And [Connect] Is Null,1,0)) AS [Linked Tables], Sum(IIf([Type]=6 And [Connect] Is Not Null,1,0)) AS [Linked Excel Files], Sum(IIf([Type]=5,1,0)) AS Queries, Sum(IIf([Type]=-32768,1,0)) AS Forms, Sum(IIf([Type]=-32764,1,0)) AS Reports, Sum(IIf([Type]=-32764,1,0)) AS Macros, Sum(IIf([Type]=-32761,1,0)) AS Modules
FROM MSysObjects
WHERE (((MSysObjects.Name)<>"qryAaObjectCount") AND ((InStr(1,[Name],"MSys")=0)=True) AND ((InStr(1,[Name],"~sq_")=0)=True));
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
1
2
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
3
0
PatHartmanCommented:
Create a query against the MSysObjects table.

Select Type, Count(*) As ObjCount
From MSysObjects
Where Left([Name], 4) <> "MSys" and Left([Name], 1) <> "~"
Group By Type;

The objects you are interested in are:
Type      ObjectDesc
-32768      Forms
-32766      Macros
-32764      Reports
-32761      Modules
1      Local Tables
4      Linked ODBC Tables
5      Queries
8      Nav Pane Objects


Objects starting with "~" are hidden.  In the case of tables, that means they are flagged for deletion but still in the database but in the case of queries, all embedded queries (those in RecordSource and RowSource properties) are actually saved as querydefs with a name that starts with "~"
0
SteveL13Author Commented:
Perfect.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.