>I have a few MS Access 2003 MDB files and I want to search for a string in
>the SQL query text of these MDBs. Is there a way to retrieve the text
>(source) of a query?
Here's some air code to get you started.
Dim strFile As String
Dim dbFile As DAO.Database
Dim qdf As DAO.QueryDef
strFile = "<full path to some file>"
Set dbFile = OpenDatabase(strFile)
For Each qdf In dbFile.QueryDefs
If qdf.SQL Like "*<the string>*" Then
Debug.Print strFile, qdf.Name, qdf.SQL
End If
Next qdf
Set dbFile = Nothing

Signature
Marsh
MVP [MS Access]
Kishore Ramakrishnan - 21 Nov 2007 15:35 GMT
Thanks Marsh. I will try this.
> >I have a few MS Access 2003 MDB files and I want to search for a string in
> >the SQL query text of these MDBs. Is there a way to retrieve the text
[quoted text clipped - 14 lines]
> Next qdf
> Set dbFile = Nothing