The Find menu has an option to search the entire project,
but that includes all reports and module objects.
If you really need to create a procedure that you can run
from the Immediate window, then the code could would be
along these lines of this air code:
Dim db As DAO.Database
Dim doc As DAO.Document
Dim mdl As Module
Dim StartLine As Long, EndLine As Long
Dim StartCol As Long, EndCol As Long
Set db = CurrentDb()
For Each doc In db.Containers!Forms.Documents
DoCmd.OpenForm doc.Name, acDesign
If Forms(doc.Name).HasModule Then
Set mdl = Forms(doc.Name).Module
StartLine = 0
Do
StartCol = 0
EndLine = mdl.CountOfLines
EndCol =9999
StartLine = StartLine + 1
If mdl.Find "nameoffuntion", StartLine, StartCol, _
EndLine, EndCol, _
WholeWord:= True _
Then
Debug.Print doc.Name, mdl.ProcOfLine(StartLine)
Debug.Print spc(5); mdl.Lines(StartLinem1)
Else
Exit Do
End If
Loop While True
DoCmd.Close acForm, doc.Name, acSaveNo
End If
Next doc
--
Marsh
MVP [MS Access]
yes your right about using the built-in functions. However I would like to
search a large number of forms and feel that doing this programmatically is
more efficient.