PDA

View Full Version : Solved: Finding Functions in Access 2003



jauner
11-14-2005, 04:16 PM
Does anyone know if there is a way to search an access database for functions used in code?

Example: i have a function called functionx() and I want to know if it is used anywhere or if I can remove it.

:banghead:

chocobochick
11-15-2005, 06:12 AM
The Edit / Find option from the menu allows you to search the entire project for a text string, so it's easy enough to see if the function's being used in a module. But for determining if it's used in a form, query, or report, I don't know if there's a quick way to do it.

You can always cut and paste the code into a new module, export the module to a saved file, and then remove the module. That way, if the function was being used for a regular process, you'll find out quickly and be able to restore it. :*)

jauner
11-15-2005, 10:15 AM
Thanks!

Norie
11-15-2005, 10:40 AM
I don't know if it helps but I used the following to search through all the code behind forms.

Public Sub SearchProcs()
' this will search each form's module for a string
' and leave it open if it is found
Dim frm As Form, mdl As Module
Dim dbs As Database, ctr As Container, doc As Document
Dim X As Long
Dim strString As String
strString = InputBox("What text do you wish to search for?", "Search text")
If strString = "" Then Exit Sub
Set dbs = CurrentDb
Set ctr = dbs.Containers!Forms
For Each doc In ctr.Documents
If Not IsLoaded(doc.Name) Then DoCmd.OpenForm doc.Name, acDesign
Set frm = Forms(doc.Name)
Set mdl = frm.Module
Set mdl = frm.Module
If Not mdl.Find(strString, X, X, X, X) Then DoCmd.Close acForm, doc.Name
Next
End Sub