Allow Zero Length
Microsoft Access
There is several settings you can set for a field in the database table. To see the list of options available, click here.
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.
To access Field size, do the following
-
Open Microsoft Access
-
On the left hand side, double-click the database (in this example it is Deaths, yours will be different)
|
-
Click Design View (click hyperlink for instructions)
-
Click the filed on top that you want to modify
|
-
On the bottom of the window, Click the right column on Allow Zero Length
|
Setting
The AllowZeroLength property uses the following settings.
Setting | Visual Basic | Description |
Yes | True | A zero-length string is a valid entry. This is the default value when creating a field in the Access user interface |
No | False | A Zero-length string is an invalid entry. This is the default value when creating a field programmatically |
Note To access a field's AllowZAeroLenghth property by using Visual Basic, use the DAO AllowZeroLength property or the ADO Column.Properties ("Set OLEDB:Allow ero 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 property 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 |
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 Null Zero-length string |
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) Zero-length string Zero-length string |
Note
You can use the Format property to distinguish between the display of Null value and zero-length string. For example, the string "None" can be displayed when a zero-length string is entered.
The AllowZAeroLenth 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 valid value for the field regardless of the string of the Required property.