Access data types

The data type of a column defines what value the column can hold: integer, character, money, date and time, binary, and so on. An SQL developer must decide what type of data that will be stored inside each column when creating a table. The data type is a guideline for SQL to understand what type of data is expected inside of each column, and it also identifies how SQL will interact with the stored data. Note: Data types might have different names in different database. And even if the name is the same, the size and other details may be different!

Always check the documentation! The p parameter indicates the maximum total number of digits that can be stored both to the left and to the right of the decimal point. Default is The s parameter indicates the maximum number of digits stored to the right of the decimal point. Default value is 0. The n parameter indicates whether the field should hold 4 or 8 bytes. Default value of n is If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:.

The size parameter specifies the column length in characters - can be from 0 to The size parameter specifies the column length in bytes. The size parameter specifies the maximum column length in bytes. Holds up to 4, bytes of data ENUM val1, val2, val3, A string object that can have only one value, chosen from a list of possible values. You can list up to values in an ENUM list.

If a value is inserted that is not in the list, a blank value will be inserted. The values are sorted in the order you enter them SET val1, val2, val3,Keep in touch and stay productive with Teams and Officeeven when you're working remotely.

access data types

When creating tables in Access, you need to select a data type for each column of data. The Short Text data type is a popular choice since it lets you enter almost any character letter, symbol, or number. The table below gives an overview of the data types available in Access desktop databases. For information about data types in Access web apps, see Data types for Access web apps.

For a comprehensive list of all the various field properties available for the various data types, see Introduction to data types and field properties. The following table lists the data types available in desktop databases in Access and later versions. Large amounts of alphanumeric data: sentences and paragraphs.

Up to about 1 gigabyte GBbut controls to display a long text are limited to the first 64, characters. For more information, see Using the Large Number data type. A link address to a document or file on the Internet, on an intranet, on a local area network LANor on your local computer.

You can attach files such as pictures, documents, spreadsheets, or charts; each Attachment field can contain an unlimited number of attachments per record, up to the storage limit of the size of a database file. Note, the Attachment data type isn't available in MDB file formats. You can create an expression that uses data from one or more fields.

You can designate different result data types from the expression. Note, the Calculated data type isn't available in MDB file formats. Dependent on the data type of the Result Type property.

Short Text data type result can have up to characters. When you choose this entry, a wizard starts to help you define either a simple or complex lookup field. A simple lookup field uses the contents of another table or a value list to validate the contents of a single value per row. A complex lookup field allows you to store multiple values of the same data type in each row. The following table lists the data types available in desktop databases in Access and Access Learn more.

Data types.Working with Database Fields Microsoft Access database fields are created by entering a field name and a field data type in each row of the field entry area of the database table window. The field description is an option to identify the fields purpose; it appears in the status bar during data entry. After you enter each field's name and data type, you can specify how each field is used by entering properties in the property area. Before you enter any properties, however, you should enter all of you fields names and data types.

A field name identifies the field to both you and to Microsoft Access. For information regarding field names please see the article: Tables and Fields. After you name a field, you must decide what type of data the field will hold.

access data types

Before you begin entering data, you should have a grasp of the data types that your system will use. Ten basic data types are shown in the table below; some data types such as numbers have several options:. For numeric data types, the field size enables you to further define the type of number, which in turn determines the storage size. The table below shows the seven possible settings in the Numeric Field Size property.

You should make the field size the smallest one possible; Access runs faster with smaller field sizes. Single and Double permit even larger numbers: Single gives you 7 decimal places, and Double allows Use the Double setting when you need many decimal places or very large numbers. Caution: If you convert a large FieldSize setting to a smaller one in a field that already contains data, you might lose data. For example, if you change the FieldSize setting for a Text data type field from to 50, data beyond the new character setting will be discarded.

If the data in a Number data type field doesn't fit in a new FieldSize setting, fractional numbers may be rounded or you might get a Null value. For example, if you change from a Single to an Integer field size, fractional values will be rounded to the nearest whole number and values greater than 32, or less than —32, will result in null fields. Tip: You can use the Currency data type if you plan to perform many calculations on a field that contains data with one to four decimal places.

Single and Double data type fields require floating-point calculation. Currency data type fields use a faster fixed-point calculation. For information regarding field names please see the article: Tables and Fields Specifying a Microsoft Access Data Type After you name a field, you must decide what type of data the field will hold.

Ten basic data types are shown in the table below; some data types such as numbers have several options: Microsoft Access Data Types Data Type Use For Size Text Text or combinations of text and numbers, such as addresses. Also numbers that do not require calculations, such as phone numbers, part numbers, or postal codes. Up to characters.The Access database engine recognizes several overlapping sets of data types.

In Access, there are four different contexts in which you may need to specify a data type—in table Design view, in the Query Parameters dialog box, in Visual Basic, and in SQL view in a query. Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback. Skip to main content. Exit focus mode. The following table compares the five sets of data types that correspond to each context.

