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.
A field's data type determines what type of information the field can store.
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.
Other ways to save a database object are to press Ctrl + S, or select File » Save from the menu.
Data Types
Text
Legal Name: John Doe
Stores text, numbers, or a combination of both, up to 255 characters long. Text fields are the most common of all data types.
Memo
Notes: 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.
Number
Age: 31
Stores numbers that can be used in calculations.
Date/Time
Birthday: April 7, 1969
Stores dates, times, or both.
Currency
Price: $84.95
Stores numbers and symbols that represent money.
AutoNumber
Invoice Number: 187001
Automatically fills in a unique number for each record. Many tables often contain an AutoNumber field that is also used as their primary key.
Yes/No
Employed?: Yes
Stores only one of two values, such as Yes or No, True or False, etc.
OLE Object
Photo:
Stores objects created in other programs such as a graphic, Excel spreadsheet, or Word document.
Hyperlink
Web Site: www.amazon.com
Stores clickable links to files on your computer, on the network, or to Web pages on the Internet.
Lookup Wizard
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 type box, click the list arrow, and select the data type.