Is there a way to retrieve table descriptions?

Joined
Apr 29, 2008
Messages
66
Reaction score
0
I would find it useful to be able to retrieve, and possibly modify, all descriptions of tables and queries as an aid to documentation of my database. I haven't been able to find any way of doing this through the system tables. It looks as if they aren't held in the same way that other table details are in the system tables, especially as you maintain them differently from other table details. Is there any way of getting at them via a query or programmatically that anyone knows of?
 
I've found the answer to this myself. It is to use the DAO TableDefs collection. The following code lists all tables with descriptions where available.

Sub GetTableDescriptions()
Dim db As Database
Dim tdfTable As TableDef
Dim strDesc As String
Set db = CurrentDb
On Error Resume Next
For Each tdfTable In db.TableDefs
strDesc = ""
strDesc = tdfTable.Properties("Description")
Debug.Print tdfTable.name & " " & strDesc
Next
End Sub

If no description has been entered, there is no Description property which is why On Error Resume Next is needed.
I hope others find this helpful.
 
Back
Top