[AccessD] accessing metadata

Charlotte Foust cfoust at infostatsystems.com
Mon Feb 24 11:00:00 CST 2003


I don't know how to do it with OpenSchema, but you can do it using the
ADOX catalog:

Public Function EnumFieldProps(ByVal strTblName As String)
  Dim cat As ADOX.Catalog
  Dim tbl As ADOX.Table
  Dim col As ADOX.Column
  Dim prp As ADOX.Property
  
  Set cat = New ADOX.Catalog
  Set tbl = New ADOX.Table
  cat.ActiveConnection = CurrentProject.Connection
  
  Set tbl = cat.Tables(strTblName)
  With tbl
    For Each col In tbl.Columns
      Debug.Print col.Name, col.Type
      For Each prp In col.Properties
        Debug.Print , prp.Name, prp.Type, prp.Value
      Next prp 'In col.Properties
    Next col ' In tbl.Columns
  End With 'tbl
  On Error Resume Next
  Set prp = Nothing
  Set col = Nothing
  Set tbl = Nothing
  Set cat = Nothing
End Function 'EnumFieldProps(ByVal strTblName As String)

Charlotte Foust

-----Original Message-----
From: Susan Harkins [mailto:harkins at iglou.com] 
Sent: Sunday, February 23, 2003 5:53 PM
To: AccessD at databaseadvisors.com
Subject: [AccessD] accessing metadata


Trying to return meta data -- specifically, the Description setting of
any given field in a table. It should be easier than I'm making it --
started
here:

Dim rst As ADODB.Recordset
  Dim fld As ADODB.Field
  Set rst = CurrentProject.Connection.OpenSchema(adSchemaColumns)
  Do Until rst.EOF
    For Each fld In rst.Fields
        If Not IsNull(fld.Value) Then
            Debug.Print fld.Value & vbTab
        End If
    Next fld
  Loop

I should be able to limit the tables using criteria in the OpenSchema
method, but I haven't gotten it right yet. If there's an easier way to
approach this problem, would like to hear it.

Thanks!
Susan H.

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list