Avatar of stephenlecomptejr
stephenlecomptejr
Flag 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!
Microsoft Access

Avatar of undefined
Last Comment
Jim Dettman (EE MVE)

8/22/2022 - Mon
Ess Kay

To find dependancy ? doubt it
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
Jim Dettman (EE MVE)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dale Fye

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Jim Dettman (EE MVE)

<<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:

Screen shot one
and here's the options:

Screen shot of cross ref options
 Note under option #2 (report) the check box for "only list unreferenced items"

Jim.
Luke Chung

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.
stephenlecomptejr

ASKER
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?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
stephenlecomptejr

ASKER
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!
Jim Dettman (EE MVE)

<<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.