Field2.Attributes property (DAO)

Applies to: Access 2013, Office 2013

Sets or returns a value that indicates one or more characteristics of a Field2 object. Read/write Long.

Syntax

expression .Attributes

expression A variable that represents a Field2 object.

Remarks

The value specifies characteristics of the field represented by the Field2 object and can be a combination of these constants.

Constant

Description

dbAutoIncrField

The field value for new records is automatically incremented to a unique Long integer that can't be changed (in a Microsoft Access workspace, supported only for Microsoft Access database engine database tables).

dbDescending

The field is sorted in descending (Z to A or 100 to 0) order; this option applies only to a Field2 object in a Fields collection of an Index object. If you omit this constant, the field is sorted in ascending (A to Z or 0 to 100) order. This is the default value for Index and TableDef fields (Microsoft Access workspaces only)..

dbFixedField

The field size is fixed (default for Numeric fields).

dbHyperlinkField

The field contains hyperlink information (Memo fields only).

dbSystemField

The field stores replication information for replicas; you can't delete this type of field (Microsoft Access workspaces only).

dbUpdatableField

The field value can be changed.

dbVariableField

The field size is variable (Text fields only).

For an object not yet appended to a collection, this property is read/write. For an appended Field2 object, the availability of the Attributes property depends on the object that contains the Fields collection.

If the Field object belongs to an

Then Attributes is

Index object

Read/write until the TableDef object that the Index object is appended to is appended to a Database object; then the property is read-only.

QueryDef object

Read-only

Recordset object

Read-only

Relation object

Not supported

TableDef object

Read/write

When you set multiple attributes, you can combine them by summing the appropriate constants. Any invalid values are ignored without producing an error.

Example

This example displays the Attributes property for Field2, Relation, and TableDef objects in the Northwind database.

Sub AttributesX() 
 
 Dim dbsNorthwind As Database 
 Dim fldLoop As Field2 
 Dim relLoop As Relation 
 Dim tdfloop As TableDef 
 
 Set dbsNorthwind = OpenDatabase("Northwind.mdb") 
 
 With dbsNorthwind 
 
 ' Display the attributes of a TableDef object's 
 ' fields. 
 Debug.Print "Attributes of fields in " & _ 
 .TableDefs(0).Name & " table:" 
 For Each fldLoop In .TableDefs(0).Fields 
 Debug.Print " " & fldLoop.Name & " = " & _ 
 fldLoop.Attributes 
 Next fldLoop 
 
 ' Display the attributes of the Northwind database's 
 ' relations. 
 Debug.Print "Attributes of relations in " & _ 
 .Name & ":" 
 For Each relLoop In .Relations 
 Debug.Print " " & relLoop.Name & " = " & _ 
 relLoop.Attributes 
 Next relLoop 
 
 ' Display the attributes of the Northwind database's 
 ' tables. 
 Debug.Print "Attributes of tables in " & .Name & ":" 
 For Each tdfloop In .TableDefs 
 Debug.Print " " & tdfloop.Name & " = " & _ 
 tdfloop.Attributes 
 Next tdfloop 
 
 .Close 
 End With 
 
End Sub