DataType Property

Applies To

Table Fields.

Description

You can use the DataType property to specify the type of data stored in a table field. Each field can store data only of a single data type.

Setting

The DataType property uses the following settings.

Setting Type of data Size
Text (Default) Text or combinations of text and numbers, as well as numbers that don’t require calculations, such as phone numbers. Up to 255 characters or the length set by the FieldSize property, whichever is less. Microsoft Access does not reserve space for unused portions of a text field.
Memo Lengthy text or combinations of text and numbers. Up to 64,000 characters.
Number Numeric data used in mathematical calculations. For more information on how to set the specific Number type, see the FieldSize property topic. 1, 2, 4, or 8 bytes (16 bytes for ReplicationID only).
Date/Time Date and time values for the years 100 through 9999. 8 bytes.
Currency Currency values and numeric data used in mathematical calculations involving data with one to four decimal places. Accurate to 15 digits on the left side of the decimal separator. 8 bytes.
AutoNumber A unique sequential (incremented by 1) number or random number assigned by Microsoft Access whenever a new record is added to a table. AutoNumber fields can’t be updated. For more information, see the NewValues property topic. 4 bytes (16 bytes for ReplicationID only).
Yes/No Yes and No values and fields that contain only one of two values (True/False, On/Off). 1 bit.


Setting Type of data Size
OLE Object An object (such as a Microsoft Excel spreadsheet, a Microsoft Word document, graphics, sounds, or other binary data) linked to or embedded in a Microsoft Access table. Up to 1 gigabyte (limited by available disk space)
Lookup Wizard... Creates a field that allows you to choose a value from another table or from a list of values using a combo box. Choosing this option in the Data Type list starts the Lookup Wizard to define the data type. The same size as the primary key field used to perform the lookup, typically 4 bytes.


You can set this property only in the upper portion of table Design view.

In Visual Basic, use the Data Access Objects Type property to read and set an object’s data type.

Remarks

Memo fields and OLE Object fields can’t be indexed.

Tip Use the Currency data type for a field requiring many calculations involving data with one to four decimal places. Single and Double data type fields require floating-point calculation. The Currency data type uses a faster fixed-point calculation.

Caution Changing a field’s data type after you enter data in a table causes a potentially lengthy process of data conversion when you save the table. If the data type in a field conflicts with a changed DataType property setting, you may lose some data.

Set the Format property to specify a custom or one of the predefined display formats for Number, Date/Time, Currency, and Yes/No data types.

See Also

FieldSize Property, Format Property, InputMask Property, NewValues Property.