Table of contents
TOC
折叠目录
展开目录

FieldSize 属性FieldSize Property

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

适用于:访问 2013年 |访问 2016 年Applies to: Access 2013 | Access 2016

字段大小属性可用于设置为设置为文本、 数字或自动编号数据类型的字段中存储的数据的最大大小。You can use the FieldSize property to set the maximum size for data stored in a field set to the Text, Number, or AutoNumber data type.

设置Setting

如果数据类型属性设置为文本,输入编号从 0 到 255 之间。默认设置为 50。If the DataType property is set to Text, enter a number from 0 to 255. The default setting is 50.

如果数据类型属性设置为自动编号,可以将字段大小属性设置为长整型或同步复制 id。If the DataType property is set to AutoNumber, the FieldSize property can be set to Long Integer or Replication ID.

如果数据类型属性设置为数字,以下列方式相关的字段大小属性设置和它们的值。If the DataType property is set to Number, the FieldSize property settings and their values are related in the following way.

设置Setting说明Description小数精度Decimal precision存储大小Storage size
字节Byte存储 0 到 255 之间的数字(不包括小数)。Stores numbers from 0 to 255 (no fractions).None1 个字节1 byte
小数Decimal存储-10 的数字 ^38 1 到 10 ^-10 38 1 (.adp) 存储数字 ^28-1 到 10 ^28-1 (.mdb 的.accdb)Stores numbers from -10^38-1 through 10^38-1 (.adp)Stores numbers from -10^28-1 through 10^28-1 (.mdb, .accdb)28282 个字节2 bytes
整型Integer存储数字-32768 到 32767 (没有小数位)。Stores numbers from -32,768 to 32,767 (no fractions).None2 个字节2 bytes
长整型Long Integer(默认值)存储数字-2147483648 到 2147483647 (没有小数位)。(Default) Stores numbers from -2,147,483,648 to 2,147,483,647 (no fractions).None4 个字节4 bytes
单精度型Single将存储到的数字-3.402823 e 38-1.401298 e-45 负数值,并从 1.401298 e-45 到 3.402823 e 38 为正值。Stores numbers from -3.402823E38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E38 for positive values.774 个字节4 bytes
双精度型Double存储数字从-1.79769313486231 e 308 到-4.94065645841247 e-324 负值以及 from4.94065645841247E-324 1.79769313486231 e 308 到正值。Stores numbers from -1.79769313486231E308 to -4.94065645841247E-324 for negative values and from4.94065645841247E-324 to 1.79769313486231E308 for positive values.15158 个字节8 bytes
同步复制 IDReplication ID全局唯一标识符 (GUID)Globally unique identifier (GUID)不适用N/A16 个字节16 bytes

只能从表的属性表中设置该属性。You can set this property only from the table's property sheet.

要从 Visual Basic 设置字段的大小,请使用 DAO大小属性来读取和设置文本字段的最大大小 (对于数据类型之外其他文本,DAO类型属性将自动设置决定大小属性设置)。To set the size of a field from Visual Basic , use the DAO Size property to read and set the maximum size of Text fields (for data types other than Text, the DAO Type property setting automatically determines the Size property setting).

注解Remarks

您应该使用最小可能的FieldSize属性设置,因为较小的数据处理速度比较快,需要的内存少。You should use the smallest possible FieldSize property setting because smaller data sizes can be processed faster and require less memory.

警告: 如果您将FieldSize设置由大值转换为一个已包含数据的字段中的较小,可能会丢失数据。例如,如果您从 255 中更改文本数据类型字段的字段大小设置为 50,超过 50 个字符以外的数据将被丢弃。Caution If you convert a large FieldSize setting to a smaller one in a field that already contains data, you might lose data. For example, if you change the FieldSize setting for a Text data type field from 255 to 50, data beyond the new 50-character setting will be discarded.

如果编号数据类型中的数据字段不符合新的字段大小设置小数数字可能被四舍五入或可能得到一个 Null 值。例如,如果改为从单个整数字段大小,小数部分的值将四舍五入为最接近的整数值大于 32767 或小于-32768 会然后空字段。If the data in a Number data type field doesn't fit in a new FieldSize setting, fractional numbers may be rounded or you might get a Null value. For example, if you change from a Single to an Integer field size, fractional values will be rounded to the nearest whole number and values greater than 32,767 or less than -32,768 will result in null fields.

不能撤消对导致更改字段大小属性在表设计视图中保存这些更改后的数据的更改。You can't undo changes to data that result from a change to the FieldSize property after saving those changes in table Design view.

请注意 如果计划对含有 1 到 4 位小数位的数据字段执行大量的运算,可以使用货币数据类型。单和双数据类型字段要求浮点运算。货币数据类型字段使用更快的定点运算。Note You can use the Currency data type if you plan to perform many calculations on a field that contains data with one to four decimal places. Single and Double data type fields require floating-point calculation. Currency data type fields use a faster fixed-point calculation.

访问支持资源ACCESS SUPPORT RESOURCES
访问 MSDN 上的开发人员论坛Access for developers forum on MSDN
Support.office.com 的访问帮助Access help on support.office.com
Answers.microsoft.com 的访问帮助Access help on answers.microsoft.com
特定的访问权限错误代码,在 Bing 上搜索Search for specific Access error codes on Bing
访问论坛 UtterAccess 上Access forums on UtterAccess
访问 wiki 上 UtterAcessAccess wiki on UtterAcess
访问开发人员和 VBA 编程帮助中心 (FMS)Access developer and VBA programming help center (FMS)
在 StackOverflow 上访问张贴内容Access posts on StackOverflow

© 2018 Microsoft