Microsoft Office Tutorials and References
In Depth Information
You may naturally assume that the PurchasePrice field always includes numeric
content and that the DateAcquired field always includes something that can be
interpreted as a date. But if you haven’t set the data types correctly, Access doesn’t share
your assumptions and doesn’t follow the same rules.
When you create a new field in Datasheet view, Access makes an educated guess
about the data type by examining the information you’ve just typed in. If you type
, then Access assumes you’re creating a number field. If you type Jan 6, 2010 , then 44
Access recognizes a date. However, it’s easy to confuse Access, which leads to the
problems shown in Figure 26-1.
Here, Access doesn’t recognize the date format
used for the DateAcquired field when it was
created. As a result, Access treats that field as
ordinary text. You can enter dates in several
different formats (which makes the DateAcquired
information harder to read and impossible to
sort). You also let in completely nonsensical
entries, like “fourscore bananas.”
To prevent invalid entries, you need to tell Access what each field should contain.
Once you set the rules, Access enforces them rigorously. You put these requirements
in place using another window—the Design view of your table.
When you create a new database, Access starts you off with a single table and shows
that table in Datasheet view. (As you learned last chapter, Datasheet view is the
gridlike view where you can create a table and enter data.) To switch to Design view,
right-click the tab name (like “Dolls: Table”), and then choose Design View. (Or you
can use the Home ➝ Views ➝ View command or the View buttons at the bottom of the
Access window. Figure 26-2 shows all your options. All of these commands do the
same thing, so pick whichever approach seems most convenient.)
Note: If you’ve opened an old Access 2003 database, you won’t see any tabs. Instead, you’ll get a bunch
of overlapping windows. You can remedy this problem and get your tabs back by following the
instructions on page 704. Or, if you want to keep the overlapping windows, just use the view buttons or the
ribbon to change views (instead of the right-click-the-tab-title approach described in Figure 26-2).