Datasheet

If you are neither importing nor linking data, the ideal way to create a table
in Access is with the Design view. You looked at the Design view previously
and saw that it is essentially a list of columns and data types in the table. Here
you can enter the names of every column and its matching data type.
Creating a table with Design view
Imagine that a company’s human resources department asks you to create a
simple list of employees in Access. To create a table in Design view, select
Insert Table. This opens the New Table dialog box shown in Figure 1-4.
You must now create a list of attributes, or fields, that describe each
employee in a particular way. Among the more common attributes in this sit-
uation are the following: EmployeeNumber, FirstName, LastName, Address,
City, State, Zip, and HourlyWage. You begin by entering the names of the
columns going down the list.
Default data type
As you enter the field names, you may notice that the data type defaulted to
the most common data type, Text. You now want to set the data types for each
field, or at least change the data type of each non-text field. Choosing the cor-
rect data type for the first field, EmployeeNumber, may be initially confusing.
With the word “Number” in the field, you might think that Number would be
the logical choice for the data type. Actually, the rule of thumb is that if the
field will not be used in a calculation, it is best to set its data type to Text. There
is no logical meaning to performing calculations on the EmployeeNumber
field. It is highly unlikely that adding two values from this column would give
you information of any significance. Another reason for using the Text data
type in the EmployeeNumber field is that there could be alpha characters or
letters in the field.
Data types for calculations
The field names for this particular table should make it fairly obvious that you
will want to set all of the fields to Text, except when it comes to HourlyWage.
This field will almost certainly be used in calculations. For example, multiply-
ing an employee’s hourly wage by 40 will get you his or her weekly salary. So,
because this field will certainly be used in calculations, and because it will rep-
resent a monetary value, you should change the data type to Currency. At this
point, your Design view should look similar to the screen shown in Figure 1-5.
Access Basics 9
05_59978X ch01.qxp 12/1/05 7:46 PM Page 9