Introduction To Data Types and Field Properties
Introduction To Data Types and Field Properties
Show All
This article provides an overview of data types and field properties, and includes a
detailed data type reference section. This article also briefly explains Lookup fields. This
article does not discuss Lookup fields that allow multiple values. Find links to more
information about Lookup fields that allow multiple values in the See Also section.
In this article
Overview
Data type reference
Overview
Every field in a table has properties. These properties define the field's characteristics
and behavior. The most important property for a field is its data type. A field's data type
determines what kind of data it can store. For example, a field whose data type is Text
can store data that consists of either text or numerical characters, but a field whose
data type is Number can store only numerical data.
A field's data type determines many other important field qualities, such as:
When you create a new field in Design view, you specify the field's data type and,
optionally, its other properties.
Contacts table open in Design view
Data type
Field properties
When you create a field in Datasheet view, the field's data type is defined for you. If you
create a field in Datasheet view by using a field template or by using an existing field
from another table, the data type is already defined in the template or in the other
table. If you create a field by entering data in Datasheet view, Microsoft Office Access
assigns a data type to the field based on the values that you enter. If you enter values
that are of different data types in the field, Access may prompt you to make a decision
about the data type.
You can change the field's data type and its Format, Indexed, and Required field
properties in Datasheet view.
Contacts table open in Datasheet view
Create a field by entering data in an empty column.
Adjust the field's data type and other properties by using the Datasheet tab on the
Ribbon.
Data types
Think of a field's data type as a set of qualities that applies to all the values contained in
the field and that determines what kind of data those values can be. For example,
values that are stored in a Text field can contain only letters, numbers, and a limited set
of punctuation characters. In addition, a Text field can contain a maximum of 255
characters.
TIP Have you ever wanted add a calculated field to a table? In Access 2010,
Attachment Files, such as digital photos. Multiple files can be attached per record. This
data type is not available in earlier versions of Access.
AutoNumber Numbers that are automatically generated for each record.
Currency Monetary values.
Date/Time Dates and times.
Hyperlink Hyperlinks, such as e-mail addresses.
Memo Long blocks of text and text that use text formatting. A typical use of a Memo field
would be a detailed product description.
Number Numeric values, such as distances. Note that there is a separate data type for
currency.
OLE Object OLE objects, such as Word documents.
Text Short, alphanumeric values, such as a last name or a street address.
Yes/No Boolean values.
TIP Sometimes, the data in a field may appear to be one data type, but is actually
another. For example, a field may seem to contain numeric values but may actually
contain text values, such as room numbers. You can often use an expression to
compare or convert values of different data types.
Lookup fields
You can set a field's data type to Lookup Wizard. Doing this starts the Lookup Wizard,
which helps you create a Lookup field. A Lookup field displays either a list of values that
is retrieved from a table or query, or it displays a static set of values that you specified
when you created the field.
In the Lookup Wizard, you can enter either a static list of values or specify a source for
the values that you want to retrieve, such as a field in a table. The data type of a
Lookup field is either Text or Number, depending on the choices that you make in the
wizard.
NOTE Lookup fields have an additional set of field properties, which are located on
the Lookup tab in the Field Properties pane.
Find links to more information about Lookup fields in the See Also section.
Field properties
After you create a field and set its data type, you can set additional field properties. The
field's data type determines which other properties you can set. For example, you can
control the size of a Text field by setting itsField Size property.
For Number and Currency fields, the Field Size property is particularly important,
because it determines the range of field values. For example, a one-bit Number field
can store only integers ranging from 0 to 255.
The Field Size property also determines how much disk space each Number field value
requires. Depending on the field size, the number can take up exactly 1, 2, 4, 8, 12, or
16 bytes.
NOTE Text and Memo fields have variable field value sizes. For these data types, Field
Size sets the maximum space available for any one value.
You can find more information about field properties and how they work with the
different data types in the data type reference section of this article.
Data types in relationships and joins
A join is an SQL operation that combines data from two sources into one record in a
query recordset on the basis of values in a specified field that the sources have in
common. A join can be an inner join, a left outer join, or aright outer join.
When you create a table relationship or add a join to a query, the fields that you
connect must have the same or compatible data types. For example, you cannot create
a join between a Number field and a Text field, even if the values in those fields match.
NOTE In a relationship or a join, fields that are set to the AutoNumber data type are
compatible with fields that are set to the Number data type if the Field Size property of
the latter is Long Integer.
TIP In a query, you can sometimes use the Like operator in a field criterion to
compare fields that have incompatible data types.
You cannot change the data type or the Field Size property of a field that is involved in
a table relationship. You can temporarily delete the relationship to change the Field
Size property, but if you change the data type, you won't be able to re-create the
relationship without first also changing the data type of the related field.
Find more information about table relationships or joins in the See Also section.
TOP OF PAGE
The following section contains detailed information about data types —their purpose
and how they work.
Attachment
AutoNumber
Currency
Date/Time
Hyperlink
Memo
Number
OLE Object
Text
Yes/No
Attachment
Purpose Use an attachment field to attach multiple files, such as images, to a record.
Suppose that you have a job contacts database. You can use an attachment field to
attach a photo of each contact, and you can also attach one or more resumes for a
contact to the same field in that record.
For some file types, Access compresses each attachment as you add it.
You can attach many different types of files to a record, but some file types that may
pose security risks are blocked. As a rule, you can attach any file that was created in
one of the 2007 Microsoft Office system programs. You can also attach log files (.log),
text files (.text, .txt), and compressed .zip files. For a list of supported image file
formats, see the table later in this section.
PROPERT USE
Y
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Required Requires that each record has at least one attachment for the
field.
Supported image file formats
Access supports the following graphic file formats without the need for additional
software being installed on your computer.
The names of your attached files can contain any Unicode character supported by the
NTFS file system that is used in Microsoft Windows NT. In addition, file names must
conform to the following guidelines:
Names must not exceed 255 characters, including the file name extensions.
Names cannot contain the following characters: question marks (?), quotation marks ("),
forward or backward slashes (/ \), opening or closing brackets (< >), asterisks (*), vertical
bars or pipes (|), colons (:), or paragraph marks (¶).
TOP OF PAGE
AutoNumber
Purpose Use an AutoNumber field to provide a unique value that serves no other
purpose than to make each record unique. The most common use for an AutoNumber
field is as a primary key, especially when no suitable natural key (a key that is based on
a data field) is available.
An AutoNumber field value requires 4 or 16 bytes, depending on the value of its Field
Size property.
Suppose that you have a table that stores contacts' information. You can use contact
names as the primary key for that table, but how do you handle two contacts with
exactly the same name? Names are unsuitable natural keys, because they are often not
unique. If you use an AutoNumber field, each record is guaranteed to have a unique
identifier.
NOTE You should not use an AutoNumber field to keep a count of the records in a
table. AutoNumber values are not reused, so deleted records can result in gaps in your
count. Moreover, an accurate count of records can be easily obtained by using a Totals
row in a datasheet.
Currency
Purpose Use to store monetary data.
Data in a Currency field is not rounded off during calculations. A Currency field is
accurate to 15 digits to the left of the decimal point and 4 digits to the right. Each
Currency field value requires 8 bytes of storage.
PROPERTY USE
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Decimal Specifies the number of decimal places to use when
Places displaying numbers.
Default Automatically assigns the specified value to this field
Value when a new record is added.
Format Determines the way that the field appears when it is
displayed or printed in datasheets or in forms or reports
that are bound to the field. You can use any valid number
format. In most cases, you should set the Format value
to Currency.
Indexed Specifies whether the field has an index. There are three
available values:
Date/Time
PROPERTY USE
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Default Value Automatically assigns the specified value to this field
when a new record is added.
Format Determines the way that the field appears when it is
displayed or printed in datasheets, or in forms or reports
that are bound to the field. You can use a predefined
format or build your own custom format.
List of predefined formats
Lists of components that you can use in custom formats
IME Mode Controls the conversion of characters in East Asian
versions of Windows.
IME Sentence Controls the conversion of sentences in East Asian
Mode versions of Windows.
Indexed Specifies whether the field has an index. There are three
available values:
Hyperlink
Purpose Use to store a hyperlink, such as an e-mail address or a Web site URL.
PROPERTY USE
Allow Zero Allows entry (by setting to Yes) of a zero-length string
Length ("") in a Hyperlink, Text, or Memo field.
Append Only Determines whether to track field value changes. There
are two settings:
Memo
Purpose Use to store a block of text that is more than 255 characters in length and is
formatted text.
PROPERTY USE
Allow Zero Allows entry (by setting to Yes) of a zero-length string
Length ("") in a Hyperlink, Text, or Memo field.
Append Only Determines whether to track field value changes. There
are two settings:
Number
Purpose Use to store a numeric value that isn't a monetary value. If you might use
the values in the field to perform a calculation, use the Number data type.
PROPERTY USE
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Decimal Specifies the number of decimal places to use when
Places displaying numbers.
Default Automatically assigns the specified value to this field
Value when a new record is added.
Field Size Select one of the following:
OLE Object
Purpose Use to attach an OLE Object, such as a Microsoft Office Excel spreadsheet,
to a record. If you want to use OLE features, you must use the OLE Object data type.
In most cases, you should use an Attachment field instead of an OLE Object field. OLE
Object fields support fewer file types than Attachment fields support. In addition, OLE
Object fields do not allow you to attach multiple files to a single record.
PROPERT USE
Y
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Required Requires that data be entered in the field.
Text Align Specifies the default alignment of text within a control.
TOP OF PAGE
Text
PROPERTY USE
Allow Zero Allows entry (by setting to Yes) of a zero-length string
Length ("") in a Hyperlink, Text, or Memo field.
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Default Value Automatically assigns the specified value to this field
when a new record is added.
Field Size Enter a value from 1 to 255. Text fields can range from 1
to 255 characters. For larger text fields, use the Memo
data type.
TIP For best performance, always specify the smallest
sufficient Field Size.
For example, if you are storing postal codes of a known
length, you should specify that length as the Field Size.
Format Determines the way that the field appears when it is
displayed or printed in datasheets or in forms or reports
that are bound to the field. You can define a custom
format for a Text field. Find more information about
defining a format in the See Also section.
IME Mode Controls the conversion of characters in East Asian
versions of Windows.
IME Sentence Controls the conversion of sentences in East Asian
Mode versions of Windows.
Indexed Specifies whether the field has an index. There are three
available values:
Yes/No
PROPERTY USE
Caption The label text that is displayed for this field by default in
forms, reports, and queries. If this property is empty, the
name of the field is used. Any text string is allowed.
TIP An effective caption is usually brief.
Default Automatically assigns the specified value to this field
Value when a new record is added.
Format Determines the way that the field appears when it is
displayed or printed in datasheets, or in forms or reports
that are bound to the field. Select one of the following: