Link to home
Start Free TrialLog in
Avatar of shannonds
shannonds

asked on

Is there anyway to document all the nested objects used in an MS Access macro

Hello all,
I have a huge MS Access migration coming up and I'm trying to prep for it now.  Not only are we bringing up new servers, but we're also going to be converting a boatload of old (2000 - 2003) Access databases to Access 2007 (it might end up being a new version, but the version doesn't matter for this request).  What I'd like to do is clean up the databases by only bringing over the objects that are needed.  Each database has a primary Macro that runs and does a bunch of stuff.  What I'd like to be able to do is programmatically list all the objects, nested objects, functions, etc used by that macro.  

For instance:
Lets say I have a Macro called "mcrAutoRun".  That macro starts by running another macro named mcrM1.  mcrM1 runs a make table query called qryM1_Make to create the tblM1 table.  qryM1_Make uses a select query called qryM1_Select and is made up of two tables (tbl1 and tbl2).  After that the mcrAutoRun macro runs a delete query called qryM2_Delete which deletes the records in the tblM2 table.  Then the mcrAutoRun macro runs an append query called qryM2_Append to append the tbl3 records to the tblM2 table.  Lastly it runs a function called SetCurrentDate(now()) which updates a value in the tblDates table.

What I want to do is pass the macro name to some code and have it printout a list of all the dependent objects.  Whether it prints to the intermediate window or to a table or to a text file, doesn't matter to me.  The desired output would be something like this:

Macro - mcrAutoRun
Macro - mcrM1
Query - qryM1_Make
Table - tblM1
Query - qryM1_Select
Table - tbl1
Table - tbl2
Query - qryM2_Delete
Table - tblM2
Query - qryM2_Append
Table - tbl3
Table - tblM2
Code - SetCurrentDate(now())
Table - tblDates

Any help or direction would be GREATLY appreciated.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

The best tool for doing this is Total Access Analyzer (www.fmsinc.com). It will tell you everything available for a database.

Rick Fisher's Find and Replace (www.rickworld.com) can do the same thing, although it's not as robust as TAA, and you'll have to dig around a bit more.
Avatar of shannonds
shannonds

ASKER

How would you do this in TAA?  I've never used it before and it's a little unclear as to how to tell it to give me a list of all the objects used in a selected macro.  In the documentation wizard, I selected only the macro I'm interested in.  Went through and named the output file and it went ahead and did it's thing, but the end result wasn't what I'm looking for.  It looks like it will do what I'm looking for, I just don't understand how to get it to do it.  I looked for an online demo/tutorial, but no luck.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Would have preferred some code I code write to loop through the object collection or something like that, but it looks like Total Access Analyzer might do what I need.  Unfortunately, it takes FOREVER to run.  I have a feeling that this process is going to be painful...  LOL
Thanks for pointing me in a direction.
It's always painful ...

FWIW, you could write code to show you the various attributes of different objects, but since you're looking for dependency information, the process is a LOT trickier. You'd need to parse out the SQL of each query and try to find the various object/field names, and then go from there.

I tried it once, and ended up spending a LOT more time than was necessary on the project ... overall, you're far better off just biting the bullet and using TAA.