>Hi
>
>I am trying to use adox to find properties of columns in an access database. The specific information I am looking for is Validation Rule and Description. I am able to get the name, type and defined size ok but the Validation Rule and Description always = "" even though I know that information exists. The following is a snippet of code:
>
>For Each oColumn In oTable.Columns
>
>cName = oColumn.Name
>cDescription = oColumn.Properties.Item("Description").Value
>cValidRule = oColumn.Properties.Item("Jet OLEDB:Column Validation Rule").Value
>
>Next oColumn
>
>Does anyone have a suggestion how I need to change the code?
>
>Thanks
>Nichole
This is working for me:
Private Sub Command1_Click()
Dim catSchema As ADOX.Catalog
Dim colX As ADOX.Column
Dim tblSchema As ADOX.Table
Set catSchema = New ADOX.Catalog
catSchema.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWind.mdb"
For Each tblSchema In catSchema.Tables
For Each colX In tblSchema.Columns
MsgBox "Table: " & tblSchema.Name & vbCrLf & _
"Column: " & colX.Name & vbCrLf & _
"Description: " & colX.Properties("Description").Value & vbCrLf & _
"Rule: " & colX.Properties("Jet OLEDB:Column Validation Rule").Value
Next
Next
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com