Data Types

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

DATA TYPES

Data Types come in all different shapes and sizes dependent upon the data
you want to store in your individual fields.

Figure 2. Access Data Types

You can set the data type for any field in Design View.

On the following page, you’ll find a table listing many of the common data
types for Access 2003 as well as their uses and field sizes.

The following table describes some of the more common data types available for fields in
Access.

Data type Stores Size

Text Use for text, or text and numbers that are not Up to 255 characters.
used in calculations (for example, a product
ID).
Use for text greater than 255 characters in Up to 1 gigabyte of characters, or 2
Memo length. Notes and lengthy descriptions are gigabytes of storage (2 bytes per
good examples of where you would use a character), of which you can display
Memo field 65,535 characters in a control.
Use for storing numbers to be used in 1, 2, 4, or 8 bytes, or 16 bytes when
Number calculations, except for monetary values (use used for replication ID.
the Currency for data type for monetary
values).

Date/Time Use for storing date/time values. Note that 8 bytes.


each value stored includes both a date
component and a time component.
Currency Use for storing monetary values (currency). 8 bytes.

Auto Use for generating unique values that can be 4 bytes or 16 bytes when used for
Number used as a primary key. Note that AutoNumber replication ID.
fields can be incremented sequentially, by a
specified increment, or chosen randomly.

Yes/No Use for True/False fields that can hold one of 1 bit (8 bits = 1 byte).
two possible values: Yes/No or True/False, for
example.
Use for storing hyperlinks to provide single- Up to 1 gigabyte of characters, or 2
click access to Web pages through a URL gigabytes of storage (2 bytes per
Hyperlink (Uniform Resource Locator) or files through a character), of which you can display
name in UNC (universal naming convention) 65,535 characters.
format. You can also link to Access objects
stored in a database.
Use to create a field that allows you to choose
Lookup a value from another table or from a list of Requires the same storage size as
Wizard values using a combo box—-choosing this the primary key that corresponds to
option in the data type list starts a wizard to the Lookup field—-typically 4 bytes.
define this for you.

DATA TYPE PROPERTIES

You can set just about every


default value for a field in a
table using the Field
Properties pane.

Figure 26. Field


Properties/Table Design View

Property Definition
Field Size Set the maximum size for data stored in a field set to the Text (0-255), Number, or
AutoNumber (Long Integer or Replication ID) data type.
Customize the way numbers, dates, times, and text are displayed and printed.
Format While it would be too lengthy to review all available formats, two interesting ones
are: < forces all characters to be lowercase and > forces all characters to be
uppercase.

Input Mask Makes data entry easier and control the values users can enter. For example, you
can use an Input Mask to automatically enter parenthesis and hyphens in phone
numbers.
Caption Provide helpful information to the user through captions on objects in various
views. If you don’t specify a caption, the field’s Field Name property is displayed in
table, form and report view.

Default Value Automatically entered in a field when a new record is created. This is useful is most
new records will have the same entry such as setting the State to VA. The Data
Entry person can always override the default value.
Validation Rule Specify requirements for data entered into a record, field, or control. This is helpful
when data needs to be within a certain number range, for example.
Validation Text When data is entered that violates the Validation Rule setting, you can use this
property to specify the message to be displayed to the user.
Required Specify whether a value is required in a field.
Only for Text, Memo and Hyperlink table fields, you can use this property to specify
Allow Zero whether a zero-length string (” “) is a valid entry in a table field. This field property
Length works independently of the Required property. The Required property determines
only whether a Null value is valid for the field. If the Allow Zero Length property is
set to Yes, a zero-length string will be a valid value for the field regardless of the
setting of the Required property.

Indexed An index speeds up queries on the indexed fields as well as sorting and grouping
operations. If the primary key for a table is a single field, Microsoft Access will
automatically set the Indexed property for that field to Yes (No Duplicates).
When set to Yes, any character whose first byte is 0 is compressed when it is stored
Unicode and uncompressed when it is retrieved. This is simply a storage method. In Access
Compression 97 & earlier, each character consumer 1 byte of space. With Access 2000 and later,
that number increased to 2 bytes. Unicode Compression is a means of counter-
acting, when possible, the effects of the increased byte size of data in a Text, Memo
or Hyperlink field.
IME (Input An Input Method Editor (IME) is a program that allows you to enter Asian text in
Method Editor) programs by converting your keystrokes into Asian characters. In general, you
Mode should be fine leaving this property as “No Control.”
IME Sentence Property to specify or determine the IME Sentence Mode of fields of a table or
Mode controls of a form. This is used with IME Mode.
You can save time by using smart tags to perform actions in Microsoft Office
Smart Tags Access 2003 that you’d usually open other programs to perform such as sending an
email using Outlook. You can attach smart tags to a file in a table or query or to
controls a form or report.

You might also like