Consulting

Results 1 to 4 of 4

Thread: Solved: Finding Functions in Access 2003

  1. #1
    VBAX Regular jauner's Avatar
    Joined
    Nov 2005
    Posts
    60
    Location

    Solved: Finding Functions in Access 2003

    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.


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

  3. #3
    VBAX Regular jauner's Avatar
    Joined
    Nov 2005
    Posts
    60
    Location
    Thanks!

  4. #4
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    I don't know if it helps but I used the following to search through all the code behind forms.
    [vba]
    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
    [/vba]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •