ACC: Using the AllowZeroLength and Required Properties

Last reviewed: April 2, 1997
Article ID: Q113493
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

The AllowZeroLength property determines whether a zero-length string ("") is a valid entry. The Required property determines whether a null value is a valid value. Although these two properties work together, the AllowZeroLength property overrides the Required property.

MORE INFORMATION

The AllowZeroLength property determines whether a zero-length string ("") is a valid entry, and is available only for text and memo fields. Microsoft Access versions 2.0 and above support both null and zero-length strings in text and memo fields. (Microsoft Access version 1.x does not allow zero-length strings in a text or memo field. In Microsoft Access 1.x, if a user deletes data in an existing field, or does not enter data in a field, the value saved for the field is a null. To be compatible with Microsoft Access 1.x applications, the default for the AllowZeroLength property is No.)

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 might 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 enter 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 ""                   ""

REFERENCES

For more information about the AllowZeroLength property, search the Help Index for "AllowZeroLength property," or ask the Microsoft Access 97 Office Assistant.

For more information about the Required property, search the Help Index for "Required property," or ask the Microsoft Access 97 Office Assistant.


Keywords : kbusage TblFldp
Version : 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.