View Full Version : Self auditing macro, if that exists!


ja5599
08-05-2009, 08:00 AM
Please help.
I want to do an audit of the usage of objects (queries, macros and reports only) within a legacy database I have inherited. There are about 5000 objects in this database, and I am sure not all are used.

My initial plan is to start with the macros, and create a step in the macro to call a function to update an audit table. After a month, the audit table would show all used macros. The trouble with this is I do not know how to automatically get the macro to know its own name. (I don't want amend each RunCode step - inserting this step 200 times is bad enough!)

Can anyone share their thoughts on this? Could I use SysObjects some how? And if there is a solution for executing queries, then I would really appreciate any guidance.
Thanks everyone.
J

Atomic Shrimp
08-11-2009, 01:49 AM
Have a play with this:

SELECT MSysObjects.*
FROM MSysObjects;

It shows you a list of Access objects - there are a couple of columns in there detailing data of creation and last update (not sure if that last update thing includes just running a query or macro, but should be easy to test)

When you come to actually apply the work to remove redundant objects, I would recommend backing up the database just before - then you can re-import missing objects from your backup, if anything breaks.

Atomic Shrimp
08-11-2009, 01:53 AM
Ah... I just tested it and it doesn't update the timestamp for macros or queries that are simply run - only if they're opened in design mode and saved - which doesn't help.