Dim MyTableName As String Dim MyFieldName As String Dim GetFieldDesc_ADO Dim GetFieldDescription MyTableName = "ke_hu" MyFieldName = "dw_name"
Dim MyDB As New ADOX.Catalog Dim MyTable As ADOX.Table Dim MyField As ADOX.Column
On Error GoTo Err_GetFieldDescription
MyDB.ActiveConnection = CurrentProject.Connection Set MyTable = MyDB.Tables(MyTableName) GetFieldDesc_ADO = MyTable.Columns(MyFieldName).Properties("Description")
Dim pro As ADODB.Property For Each pro In MyTable.Columns(MyFieldName).Properties Debug.Print pro.Name & " : " & pro.Value & " ---- type : " & pro.Type Next
With MyTable.Columns(MyFieldName)
'.Properties("nullable") = True '必填 '必填无法用上述代码设置,出错提示为: '多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。 '目前可以用以下语句设置: 'CurrentDb.TableDefs("ke_hu").Fields("DW_NAME").Properties("Required") = False .Properties("Jet OLEDB:Allow Zero Length") = True '允许空 .Properties("default") = "默默默默认认认认" '默认值