Table of contents
TOC
Collapse the table of content
Expand the table of content

AllowZeroLength Property

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Applies to: Access 2013 | Access 2016

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 BasicDescription
YesTrueA zero-length string is a valid entry. This is the default value when creating a field in the Access user interface.
NoFalseA zero-length string is an invalid entry. This is the default value when creating a field programmatically.

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

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.

AllowZeroLengthRequiredUser's ActionValue Stored
NoNoPresses ENTERPresses SPACEBAREnters a zero-length stringNullNull(not allowed)
YesNoPresses ENTERPresses SPACEBAREnters a zero-length stringNullNullZero-length string
NoYesPresses ENTERPresses SPACEBAREnters a zero-length string(not allowed)(not allowed)(not allowed)
YesYesPresses ENTERPresses SPACEBAREnters a zero-length string(not allowed)Zero-length stringZero-length string

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.

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
Access for developers forum on MSDN
Access help on support.office.com
Access help on answers.microsoft.com
Search for specific Access error codes on Bing
Access forums on UtterAccess
Access wiki on UtterAcess
Access developer and VBA programming help center (FMS)
Access posts on StackOverflow

© 2018 Microsoft