listing queries in a macro by code

Mcgrco

Registered User.
Local time
Today, 03:23
Joined
Jun 19, 2001
Messages
118
i want to be able to loop through all my macros in code and find specific queries. Does anyone know how I can do it.

Thanks
 
You might want to try something like this

Code:
Sub AllMacros()
    Dim obj As AccessObject, dbs As Object
    Set dbs = Application.CurrentProject
    ' Search for open AccessObject objects in AllMacros collection.
    For Each obj In dbs.AllMacros
        If obj.Name = "YourMacroname" Then
            ' Your code here
        End If
    Next obj
End Sub

You probably need more code to find which queries are called by each of your macro. Keep me informed if that example was enough.
 
thanks Mario,

What Im trying to do is put a pass a query name to a function and return the macros that contain the query which is slighly different to what your doing I think. Any hints are appreciated
 
ps im using a97 and your code doesnt seem to work . It doesnt like AccessObject
 
Sorry, I have looked in the help files and I can't see how to retreive a query name within a macro. Hope someone will help you better than me.
 

Users who are viewing this thread

Back
Top Bottom