View Single Post
  #8  
Old September 7th, 2005, 03:46 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Sorry, Siegried, AFAIK, you can get the Description for a Column, but not
for the Table with ADOX.

You may already know how to get the table's Description with DAO (assuming
it has one):
? dbEngine(0)(0).TableDefs("MyTable").Properties("De scription")

To confuse matters further, if you try to get the Description for a QueryDef
that has no Description, Access can lie to you and report the Description of
the table the query is based on.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Siegfried Heintze" wrote in message
...
You should be able to get the Description for a field in ADOX with:
Column.Properties("Description")

You may find that Access 2000 and later do not maintain the CreateDate

etc.

I'm confused. As I previously explained, I can get the field (column)
commnents using ADOX. It is the table comments I'm having trouble with. I
know my variable oTable is good because I'm gettting reasonable values for
the creation date and modification date.

Siegfried


Here is my code. Neither of the loops execute.

Public oTable As ADOX.Table
....
Dim ii As Integer
Dim oProp As ADOX.Property
' This never executes
For Each oProp In oTable.Properties
MsgBox("name=" & oProp.Name.ToString() & " value=" &
oProp.Value & " type=" & oProp.Type.ToString & " attr=" &
oProp.Attributes.ToString())
Next oProp

' This never executes either!
For ii = 0 To oTable.Properties.Count - 1
Dim xmlProp As XmlElement =
xmlTag.OwnerDocument.CreateElement("property")
xmlTag.AppendChild(xmlProp)
Dim xmlAttr4 As XmlAttribute =
xmlTag.OwnerDocument.CreateAttribute("name")
xmlAttr4.Value = oTable.Properties(ii).Name.ToString()
xmlProp.Attributes.Append(xmlAttr4)
Dim tnPropN As TreeNode =
tnProperties.Nodes.Add(oTable.Properties(ii).Name. ToString())
Dim tnAttr As TreeNode = tnPropN.Nodes.Add("Attributes")

tnAttr.Nodes.Add(oTable.Properties(ii).Attributes. ToString())
Dim xmlAttr5 As XmlAttribute =
xmlTag.OwnerDocument.CreateAttribute("attributes")
xmlAttr5.Value =
oTable.Properties(ii).Attributes.ToString()
xmlProp.Attributes.Append(xmlAttr5)
Try
Dim s As String =
oTable.Properties(ii).Value.ToString()
tnPropN.Nodes.Add("Value").Nodes.Add(s)
Dim xmlAttr6 As XmlAttribute =
xmlTag.OwnerDocument.CreateAttribute("value")
xmlAttr6.Value = s
xmlProp.Attributes.Append(xmlAttr6)
Catch : End Try
Dim tnType As TreeNode = tnPropN.Nodes.Add("Type")
tnType.Nodes.Add(oTable.Properties(ii).Type.ToStri ng())
Dim xmlAttr7 As XmlAttribute =
xmlTag.OwnerDocument.CreateAttribute("type")
xmlAttr7.Value = oTable.Properties(ii).Type.ToString()
xmlProp.Attributes.Append(xmlAttr7)
Next