Microsoft Office Tutorials and References
In Depth Information
Session 2.1
When you use the number data type to define a field, you should set the field’s Field Size
property based on the largest value that you expect to store in that field. Access processes
smaller data sizes faster, using less memory, so you can optimize your database’s perfor-
mance and its storage space by selecting the correct field size for each field. For example, it
would be wasteful to use the Long Integer setting when defining a field that will store only
whole numbers ranging from 0 to 255, because the Long Integer setting will use four bytes
of storage space. A better choice would be the Byte setting, which uses one byte of storage
space to store the same values. Field Size property settings for number fields are as follows:
Byte: Stores whole numbers (numbers with no fractions) from 0 to 255 in one byte
Integer: Stores whole numbers from
32,768 to 32,767 in two bytes
Long Integer (default) : Stores whole numbers from
2,147,483,648 to 2,147,483,647 in
four bytes
Single: Stores positive and negative numbers to precisely seven decimal places and uses
four bytes
Double: Stores positive and negative numbers to precisely 15 decimal places and uses
eight bytes
Replication ID: Establishes a unique identifier for replication of tables, records, and other
objects and uses 16 bytes
Decimal: Stores positive and negative numbers to precisely 28 decimal places and uses
12 bytes
Setting Field Captions
The Caption property specifies how a field name will appear in datasheets and in other
database objects, such as forms and reports. If you don’t specify a caption, Access uses
the field name as the default column heading in datasheets and as the default label in
forms and reports. Because field names should not include spaces, some names might
be difficult to read. For example, the Position table will include a field named
“HoursPerWeek.” This name looks awkward and might be confusing to users of the
database. By setting the Caption property for this field to “Hours/Week,” you can
improve the readability of the field name displayed.
Elsa documented the design for the new Position table by listing each field’s name, data
type, size (if applicable), caption (if applicable), and description, as shown in Figure 2-5.
Note that Elsa assigned the text data type to the PositionID, PositionTitle, EmployerID, and
ReferredBy fields; the currency data type to the Wage field; the number data type to the
HoursPerWeek and Openings fields; and the date/time data type to the StartDate and
EndDate fields.
Figure 2-5
Design for the Position table
Field Name
Data Type
Field Size
Caption
Description
PositionID
PositionTitle
EmployerID
Wage
HoursPerWeek
Openings
ReferredBy
StartDate
EndDate
Text
Text
Text
Currency
Number
Number
Text
Date/Time
Date/Time
4
30
5
Position ID
Position Title
Employer ID
Primary key
Foreign key
Rate per hour
Work hours per week
Number of openings
Integer
Integer
30
Hours/Week
Referred By
Start Date
End Date
Month/day/year
Month/day/year
 
Search JabSto ::




Custom Search