From: cherman on
Does anyone know of a way to find if a function is being called from a query?
Another words, I have a function that might be called from 1 or more queries
in my DB and I am looking for a quick way to see which queries it is called
from.

With over 200 queries in my DB, it will take me some time to check them
manually, and I have 2 functions to check.

Is there a utility or something that will do this for me?

Thanks!
From: John W. Vinson on
On Thu, 6 May 2010 15:57:01 -0700, cherman <cherman(a)discussions.microsoft.com>
wrote:

>Does anyone know of a way to find if a function is being called from a query?
>Another words, I have a function that might be called from 1 or more queries
>in my DB and I am looking for a quick way to see which queries it is called
>from.
>
>With over 200 queries in my DB, it will take me some time to check them
>manually, and I have 2 functions to check.
>
>Is there a utility or something that will do this for me?
>
>Thanks!

There are a few third party utilities that will do this:

Free: http://www3.bc.sympatico.ca/starthere/findandreplace
Find and Replace: http://www.rickworld.com
Speed Ferret: http://www.moshannon.com
Total Access Analyzer: http://www.fmsinc.com

Some of these links are rather old and may not be current.

You could also use VBA to loop through the QueryDefs collection and search for
the function name in the SQL property:

Dim qd As DAO.Querydef
For Each qd IN CurrentDb.Querydefs
If InStr("MyFunction", qd.Sql) > 0 Then
Debug.Print qd.Name
End If
End Sub

Untested air code!
--

John W. Vinson [MVP]
From: fredg on
On Thu, 6 May 2010 15:57:01 -0700, cherman wrote:

> Does anyone know of a way to find if a function is being called from a query?
> Another words, I have a function that might be called from 1 or more queries
> in my DB and I am looking for a quick way to see which queries it is called
> from.
>
> With over 200 queries in my DB, it will take me some time to check them
> manually, and I have 2 functions to check.
>
> Is there a utility or something that will do this for me?
>
> Thanks!

Public Sub FindFunction()
Dim qdf As DAO.QueryDef
For Each qdf In CurrentDb.QueryDefs
If InStr(qdf.SQL, "FunctionName1") > 0 Or InStr(qdf.SQL,
"FunctionName2") > 0Then
Debug.Print qdf.Name & " " & qdf.SQL
End If
Next

End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail