The
AllowZeroLength property determines whether a zero-length string
("") is a valid entry, and is available only for Text and Memo fields.
Microsoft Access supports both the
Null value and zero-length strings in Text and Memo fields.
The
Required property determines whether a
Null value is a valid value. Although the
AllowZeroLength and
Required properties work together, the
AllowZeroLength property overrides the
Required property. For example, if
AllowZeroLength is set to
Yes, a zero-length string is a valid value for the field regardless of the
Required property setting. To enter a zero-length string in a field, type two double quotation marks ("").
You can use the
AllowZeroLength and
Required property settings to differentiate between information that does not exist and information that
may exist. For example, you may have employees in your database who do not have a home phone. If
AllowZeroLength is set to
Yes,
Required is set to
No, and
DefaultValue is left blank for the HomePhone field, you can type two double quotation marks to indicate that an employee does not have a home phone. If you leave the field blank (do not type text or delete any existing text), it indicates that the employee may have a home phone but you do not know what it is.
The following table shows the results you can expect when you combine the
AllowZeroLength and
Required property settings:
AllowZeroLength Required User's action Value displayed
---------------------------------------------------------------------
No No Presses ENTER <Null>
Presses SPACEBAR <Null>
Types "" (not allowed)
Yes No Presses ENTER <Null>
Presses SPACEBAR <Null>
Types "" ""
No Yes Presses ENTER (not allowed)
Presses SPACEBAR (not allowed)
Types "" (not allowed)
Yes Yes Presses ENTER (not allowed)
Presses SPACEBAR ""
Types "" ""