简体   繁体   中英

How to find field width of a table in Access VBA

In Access DAO.TablDef has a function CreateField(Name,Type,Size) I am looking for the size of an existing table field. I have a table column of type db_text and has a size of 6. 在此处输入图片说明 DAO recordset has a fields class. I can find field type with it but not field size yet. I tried DefinedSize, NumericScale and ActualSize. Anyone knows how to find field size? Thanks

Dim dars As Dao.Recordset

Set dars = CurrentDb.OpenRecordset("TableName")

debug.print dars.Fields("FieldName").Type

debug.print dars.Fields("FieldName").DefinedSize
debug.print dars.Fields("FieldName").NumericScale
debug.print dars.Fields("FieldName").ActualSize

dars.Close
Set dars = Nothing

Size属性包含字段大小:

debug.print dars.Fields("FieldName").Properties!Size

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM