Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Searching inside a Query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kishore Ramakrishnan - 20 Nov 2007 16:55 GMT
Hi All,

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?

Thanks,

Kishore.
Marshall Barton - 20 Nov 2007 17:58 GMT
>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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.