The first column lists the Type property settings available in table Design view and the five FieldSize property settings for the Number data type. The second column lists the corresponding query parameter data types available for designing parameter queries in the Query Parameters dialog box.

The third column lists the corresponding Visual Basic data types. The fourth column lists ADO Field object data types.

The fifth column lists the corresponding Jet database engine SQL data types defined by the Access database engine along with their valid synonyms.

It's recognized only for use in queries on linked tables from other database products that support the BINARY data type. Is this page helpful? Yes No. Any additional feedback? Skip Submit.Text: Text data type is used to store alphabeticnumbers and special characters.

It can store up to characters. If length of text field is not specified, the default setting is 50 characters. Memo: Memo data type is used to store lengthy text. It is normally used to store comments etc.

Number: Number data type is used to store numeric data.

Data types for Access desktop databases

The fields with Number data type can be used in mathematical calculation. Different types of numeric data types are as follows:. The Byte, Integer and Long Integer data types cannot store decimal values. If you need to store values with up to four decimal places only, use the Currency data type in preference to Single or Double number fields. The value in Currency field is rounded to two decimal places. The negative currency values are displayed in bra-chests.

AutoNumber: AutoNumber data type is used to generate the next number automatically when a new record is added. It creates a unique number for each record. The value starts from 1 and is incremented by 1 in each record.

This data type is used to enter objects from other applications such as a spreadsheet created in Excel or a picture file. A hyperlink address has up to four parts. The currency formatting consists of four parts separated by semicolons.

These parts are format for positive numbers, format for negative numbers, format for zero values and format for Null values. The user cans also formats the data according to his particular requirements. Different date formats are as follows:. It can be changed to text box by clicking Lookup tab and changing Display Control to a textbox.

The formatting is designated in three sections separated by semicolons. The first section contains nothing but semicolon must be included.

The second section specifies formatting for Yes values and third for No values as Follows:. An input mask controls the value of a record and sets it in a specific format. It is similar to Format property but it displays the format on datasheet before data is entered.

The attribute or combination of attributes that uniquely identifies a row or record in a relation is known as primary key.Keep in touch and stay productive with Teams and Officeeven when you're working remotely. Every table in Access 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 Access, and includes additional information in a detailed data type reference section. When to use which data type. Field size property. Data types in relationships and joins. Data type reference. 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:. A field's data type can be predefined or you will select a data type depending on how you create the new field. For example, if you create a field from the Datasheet view and:.

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 fieldAccess 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. Top of Page. 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 characters.

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 following tables show you the formats available for each data type and explain the effect of the formatting option. Short, alphanumeric values, such as a last name or a street address.

Note, beginning in AccessText data types have been renamed to Short Text. 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. Note, Calculated fields were first introduced in Access 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.

Long blocks of text. A typical use of a Memo field would be a detailed product description. Note, beginning in AccessMemo data types have been renamed to Long Text. 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. Lookup fields have an additional set of field properties, which are located on the Lookup tab in the Field Properties pane.Keep in touch and stay productive with Teams and Officeeven when you're working remotely.

This article provides the background information and steps needed to configure a database to use attachments, and to attach and manage data. Why should I use attachments? Add an attachment field to a table. Attach files directly to tables.

Microsoft Access Data Types

Use attachments with forms and reports. Save attached files to other locations. Remove attached files.

Use attachments without a mouse or other pointing device. Attachments reference. You can use attachments to store several files in a single field, and you can even store multiple types of files in that field.

For example, let's say you own a job contacts database. You can now attach one or more resumes to the record for each contact, plus a photo of each contact. Attachments also store data more efficiently.

By default, OLE created a bitmap equivalent of the image or document. When you viewed an image or a document from your database, OLE showed you the bitmap image, not the original file.

access data types

By using attachments, you open documents and other non-image files in their parent programs, so from within Access, you can search and edit those files. In contrast, Access stores the attached files in their native formats with no supporting images, and you do not need to install additional software in order to view the images from within your database. By default, each field in a relational database contains only one piece of data. For example, if an address field contained more than one address, finding addresses would be difficult, if not impossible.

Attach files and graphics to the records in your database

However, attachments do not break any design rules, because as you attach files to a record, Access creates one or more system tables and uses those tables behind the scenes to normalize your data. You cannot view or work with those tables. For information about viewing other system tables, see the article Guide to the Navigation Pane. For information about database design, see the article Database design basics.

Remember these guidelines as you work with attached files:. You can attach files only to databases that you create in Access and that use the. You cannot share attachments between a Access. You must create a field in a table and set that field to the Attachments data type. After you set the data type to Attachments, you cannot change it. You can store multiple files in a single record. For example, you can store images, and files created with word processing and spreadsheet programs.