Lesson 2.5. Modifying a Table and Understanding Data Types
Figure 2-8. A table in Design view.
Once you have created a table, you can modify it later in Design view. Design view allows you to change the structure of a table by adding, deleting, and its fields.
Because there are so many different types of data, Access offers several different types of fields. A field's data type determines the type of information that can be stored in a field. Table 2-3 lists the various available in Access. A field's data type restricts what type of information you can enter in a field. For example, you cannot enter text into a number field.
In this lesson you will modify a table by adding a new field and then determining the field's data type.
Click the Contacts table and click the Design button in the Database window.
Tip: Other ways to modify a table are to open the table and click the View button on the toolbar, or open the table and select View
The Contacts table appears in Design view, as shown in Figure 2-8, which allows you to add, delete, or modify the table's structure and fields.
Here's how to change a field name in Design view:
Scroll down, if necessary, and select the PostalCode field in the Field Names column. Replace the text "PostalCode" with ZipCode.
That's how easy it is to change a field name. Now try adding a new field to the table.
Press Tab three times.
The cursor should be located in the blank Field Name box below the ZipCode field. To add a field in Design view, simply type a new field name in any blank Field Name box.
Type Birthday and press Tab.
By default, the Text data type is assigned to all new fields. Here's how to change a field's data type:
If it is not already selected, click the Data Type box next to the Birthday field.
A list arrow appears on the right side of the box.
Click the list arrow and select Date/Time from the list.
The new Birthday field will now only accept date and time information. The new Date/Time data type also makes your database more flexible and powerful because now you can sort birthdays by date or even use them in a calculationfor example, to determine a person's age.
Once you have finished modifying a table, you have to save your changes.
Click the Save button on the toolbar to save your changes.
Tip: Other ways to save a database object are to press Ctrl + S, or select File
You've finished modifying the table, so...
Close the Contacts table.
Table 2-3. Data Types
Stores text, numbers, or a combination of both, up to 255 characters long. Text fields are the most common of all data types.
Sally displays a high amount of...
Stores long text entriesup to 64,000 characters long (the equivalent of 18 pages of text!). Use memo fields to store notes or anything else that requires a lot of space.
Stores numbers that can be used in calculations.
April 7, 1969
Stores dates, times, or both.
Stores numbers and symbols that represent money.
Automatically fills in a unique number for each record. Many tables often contain an AutoNumber field that is also used as their primary key.
Stores only one of two values, such as Yes or No, True or False, etc.
Stores objects created in other programs such as a graphic, Excel spreadsheet, or Word document.
Stores clickable links to files on your computer, on the network, or to Web pages on the Internet.
Purpose of Trip:
A wizard that helps you create a field whose values are selected from a table, query, or a preset list of values.
TO DISPLAY A TABLE IN DESIGN VIEW:
IN THE DATABASE WINDOW, CLICK THE TABLES ICON IN THE OBJECTS BAR, SELECT THE TABLE, AND CLICK THE DESIGN BUTTON.
TO CHANGE THE DATA TYPE FOR A FIELD:
DISPLAY THE TABLE IN DESIGN VIEW.
CLICK THE FIELD'S DATA TYPE BOX, CLICK THE LIST ARROW, AND SELECT THE DATA TYPE FROM THE LIST.
TO SAVE CHANGES TO A DATABASE OBJECT:
SELECT FILE OR...