This article was originally published as a reply to a thread at Access World Forums
The attached database includes a procedure GetDatabaseStatistics which examines all tables, forms, reports, macros and modules in a project and produces statistics about the number of fields, controls, VBA functions, lines of code etc.
The output is sent to the VBE immediate window
For convenience I have copied the output into Notepad in the attached screenshots:
The process will only take a couple of seconds for small to medium size applications.
However it may take up to a minute or so for VERY large applications (as shown above)
The results are also displayed as a message box although the layout isn't as neat as I'd like:
At some point in the future, I may add provision to save the data direct to a log text file as a further option.
To run the GetDatabaseStatistics procedure, you will need to copy all the following items to your own application.
Table - tblSysObjectTypes
Queries - qryDatabaseObjects, qryDatabaseObjectCount & (optionally) qryDatabaseObjectSummary
Modules - modDatabaseStatistics & modVBECode
You will also need to add the VBA reference: Microsoft Visual Basic for Applications Extensibility 5.3
Click to download: DatabaseStatistics Approx 0.6 MB (zipped)
Click any image to view a larger version ...