Search through mods and cbf

Guus2005

AWF VIP
Local time
Tomorrow, 00:24
Joined
Jun 26, 2007
Messages
2,642
I want to create a crossreference function to search for a string in my code or CBF. Like i have done for table names:
Which tables are used in queries:
Code:
Public Sub XrefTablesInQueries(Optional blnUsed As Boolean = False)
'Loop through all tables to see if their name is used in queries.
'Default only the tables not used in queries are shown.

    Dim tdf      As TableDef
    Dim blnFound As Boolean
    
    For Each tdf In CurrentDb.TableDefs
        If VBA.Left$(tdf.Name, 4) <> "MSys" Then
            blnFound = SearchInQueryDefs(tdf.Name, True)
            If blnFound And blnUsed Then
                Debug.Print "In use: "; tdf.Name
            ElseIf Not blnFound And Not blnUsed Then
                Debug.Print "Not in use: "; tdf.Name
            End If
        End If
    Next tdf
    MsgBox "Done!", vbInformation, "XrefTables: Search completed"
End Sub

I want to know if a certain query was used in my modules and/or CBF.
 
I Gather you want to search through the code in modules? If this is correct, then I recall reading about being able to add and delete lines from modules with code and I knew it was in one of my books. I've just had a look through and found it in my book "Programming Microsoft Access 2000" by Rick Dobson.

Further: I have also discovered that the chapter on this, chapter 7 is also available online. -
-
-
-Here is a link to the particular part of the chapter that may be of interest.
I would be very interested in seeing any code you develop and your general experience with this if you wouldn't mind posting it. Cheers Tony
 
Great!

I searched the internet but couldn't find it. I really appreciate this!
Now i can create my SortProcedures function. Like MZTools does.

Thank You!:p
 

Users who are viewing this thread

Back
Top Bottom