Results 1 to 2 of 2

Thread: how to get Access query "description" text using VB6

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904

    how to get Access query "description" text using VB6

    In MS Access databases, queries have a "description" field (text) that you can get at in design mode. Using VBA (~VB6) I can get at just about everything having to do with an Access query (the name of the query, the SQL statement, etc) except the one thing I WANT to get at which is the description text. Does anyone know how to do that?

    Thanks,

    MY APOLOGIES FOR DOUBLE POST --- FORUM SAID FIRST ONE DID NOT TAKE, BUT OBVIOUSLY IT DID
    Last edited by phinds; Jan 20th, 2005 at 03:44 PM.

  2. #2
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Re: how to get Access query "description" text using VB6

    Try this:
    Code:
    Function Try_Showing_ObjectDescriptions()
        ' Needs reference to Microsoft DAO 3.51 Object Library
    
        ' For tables instead of queries, change QueryDef/QueryDefs to TableDef/TableDefs
        Dim DB As DAO.Database
        Dim obj As DAO.QueryDef
        Dim ObjDesc As String
        Dim ObjName As String
    
        ' Find the specified object in the current database
        Set DB = CurrentDb
        For Each obj In DB.QueryDefs
            On Error Resume Next
            ObjName = obj.Name
            ObjDesc = ""        ' Reset to empty in case error below
            ObjDesc = obj.Properties("Description")
    
            Debug.Print "Obj name=" & ObjName & " Desc=" & ObjDesc
        Next obj
    
        Set DB = Nothing
    End Function
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width