See Also Example Applies To Specifics
Sets or returns the default value of a Field object. For a Field object not yet appended to the Fields collection, this property is read/write (Microsoft Jet workspaces only).
Settings and Return Values
The setting or return value is a String data type that can contain a maximum of 255 characters. It can be either text or an expression. If the property setting is an expression, it can't contain user-defined functions, Microsoft Jet database engine SQL aggregate functions, or references to queries, forms, or other Field objects.
Note You can also set the DefaultValue property of a Field object on a TableDef object to a special value called "GenUniqueID( )". This causes a random number to be assigned to this field whenever a new record is added or created, thereby giving each record a unique identifier. The field's Type property must be Long.
Remarks
The availability of the DefaultValue property depends on the object that contains the Fields collection, as shown in the following table.
If the Fields collection belongs to an | Then DefaultValue is |
Index object | Not supported |
QueryDef object | Read-only |
Recordset object | Read-only |
Relation object | Not supported |
TableDef object | Read/write |
When a new record is created, the DefaultValue property setting is automatically entered as the value for the field. You can change the field value by setting its Value property.
The DefaultValue property doesn't apply to AutoNumber and Long Binary fields.