Get free website from www.webkinghost.in
We are specialists in free hosting services using clustered technology powered by one of the largest hosting organisations on the internet. Sign up here for fast free PHP & MySQL hosting including a free sub domain. A powerful Vista Panel control panel is provided to manage your website, packed with hundreds of great features including Email, FTP add-on domain and much more....
Free Hosting:- Instant activation free hosting with PHP, MySQL, FTP, File manager, Website Builder, automatic script installer and much more!Premium Hosting:- Unlimited disk space, no daily hit limits, 256 Softiculious script installer and many more features not included in free hosting
Domain Registration:- Get your own domain name such as a .TK .COM .NET .ORG .BIZ .US .EU .INFO with free WHOIS privacy included.
_________________________________________________________________________________
Introduction to data types and field properties
Every table is made up of fields. The properties of a field describe the characteristics and behavior of data added to that field. A field's data type is the most important property because it determines what kind of data the field can store. This article describes the data types and other field properties available in Microsoft Access 2010, and includes additional information in a detailed data type reference section.
In this article
- Overview
- When to use which data type
- Additional field properties
- Data types in relationships and joins
- Reference for data types
Overview
Data types can seem confusing for example, if a field's data type is Text, it can store data that consists of either text or numerical characters. But a field whose data type is Number can store only numerical data. So, you have to know what properties are used with each data type.A field's data type determines many other important field qualities, such as the following:
- Which formats can be used with the field.
- The maximum size of a field value.
- How the field can be used in expressions.
- Whether the field can be indexed.
- Use an existing field from another table, the data type is already defined in the template or in the other table.
- Enter data in a blank column (or field), Access 2010 assigns a data type to the field based on the values that you enter or you can assign the data type and format for the field.
- On the Modify Fields tab, in the Fields & Columns group, click Add Fields, Access 2010 displays a list of data types that you can select from.
When to use which data type
Think of a field's data type as a set of qualities that applies to all the values that are contained in the field. For example, values that are stored in a Text field can contain only letters, numbers, and a limited set of punctuation characters, and a Text field can only contain a maximum of 255 characters.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.
The available data types in Access 2010 are, Basic Types, Number, Data and Time, Yes/No, and Quick Start. The following tables show you the formats available for each data type and explain the effect of the formatting option.
Basic Types
Format | Use to display |
---|---|
Text | Short, alphanumeric values, such as a last name or a street address. |
Number | Numeric values, such as distances. Note that there is a separate data type for currency. |
Currency | Monetary values. |
Yes/No | Yes and No values and fields that contain only one of two values. |
Date/Time | Date and Time values for the years 100 through 9999. |
Rich Text | Text or combinations of text and numbers that can be formatted using color and font controls. |
Calculated Field | Results of a calculation. The calculation must refer to other fields in the same table. You would use the Expression Builder to create the calculation. |
Attachment | Attached images, spreadsheet files, documents, charts, and other types of supported files to the records in your database, similar to attaching files to e-mail messages. |
Hyperlink | Text or combinations of text and numbers stored as text and used as a hyperlink address. |
Memo | Long blocks of text. A typical use of a Memo field would be a detailed product description. |
Lookup | Displays either a list of values that is retrieved from a table or query, or a set of values that you specified when you created the field. The Lookup Wizard starts and you can create a Lookup field. 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. |
Number
Format | Use to display |
---|---|
General | Numbers without additional formatting exactly as it is stored. |
Currency | General monetary values. |
Euro | General monetary values stored in the EU format. |
Fixed | Numeric data. |
Standard | Numeric data with decimal. |
Percentage | Percentages. |
Scientific | Calculations. |
Date and Time
Format | Use to display |
---|---|
Short Date | Display the date in a short format. Depends on your regional date and time settings. For example, 3/14/2001 for USA. |
Medium Date | Display the date in medium format. For example, 3-Apr-09 for USA. |
Long Date | Display the date in a long format. Depends on your the regional date and time settings. For example, Wednesday, March 14, 2001 for USA. |
Time am/pm | Display the time only using a 12 hour format that will respond to changes in the regional date and time settings. |
Medium Time | Display the time followed by AM/PM. |
Time 24hour | Display the time only using a 24 hour format that will respond to changes in the regional date and time settings |
Yes/No
Data Type | Use to display |
---|---|
Check Box | A check box. |
Yes/No | Yes or No options |
True/False | True or False options. |
On/Off | On or Off options. |
Quick Start
Data Type | Use to display |
---|---|
Address | Fields for the entire postal address. |
Phone | Fields for the Home Phone, Mobile Phone, and the Work Phone. |
Priority | A drop-down box with the following priority options: Low, Medium, High. |
Status | A drop-down box with the following options: Not Started, In Progress, Completed, Cancelled. |
Tags | Displays up to three tags. |
Field size property
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 that you can set. For example, you can control the size of a Text field by setting its Field Size property.For Number and Currency fields, the Field Size property is especially 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 use 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.
For more details about field properties and how they work with the different data types go to the Reference for data types section. Also read the article Set the field size.
Data types in relationships and joins
A table relationship is an association between common fields in two tables. A relationship can be one-to-one, one-to-many, or many-to-many.A join is a SQL operation that combines data from two sources into one record in a query recordset based on values in a specified field that the sources have in common. A join can be an inner join, a left outer join, or a right 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.
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.
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. However, 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. For more information on tables see the article, Introduction to tables.
Data type reference
When you apply a data type to a field, it contains a set of properties that you can select. Click on data types below for more information.Attachment
Purpose Used in a field that allows attaching files or images to a record. For example, if you have a job contacts database, you can use an attachment field to attach a photo of the contact, or attach documents such as a resume. For some file types, Access compresses each attachment as you add it.Types of attachments that Access compresses
You can attach many kinds of files to a record. However, 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.
List of blocked file types
Supported field properties
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. |
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.- Windows Bitmap (.bmp files)
- Run Length Encoded Bitmap (.rle files)
- Device Independent Bitmap (.dib files)
- Graphics Interchange Format (.gif files)
- Joint Photographic Experts Group (.jpe, .jpeg, and .jpg files)
- Exchangeable File Format (.exif files)
- Portable Network Graphics (.png files)
- Tagged Image File Format (.tif and .tiff files)
- Icon (.ico and .icon files)
- Windows Metafile (.wmf files)
- Enhanced Metafile (.emf files)
File naming conventions
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 follow 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 (¶).
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.
Supported field properties
Property | Use |
---|---|
Field Size | Determines the amount of space that is allocated for each value. For AutoNumber fields, only two values are allowed:
Note Replication is not supported in databases that use a new file format, such as .accdb. This setting makes AutoNumber fields compatible with other Long Integer Number fields when they are used in relationships or joins. Each field value requires 4 bytes of storage.
Each field value requires 16 bytes of storage. |
New Values | Determines whether AutoNumber field increments with each new value or uses random numbers. Select one of the following:
|
Format | If you are using an AutoNumber field as a primary key or as a Replication ID, you should not set this property. Otherwise, choose a number format that meets your specific needs. |
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. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
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.
Supported field properties
Property | Use |
---|---|
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. |
Decimal Places | Specifies the number of decimal places to use when displaying numbers. |
Input Mask | Displays editing characters to guide data entry. For example, an input mask might display a dollar sign ($) at the beginning of the 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. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
Required | Requires that data be entered in the field. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
Date/Time
Purpose Use to store time-based data.Supported field properties
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 Mode | Controls the conversion of sentences in East Asian versions of Windows. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Input Mask | Displays editing characters to guide data entry. For example, an input mask might display a dollar sign ($) at the beginning of the field. |
Required | Requires that data be entered in the field. |
Show Date Picker | Specifies whether to show the Date Picker control. Note If you use an input mask for a Date/Time field, the Date Picker control is unavailable regardless of how you set this property. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
Hyperlink
Purpose Use to store a hyperlink, such as an e-mail address or a Web site URL.A hyperlink can be a UNC path or a URL. It can store up to 2048 characters.
Supported field properties
Property | Use |
---|---|
Allow Zero Length | Allows entry (by setting to Yes) of a zero-length string ("") in a Hyperlink, Text, or Memo field. |
Append Only | Determines whether to track field value changes. There are two settings:
|
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 define a custom format for a Hyperlink field. |
IME Mode | Controls the conversion of characters in East Asian versions of Windows. |
IME Sentence Mode | Controls the conversion of sentences in East Asian versions of Windows. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Required | Requires that data be entered in the field. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
Unicode Compression | Compresses text that is stored in this field when less than 4,096 characters are stored. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
Memo
Purpose Use to store a block of text that is more than 255 characters long and is formatted text.Supported field properties
Property | Use |
---|---|
Allow Zero Length | Allows entry (by setting to Yes) of a zero-length string ("") in a Hyperlink, Text, or Memo field. |
Append Only | Determines whether to track field value changes. There are two settings:
Warning Setting this property to No deletes any existing field value history. |
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 define a custom format for a Memo field. |
IME Mode | Controls the conversion of characters in East Asian versions of Windows. |
IME Sentence Mode | Controls the conversion of sentences in East Asian versions of Windows. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Required | Requires that data be entered in the field. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
Unicode Compression | Compresses text that is stored in this field when less than 4,096 characters are stored. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
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.Supported field properties
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 Places | Specifies the number of decimal places to use when displaying numbers. |
Default Value | Automatically assigns the specified value to this field when a new record is added. |
Field Size | Select one of the following:
Tip Use Long Integer when you create a foreign key to relate to another table's AutoNumber primary key field.
|
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. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Input Mask | Displays editing characters to guide data entry. For example, an input mask might display a dollar sign ($) at the beginning of the field. |
Required | Requires that data be entered in the field. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
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 let you attach multiple files to a single record.
Supported field properties
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. |
Required | Requires that data be entered in the field. |
Text Align | Specifies the default alignment of text within a control. |
Text
Purpose Use to store up to 255 characters of text.Supported field properties
Property | Use |
---|---|
Allow Zero Length | Allows entry (by setting to Yes) of a zero-length string ("") 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. |
IME Mode | Controls the conversion of characters in East Asian versions of Windows. |
IME Sentence Mode | Controls the conversion of sentences in East Asian versions of Windows. |
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Required | Requires that data be entered in the field. |
Smart Tags | Attaches a smart tag to the field. |
Text Align | Specifies the default alignment of text within a control. |
Unicode Compression | Compresses text that is stored in this field when less than 4,096 characters are stored. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
Yes/No
Purpose Use to store a Boolean value.Supported field properties
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. Select one of the following:
|
Indexed | Specifies whether the field has an index. There are three available values:
Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Text Align | Specifies the default alignment of text within a control. |
Validation Rule | Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text | Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |
http://office.microsoft.com/en-in/access-help/introduction-to-data-types-and-field-properties-HA010341783.aspx#top