Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieving "description" from table property 1

Status
Not open for further replies.

themausman

Programmer
Oct 12, 2005
2
NL
Hi,

I want to retrieve the description from the table in the database window. I iterate through code using ADOX reference. This works fine and i do get date created, date modified etc. Now I need the description.
I tried tbl.properties("description") but that doesn't return the description of the table. Also tried currentdata.alltables and then using aob.properties("description"). Didn't return requested info as well.

Any suggestions?

Maurice
 
Instead of using ADOX, try using the OpenSchema that is part of ADODB. It gives quite good table information.

Example.

Function TestTableColumn()

Dim cn As New ADODB.Connection, cn2 As New ADODB.Connection
Dim rs As ADODB.Recordset, rs2 As ADODB.Recordset
Dim connString As String

Set cn = CurrentProject.Connection
Set cn2 = CurrentProject.Connection

Set rs = cn.OpenSchema(adSchemaTables, _
Array(Empty, Empty, Empty, "table"))

While Not rs.EOF
Debug.Print rs!table_name; " desc= "; rs!description
Set rs2 = cn2.OpenSchema(adSchemaColumns, _
Array(Empty, Empty, "" & rs!table_name & ""))
While Not rs2.EOF
Debug.Print " " & rs2!column_name
Debug.Print " " & rs2!data_type
Debug.Print " " & rs2!description
Debug.Print " " & rs2!is_nullable
rs2.MoveNext
Wend
rs.MoveNext
Wend
rs.Close
Set cn = Nothing

End Function
 
This just does what i'm looking for. Of all the options I'd never thought of the schema. Good advice!

Maus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top