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
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