Home » Microsoft Access » 05 - Tables
5
Table Basics
Now that Michael has generated a blank database, it is time to create tables in it. He goes over the table basics, the table contents, and its properties.
- A table is a collection of data about a specific topic, such as products or suppliers. It is good to use a separate table for each topic so that data is stored only once, which makes the database more efficient and reduce errors.
- Tables organise data into columns (called fields) and rows (called records).
- A common field relates two tables so that MS Access can bring together the data from the two tables for viewing, editing, or printing.
- Field name is the label that tells what type of information is being stored in this field e.g. field name ‘fname’ gives you an idea that this stores the person’s first name. Similarly field name ‘lname’ will store the person’s last name.
- FieldTypes or Data Types. Fields within a table can hold various types of data. The field type dictates what sort of data can be stored within the field. The different data types include:
- Text is a default field type. It contains 255 characters.
- Memo can store up to 64,000 characters. It is used for storing large information about fields e.g. a memo in a library database can store information about books such as its edition, author, authors’ background etc.
- Number stores various types of numbers.
- Date/Time field is used to store data and time values in various formats.
- Currency fields are accurate to 15 digits on the left side of the decimal point and 4 digits on the right. They do not suffer from rounding errors.
- Counter/Auto number is a numberthat automatically increments whenever a new record is added. Counter fields cannot be updated but they can be forced to start at numbers other than one through a technique involving ‘append query’. They are usually a table’s primary key.
- Yes/No fields cannot be indexed, and Only Yes or No values can be entered.
- OLE Object fields can be used to store objects such as an MS-Excel Spreadsheet or a Microsoft Draw Graph that is created by an object application. The maximum size is about 1 Gigabyte.
- Lookup Wizard creates a field that allows you to choose a value from another table or from a list of values using a combo box.
- Hyperlink A hyperlink address can contain up to three parts:
- Display text: Text that appears in a field or control.
- Address: Path to a file or page (URL).
- Sub address: A location within the file or page.
-
Field Size It refers to the maximum length of data that can be stored inside this field. E.g., if you specify a number field size as 3, then it can store values maximum of 3 digits values or up to 999. Field sizes can be set for both text and numeric fields.
- Text files can be of any length from 1 character to 255. The default is 50.
-
Numeric field sizes include:
- Byte: Stores numbers from 0 to 255 (no fractions). It occupies 1 byte.
- Integer: Stores numbers from -32,768 to 32,767(no fractions). It occupies 2 bytes.
- Long integer: Stores numbers from -2,147,483,648 to 2,147,483,647 (no fractions). It occupies 4 bytes.
- Single: Stores numbers with six digits of precision from -3,402823E38 to 3,402823E38. It occupies 4 bytes.
- Double (Default): Stores numbers with 10 digits of precision. It occupies 8 bytes.
- Field Properties: Thefield properties control the behaviour of a field. Different field properties categories include:
- Field Size
- Format controls how data is displayed.
- Decimal Place specifies the number of places to the right of decimal.
- Caption specifies the default field label in a form or report.
- Default Value specifies the value that gets entered automatically in a field when records are created.
- Validation Rules specify the expression that defines data entry rules.
- Indexes aresingle field indexes to speed searches and sorting.