AllowZeroLength Property

Applies To

Table Fields.

Description

You can use the AllowZeroLength property to specify whether a zero-length string (" ") is a valid entry in a field.

Note The AllowZeroLength property applies only to text and Memo table fields.

Setting

The AllowZeroLength property uses the following settings.

Setting Description Visual Basic
Yes A zero-length string is a valid entry. True (-1)
No (Default) A zero-length string is an invalid entry. False (0)


You can set this property in the table’s property sheet or Visual Basic.

Note To access a field’s AllowZeroLength property using Visual Basic, use the Data Access Object’s AllowZeroLength property.

Remarks

You can use the settings of the AllowZeroLength and Required properties to differentiate between information that doesn’t exist (stored as a zero-length string in the field) and information that may exist but is unknown (stored as a Null value in the field). For example, you might have customers in your database who don’t have a fax number. If the AllowZeroLength property is set to Yes and the Required property is set to No, you can enter a zero-length string to indicate that a customer doesn’t have a fax number. If you leave the Fax field blank (you don’t type a number or you delete the existing number), it can indicate that the customer may have a fax number, but you don’t know what it is.

Note You need to use an input mask when data is entered in a field 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, then a zero-length string will be a valid value for the field regardless of the setting of the Required property.

The following table shows the results of combining the settings of the AllowZeroLength and Required properties.

AllowZeroLength Required User’s action Value stored
No No Presses ENTER Presses SPACEBAR Enters a zero-length string Null
Null
(not allowed)
Yes No Presses ENTER Presses SPACEBAR Enters a zero-length string Null
Nullstring
No Yes Presses ENTER Presses SPACEBAR Enters a zero-length string (not allowed)
(not allowed)
(not allowed)
Yes Yes Presses ENTER Presses SPACEBAR Enters a zero-length string (not allowed)stringstring


See Also

DefaultValue Property, Required Property, Microsoft Office 95 Data Access Reference topics: AllowZeroLength Property, Required Property.