Required Property

See Also   Applies To

Sets or returns a value that indicates whether a CdbField object requires a non-Null value or whether all the fields in a CdbIndex object must have a value.

Syntax

VOIDSetRequired(BOOL bFlag );

BOOLGetRequired(VOID);

Parameters

Type Argument Description
BOOL bFlag TRUE if a field can't contain a Null value.

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
CdbIndex object Not supported
CdbQueryDef object Read-only
CdbRecordset object Read-only
CdbRelation object Not supported
CdbTableDef object Read/write

For an object not yet appended to a collection, this property is read/write. For a CdbIndex object, this property setting is read-only for appended objects.

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 CdbField 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 a CdbIndex object or a CdbField object, set it for the CdbField object. The validity of the property setting for a CdbField object is checked before that of a CdbIndex object.