[AccessD] OpenSchema not working as expecting with query

Susan Harkins harkins at iglou.com
Sun Mar 16 09:48:01 CST 2003


I'm using the following procedure to return the Description property from a
table. I tried to run it using a query, but it doesn't work -- Description
property returns Null, which is interesting -- not an error, but Null, even
when there's a string. Anybody know more about this? I'm guessing OpenSchema
doesn't return a query's Description property, but then, I would expect the
rst!Description reference to return an error, but it doesn't. Even with On
Error commented out, it still returns Null.

Susan H.



Public Function ReturnDescription(fldname As String) As String
Dim rst As ADODB.Recordset
Dim fld As ADODB.Field
Set rst = CurrentProject.Connection. _
    OpenSchema(adSchemaColumns, _
    Array(Empty, Empty, "Customers"))
        Do Until rst.EOF
          For Each fld In rst.Fields
           On Error Resume Next
            If rst!COLUMN_NAME = fldname Then
              ReturnDescription = Nz( _
                rst!Description, "")
            End If
          Next fld
          rst.MoveNext
        Loop
Set rst = Nothing
Set fld = Nothing
End Function







More information about the AccessD mailing list