Lesson 4.5. Changing a Field's Data Type
Figure 4-6. A field's data type determines what type of information the field can store.
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, as shown in Figure 4-6. Table 4-2 lists the various data types available in Access. A field's data type helps prevent data-entry errors because it restricts what type of information you can enter in a field. For example, you cannot enter text in a number data-type field.
If you've been working with Access for a while, you probably already know some of this stuff. Just consider this lesson a quick review.
Make sure the tblCustomers table is open in Design view.
First you need to select the field whose data type you want to change.
Click the DOB field.
The blinking cursor should appear in the DOB field name. Since the DOB field stores the employee's date of birth, it should be a Date/Time field instead of a Text field. Here's how to change a field's data type:
Click the Data Type box next to the DOB field.
A list arrow appears on the right side of the DOB Data Type box.
Click the list arrow and select Date/Time from the list.
The DOB field will now only accept date and time information. The new also makes your database more flexible and powerful because now you can sort birthdays by date or use a person's birthday 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
Table 4-1. 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 another table, query, or a preset list of values.
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.