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

AllowZeroLength 属性AllowZeroLength Property

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

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

可以使用允许空字符串属性以指定长度为零的 string("") 是一个表字段中的有效项。You can use the AllowZeroLength property to specify whether a zero-length string(" ") is a valid entry in a table field.

请注意允许空字符串属性仅适用于文本、 备注和超链接表的字段。Note The AllowZeroLength property applies only to Text, Memo, and Hyperlink table fields.

设置Setting

允许空字符串属性使用以下设置。The AllowZeroLength property uses the following settings.

设置SettingVisual BasicVisual Basic说明Description
YesTrueTrue零长度字符串是一个有效项。这是在 Access 用户界面中创建字段时的默认值。A zero-length string is a valid entry. This is the default value when creating a field in the Access user interface.
NoFalseFalse零长度字符串是一个无效项。这是以编程方式创建字段时的默认值。A zero-length string is an invalid entry. This is the default value when creating a field programmatically.

请注意 若要通过使用 Visual Basic 访问字段的允许空字符串属性,请使用 DAO属性或 ADO Column.Properties ("设置 OLEDB: 允许空字符串") 属性。Note To access a field's AllowZeroLength property by using Visual Basic, use the DAO AllowZeroLength property or the ADO Column.Properties ("Set OLEDB:Allow Zero Length") property.

注解Remarks

如果希望 Microsoft Access 存储而不是 Null 值为零长度字符串,当您将某个字段保留为空,请必需属性设置为 Yes。If you want Microsoft Access to store a zero-length string instead of a Null value when you leave a field blank, set both the AllowZeroLength and Required properties to Yes.

下表显示了组合必需属性的设置的结果。The following table shows the results of combining the settings of the AllowZeroLength and Required properties.

允许空字符串AllowZeroLength必需Required用户的操作User's Action存储值Value Stored
NoNo按 ENTERPresses SPACEBAREnters 一个零长度字符串Presses ENTERPresses SPACEBAREnters a zero-length string为空为空(不允许)NullNull(not allowed)
YesNo按 ENTERPresses SPACEBAREnters 一个零长度字符串Presses ENTERPresses SPACEBAREnters a zero-length string为空为空零长度字符串NullNullZero-length string
NoYes按 ENTERPresses SPACEBAREnters 一个零长度字符串Presses ENTERPresses SPACEBAREnters a zero-length string(不允许)(不允许)(不允许)(not allowed)(not allowed)(not allowed)
YesYes按 ENTERPresses SPACEBAREnters 一个零长度字符串Presses ENTERPresses SPACEBAREnters a zero-length string(不允许)长度为零的 stringZero 长度的字符串(not allowed)Zero-length stringZero-length string

请注意 可以使用格式属性来区分Null值的显示和一个零长度字符串。例如,输入零长度字符串后,可以显示"None"字符串。Note You can use the Format property to distinguish between the display of a Null value and a zero-length string. For example, the string "None" can be displayed when a zero-length string is entered.

必填属性独立工作的允许空字符串属性。所需属性只确定是否有效字段中为Null值。如果将允许空字符串属性设置为是,一个零长度字符串将不管如何设置所需属性的字段的有效值。The AllowZeroLength property works independently of the Required property. The Required property determines only whether a Null value is valid for the field. If the AllowZeroLength property is set to Yes, a zero-length string will be a valid value for the field regardless of the setting of the Required property.

访问支持资源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