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 / Modules / DAO / VBA / January 2007

Tip: Looking for answers? Try searching our database.

LIsting Query Description

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Janie - 21 Jan 2007 22:01 GMT
I can debug.print a list of Query names, no problem.  But what I really want
is a list of the query decriptions I have added in.  Since Description is not
one of the optons I see on the list, anyone have a method I could use?

Thanks,

Janie
Daniel - 21 Jan 2007 22:46 GMT
Janie,

The following code should do what you ask.  It was originally written by
Brendan Reynolds (MVP).  It does more than you need but you should be able to
extract what you need from it.

Public Sub ListQueries()

   Dim strFile As String
   Dim intFile As Integer

   Dim db As DAO.Database
   Dim qdfs As DAO.QueryDefs
   Dim qdf As DAO.QueryDef
   Dim prps As DAO.Properties
   Dim prp As DAO.Property

   Dim strName As String
   Dim strDescription As String

   'Save file in same folder as Access app. This
   'would need modification for Access 97.
   strFile = CurrentProject.Path & "\Queries.csv"
   intFile = FreeFile

   'Change Append to Output if you want to overwrite
   'any existing file with this name.
   Open strFile For Append As intFile
   Set db = CurrentDb
   Set qdfs = db.QueryDefs
   For Each qdf In qdfs
       'Ignore temporary queries.
       If Left$(qdf.Name, 4) <> "~sq_" Then
           strName = qdf.Name
           'Description is an extended property that does not
           'exist if no value has ever been asigned to it. Avoid
           'the error that would be raised by attempting to
           'refer to a non-existant property.
           strDescription = vbNullString
           Set prps = qdf.Properties
           For Each prp In prps
               If prp.Name = "Description" Then
                   strDescription = prp.Value
                   Exit For
               End If
           Next prp
           Write #intFile, strName, strDescription
       End If
   Next qdf

   Close #intFile

   MsgBox "Finished"

End Sub


Daniel

> I can debug.print a list of Query names, no problem.  But what I really want
> is a list of the query decriptions I have added in.  Since Description is not
[quoted text clipped - 3 lines]
>
> Janie
 
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.