MS Access: how to find all the ways to use the VBA function?

I was tasked with refactoring and expanding the functionality of a large Access database. The existing VBA code is pretty bad, so I would like to clean it up by removing unnecessary functions and simplifying the rest. I wonder how I can find all the ways to use functions?

As for the VBA project itself, I can, of course, look for their names. Regarding SQL queries: I wrote a function that prints all queries in an intermediate VBE window, so I can also search for them.

But many features are also used in forms and reports. Is there any way to find them all? There are many complex forms / reports, so just looking at one control after another or deleting a function and checking if everything works is not possible at all.

+4
source share
1 answer

Unfortunately, Access does not have a search function (which I know) that includes form and report properties.

However, there is an undocumented SaveAsText method that copies forms and reports to text files. If you retrieve all your forms and reports ...

 Dim db As Database Dim d As Document Set db = CurrentDb() For Each d In db.Containers("Forms").Documents Application.SaveAsText acForm, d.Name, "C:\export\" & d.Name & ".frm" Next For Each d In db.Containers("Reports").Documents Application.SaveAsText acReport, d.Name, "C:\export\" & d.Name & ".rpt" Next 

... you can use "regular" text search tools (such as findstr , which is included on Windows) to find occurrences of specific words:

 C:\export>findstr /I "\<myFunction\>" * Form1.frm: OnClick ="=myFunction()" 
+2
source

All Articles