Public Sub FindTables()
' find queries that include a specific table in it's recordsource.
Dim db As DAO.Database
Dim qry As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
For Each qry In db.QueryDefs
If Left(qry.Name, 1) <> "~" Then
strSQL = qry.Properties("SQL")
If InStr(strSQL, "TheTableName") > 0 Then
Debug.Print qry.Name
End If
End If
Next
End Sub
Change "TheTableName" to whatever the exact name of the table you are
searching for is.
As others have observed, just beating through the objects list
can do it... sort of.
But the few methods I've tried (homegrown and purchased) broke
down when it came to nested queries. e.g. qryWhatever
references tblWhatever and qryDoobie uses qryWhatever....
As others have observed, just beating through the objects list
can do it... sort of.
But the few methods I've tried (homegrown and purchased) broke
down when it came to nested queries. e.g. qryWhatever
references tblWhatever and qryDoobie uses qryWhatever....
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.