Here is an example of doing what Van suggested. Caution: I have not tested it extensively. Copy
and paste the following code into a new module. Make sure that you have a reference set to the
"DAO 3.6 Object Library" (Tools > References).
'******Begin Code*****************
Option Compare Database
Option Explicit
Sub SearchCriteria(strSearch As String)
Dim db As DAO.Database, qryDef As DAO.QueryDef
Dim strSQL As String
Dim intFound As Integer
Set db = CurrentDb()
For Each qryDef In db.QueryDefs
If Left$(qryDef.Name, 1) <> "~" Then
strSQL = qryDef.SQL
intFound = InStr(strSQL, strSearch)
If intFound > 0 Then
Debug.Print qryDef.Name
End If
End If
Next qryDef
End Sub
'*********End Code*****************
To use this procedure from Immediate Window (Ctrl G), enter the following command:
searchcriteria("RAU")
Tom
______________________________________
If you want to try, you can write code to traverse the QueryDefs collection
to look at the SQL of each QueryDef. Use the InStr() function to check
wether the String "RAU" is in the SQL. If it is in the SQL, print the name
of the Query / QueryDef in the Debug window.
--
HTH
Van T. Dinh
MVP (Access)
______________________________________