get description of all tables

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hi,

Anyone has a simple code where i can debug.print the description
property of all the tables in a mdb?

I want to check the linked string in the description part.
 
The problem with the Description property is that it only exists if you've
actually assigned a description: an error is raised when you try and refer
to it otherwise. That means you need to be able to ignore the error in your
code.

Something like the following should work (assuming you have a reference set
to DAO):

Sub ListTables()
On Error Resume Next

Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim strTableName As String
Dim strDescription As String

Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
If (tdfCurr.Attributes And dbSystemObject) = 0 Then
strTableName = tdfCurr.Name
strDescription = tdfCurr.Properties("Description")
If Err.Number = 3270 Then
strDescription = "*** No Description Provided ****"
End If
Debug.Print strTableName & ": " & strDescription
End If
Next tdfCurr

End Sub
 
Back
Top