Link to home
Start Free TrialLog in
Avatar of stephenlecomptejr
stephenlecomptejrFlag for United States of America

asked on

Is there an Access VBA I can create to determine if any functions or subs in an Access modue are unused?

So I have some Access modules with a lot of functions and subs and would like to know which ones are not ever called by any other Access form or module?   Is there a script I can write to accommodate this or software already written to do this?

Thanks in advance!
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

To find dependancy ? doubt it
Avatar of stephenlecomptejr

ASKER

It would be great to write a script that open up the Access coding module - loop through and find every Private or Public Sub and then loop through each form's module coding and identify if that is called anywhere!   It's got to be easy right?

Just export the coding module to text and then do the same with the form's coding module and then look for every line item and record if it found it or not - correct?

Here's the code for the modules to export as text - where would the export to text an Access form's coding?
http://www.access-programmers.co.uk/forums/showthread.php?t=225692
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (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
Jim,

Have never used the CrossReference utility in F&R9.0.  Does that only work for the items you have entered in the Find textbox?  Do I have to know what I'm looking for before hand, or will it search the entire database and look for those cross references?

I know Total Access Analyzer (FMS) will search your entire database and find unused objects, which I believe include unused code modules.  But it is a little steep ($299) for an individual license.
<<Have never used the CrossReference utility in F&R9.0.  Does that only work for the items you have entered in the Find textbox?  Do I have to know what I'm looking for before hand, or will it search the entire database and look for those cross references?>>

 It will cross-reference everything.  Here's the screen shots:

Button off to the right:

User generated image
and here's the options:

User generated image
 Note under option #2 (report) the check box for "only list unreferenced items"

Jim.
Total Access Analyzer is designed for professional developers and supported as a commercial product, so it's pricing can't be fairly compared to shareware.

It includes a VBA cod e parser that will find where procedures are used along with where they aren't used. Same for classes, functions, properties, constants, variables, types, enums, etc. Also pinpoints 300 types of errors, design suggestions, and performance tips, along with a UI that lets you go through the list of issues, and with one keystroke (ctrl D) put that object in design mode. You can also flag individual issuers as reviewed, so it's tlremwmbered and similarly flagged on subsequent runs.
Jim, I'm waiting for my registration key.

Until then what does Module Functions (non-CBF) mean?

If I wanted to find what function causes an error like the Name conflicts with existing module, project or object library.  Would I check on forms and modules in the A side of that above image and click Reports in section 2?
Thank you Jim,  I got the registration by 4/7 and was able to try it today!  I appreciate your reply and Rick Fisher's program!
<<Until then what does Module Functions (non-CBF) mean?>>

  CBF is "Code behind forms".   So modules that are Non-CBF are those are those in the "modules" tab of the database container.

<<If I wanted to find what function causes an error like the Name conflicts with existing module, project or object library.  Would I check on forms and modules in the A side of that above image and click Reports in section 2? >>

 and reports, yes.

 You'd probably be faster just using the find in VBA though.

Sorry I missed these.

Jim.