Microsoft Office Tutorials and References
In Depth Information
Number
Access Data Types
When you use numeric fields, you don’t include information about the units you’re
using. You may have a field that represents a Weight in Pounds, a Height in Meters,
or an Age in Years. However, these fields contain only a number. It’s up to you to
know what that number signifies. If you think other people may be confused,
consider explaining the units in the description (page 715), or incorporate it into the
field name (like HeightInMeters).
Note: Your field should never, ever contain values like “44 pounds.” Access treats this value as a text
value, so if you make this mistake, you can’t use all of Access’s number-crunching tools.
Number size
As with a text field, when you create a number field, you need to set the Field Size
property to make sure Access reserves the right amount of space. However, with
numbers your options are a little more complicated than they are for ordinary text.
Essentially, numbers are divided into several subgroups, depending on whether they
support non-integer values (numbers to the right of a decimal point) and on how
many bytes of space Access uses to store them.
Note: A byte is a group of eight bits, which is the smallest unit of storage in the computer world. For
example, a megabyte is approximately one million bytes.
Table 26-2 lists the different Field Size options you can choose for the Number data
type and explains when each one makes most sense. Initially, Access chooses Long
Integer for all fields, which gives a fair bit of space but requires whole numbers.
Table 26-2. Field size options for the Number data type
Field Size
Contains
When to Use It
Byte
An integer (whole number) from 0 to
255. Requires just one byte of space.
This size is risky, because it fits only
very small numbers. Usually, it’s
safer to use Integer for small
numbers and give yourself a little more
breathing room.
Integer
An integer (whole number) from
–32,768 to 32,767. Requires two bytes
of space.
Useful if you need small numbers
with no decimal part.
Long Integer
An integer (whole number) from
–2,147,483,648 to 2,147,483,647.
Requires four bytes of space.
The Access standard. A good choice
with plenty of room. Use this to store
just about anything without hitting
the maximum, as long as you don’t
need decimals.
 
Search JabSto ::




Custom Search