Monday, October 29, 2018

Add a field to a table

Add a field to a table

To store a new piece of data about something for which you already have an Access table, consider adding a field to the table. For example, suppose you have a table that stores the last name, first name, email address, telephone number, and mailing address of each of your customers. If you want to start tracking each customer's preferred means of communication, you add a field to store that data.

Do not add a field if you expect that each unique entity represented in the table might require more than value for the field. Continuing the preceding example, if you want to start tracking orders placed by your customers, you do not add a field to the table, because each customer will have more than one order. Instead, you create a new table to store orders, and then create a relationship between the two tables. For more information about creating a table, see the article Introduction to tables. For more information about table relationships, see the article Guide to table relationships.

In this article

Overview

Add a field automatically by entering data

Add a field by picking from a list on the Datasheet

Add a field in the middle of a table

Change a field that you just added

Overview

Every field has certain essential characteristics, such as a name that uniquely identifies the field within a table, a data type that defines the nature of the data, the operations that can be performed on the data, and how much storage space to set aside for each value.

A field also has properties that define the appearance or behavior of the data in the field. For example, the Format property defines how the data appears in a datasheet or form that contains that field.

It is important to plan how you might use the information stored in the fields. Try to break information down to its smallest useful part per field. For example, instead of storing a person's name in one field, you should store its components in separate fields for the first and last name. Generally speaking, if you need to report, sort, search, or calculate on an item, put that item in a field by itself.

For more information about designing a database and choosing fields, see the article Database design basics.

Add a field automatically by entering data

You can add a field to a table by typing into the last column in Datasheet view. Access automatically assigns a data type based on the data that you enter. Access may also automatically set the Format property for a new field. For example, if you enter 10:50 am, Access sets the data type to Date/Time and the Format property to Medium Time.

  1. Open the table to which you want to add a field.

  2. Type your data in the cell below the Click to Add column header.

Add a field by picking from a list on the Datasheet

You can add a field to the end of a table by picking from a list:

  • Open the table, and in the last column, click Click to Add.

Add a field in the middle of a table

If you want to add a new field in the middle of table, you can choose a field from the Fields tab on the ribbon. The Fields tab displays predefined fields that you can add to a table while working in Datasheet view.

  1. Open the table in Datasheet view.

  2. Select the field in front of the position where you want to add a new field. For example, if you want the new field to be the third field in the table, select the second field.

  3. On the Fields tab, in the Add & Delete group, click the field type that you want.

    Tip:  If you don't see a field type that you want, click More Fields.

Change a field that you just added

You can change various aspects of a field after you create it.

Warning:  You can also change these aspects of a field that you did not just create. However, if data already exists in the field some actions will not be available, or may cause data loss.

Rename a field

To rename a field, double-click the field label, and then type the new name.

Move a field

To move a field, drag it to the position that you want. To select multiple contiguous fields to move, click the first field, hold down the SHIFT key, and then click the last field. You can then drag the selected group of fields to a new position.

Important:  Dragging a field changes its position on the Datasheet, but does not change the order of the fields in the table design. If you programmatically access the fields, the original order applies. For example, if you drag a field to a new position on the Datasheet, and then create a form from the table by using the Form button, the field will be in its original position.

Change the data type or format

  1. Select the field that you want to change.

  2. On the Fields tab, in the Formatting group, select the data type and format that you want.

    Note:  Not all formats are available for all data types. Set the data type first, and then, if needed, set the format.

Other settings

You can make other changes to a field by using the commands on the Fields tab. Not all of these commands are available for all data types. For Help using these commands, search Help using the name of the specific command or the data type of the field. If you want to change the data type, search using the data type that you want to use.

Top of Page

No comments:

Post a Comment