By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,687 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,687 IT Pros & Developers. It's quick & easy.

Table "Description"

P: 1
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!!!
Sep 25 '06 #1
Share this Question
Share on Google+
4 Replies


PEB
Expert 100+
P: 1,418
PEB
Hi,

You can do it by Create property in Mdb

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

:)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub CreatePropertyX()
  3.  
  4.    Dim dbsNorthwind As Database
  5.    Dim prpLoop As Property
  6.  
  7.    Set dbsNorthwind = OpenDatabase("Northwind.mdb")
  8.  
  9.    ' Set the Archive property to True.
  10.    SetProperty dbsNorthwind, "Archive", True
  11.  
  12.    With dbsNorthwind
  13.       Debug.Print "Properties of " & .Name
  14.  
  15.       ' Enumerate Properties collection of the Northwind 
  16.       ' database.
  17.       For Each prpLoop In .Properties
  18.          If prpLoop <> "" Then Debug.Print "  " & _
  19.             prpLoop.Name & " = " & prpLoop
  20.       Next prpLoop
  21.  
  22.       ' Delete the new property since this is a 
  23.       ' demonstration.
  24.       .Properties.Delete "Archive"
  25.  
  26.       .Close
  27.    End With
  28.  
  29. End Sub
  30.  
  31. Sub SetProperty(dbsTemp As Database, strName As String, _
  32.    booTemp As Boolean)
  33.  
  34.    Dim prpNew As Property
  35.    Dim errLoop As Error
  36.  
  37.    ' Attempt to set the specified property.
  38.    On Error GoTo Err_Property
  39.    dbsTemp.Properties("strName") = booTemp
  40.    On Error GoTo 0
  41.  
  42.    Exit Sub
  43.  
  44. Err_Property:
  45.  
  46.    ' Error 3270 means that the property was not found.
  47.    If DBEngine.Errors(0).Number = 3270 Then
  48.       ' Create property, set its value, and append it to the 
  49.       ' Properties collection.
  50.       Set prpNew = dbsTemp.CreateProperty(strName, _
  51.          dbBoolean, booTemp)
  52.       dbsTemp.Properties.Append prpNew
  53.       Resume Next
  54.    Else
  55.       ' If different error has occurred, display message.
  56.       For Each errLoop In DBEngine.Errors
  57.          MsgBox "Error number: " & errLoop.Number & vbCr & _
  58.             errLoop.Description
  59.       Next errLoop
  60.       End
  61.    End If
  62.  
  63. End Sub
  64.  
Sep 26 '06 #2

P: 2
I tried this and it doesn't work

I get a problem on:

Set prp = tbl.CreateProperty("Description", dbText, strName)

(It's also asking for [DDL] after strName ... what is DDL?
Nov 23 '06 #3

P: 2
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.CreateProperty("Description", dbText, strName)
Nov 23 '06 #4

P: 1
This is very helpful but how can I replace the description of it already exists?
Nov 20 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.