Table "Description"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marclinenberger
    New Member
    • Sep 2006
    • 1

    Table "Description"

    If you right click on a table name in the tables window and click on properties you get a dialog box that allows you to add a description of the table. My question is using VBA how do you access that 'description' property??? It's NOT a TableDefs property but it is being stored somewhere... Any Ideas?

    Thanks!!!
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi,

    You can do it by Create property in Mdb

    See this exemples from Northwind they can help you to update te properties!

    :)

    Code:
    Sub CreatePropertyX()
    
       Dim dbsNorthwind As Database
       Dim prpLoop As Property
    
       Set dbsNorthwind = OpenDatabase("Northwind.mdb")
    
       ' Set the Archive property to True.
       SetProperty dbsNorthwind, "Archive", True
       
       With dbsNorthwind
          Debug.Print "Properties of " & .Name
          
          ' Enumerate Properties collection of the Northwind 
          ' database.
          For Each prpLoop In .Properties
             If prpLoop <> "" Then Debug.Print "  " & _
                prpLoop.Name & " = " & prpLoop
          Next prpLoop
    
          ' Delete the new property since this is a 
          ' demonstration.
          .Properties.Delete "Archive"
    
          .Close
       End With
    
    End Sub
    
    Sub SetProperty(dbsTemp As Database, strName As String, _
       booTemp As Boolean)
    
       Dim prpNew As Property
       Dim errLoop As Error
    
       ' Attempt to set the specified property.
       On Error GoTo Err_Property
       dbsTemp.Properties("strName") = booTemp
       On Error GoTo 0
    
       Exit Sub
    
    Err_Property:
    
       ' Error 3270 means that the property was not found.
       If DBEngine.Errors(0).Number = 3270 Then
          ' Create property, set its value, and append it to the 
          ' Properties collection.
          Set prpNew = dbsTemp.CreateProperty(strName, _
             dbBoolean, booTemp)
          dbsTemp.Properties.Append prpNew
          Resume Next
       Else
          ' If different error has occurred, display message.
          For Each errLoop In DBEngine.Errors
             MsgBox "Error number: " & errLoop.Number & vbCr & _
                errLoop.Description
          Next errLoop
          End
       End If
    
    End Sub

    Comment

    • weased
      New Member
      • Nov 2006
      • 2

      #3
      I tried this and it doesn't work

      I get a problem on:

      Set prp = tbl.CreatePrope rty("Descriptio n", dbText, strName)

      (It's also asking for [DDL] after strName ... what is DDL?

      Comment

      • weased
        New Member
        • Nov 2006
        • 2

        #4
        I got it:

        I simply combined the "Set" and "Append" Statements

        (I'm referencing my code, but you should get the gist):

        tbl.Properties. Append tbl.CreatePrope rty("Descriptio n", dbText, strName)

        Comment

        • edwarric1
          New Member
          • Nov 2008
          • 1

          #5
          This is very helpful but how can I replace the description of it already exists?

          Comment

          Working...