Required Property
Sets or returns a value that indicates whether a Field object requires a non-Null value or whether all the fields in an Index object must have a value.
Settings and Return Values
The setting or return value is a Boolean that is True if a field can't contain a Null value.
For an object not yet appended to a collection, this property is read/write. For an Index object, this property setting is read-only for objects appended to Indexes collections in Recordset and TableDef objects.
Remarks
The availability of the Required property depends on the object that contains the Fields collection, as shown in the following table.
If the Fields collection belongs to a | Then Required is |
---|---|
Index object | Not supported |
QueryDef object | Read-only |
Recordset object | Read-only |
Relation object | Not supported |
TableDef object | Read/write |
For a Field object, you can use the Required property along with the AllowZeroLength, ValidateOnSet, or ValidationRule property to determine the validity of the Value property setting for that Field object. If the Required property is set to False, the field can contain Null values as well as values that meet the conditions specified by the AllowZeroLength and ValidationRule property settings.
Note When you can set this property for either an Index object or a Field object, set it for the Field object. The validity of the property setting for a Field object is checked before that of an Index object.