Professional Documents
Culture Documents
Introduction to Tables
Imagine you create a list of people. The list can be started with names as follows: Bill, James,
Hermine, and Khan. This type of list is considered one-dimensional because all of its items fit in
one category. In order to create a more detailed list, you may want to include these people's
email addresses and probably other related information. If you include these additional pieces of
information in the same category, the list may become confusing. To arrange the list, you would
divide it in categories. Here is an example:
Khan @Khan.com
A field is an object used to host, hold, or store a piece of information of a database. Before such
an object can perform its function, it must first be created. In the strict sense, the most important
or the most regularly used fields of a database are created on a table, but tables may not be the
friendliest windows to present to a user for data entry. For this reason, fields can and should also
be created on other windows.
The process of making a field available depends on the type of object it will reside on and
probably how the field will be used. This leads to two categories of fields: those that can receive
or store information and those that can only present or display it. All fields of a table, especially
in Microsoft Access, are created to store data. On the other hand, fields on almost all of the other
objects (queries, forms, reports) can be made of combinations of already existing fields of a
table, or they can be created independently of any existing or non-existing data.
Table Layout
Database Object and Fields
A field is an object used to host, hold, or store a piece of information of a database. Before such
an object can perform its function, it must first be created. In the strict sense, the most important
or the most regularly used fields of a database are created on a table, but tables may not be the
friendliest windows to present to a user for data entry. For this reason, fields can and should also
be created on other windows.
The process of making a field available depends on the type of object it will reside on and
probably how the field will be used. This leads to two categories of fields: those that can receive
or store information and those that can only present or display it. All fields of a table, especially
in Microsoft Access, are created to store data. On the other hand, fields on almost all of the other
objects (queries, forms, reports) can be made of combinations of already existing fields of a
table, or they can be created independently of any existing or non-existing data.
Table Layout
The lower left side of the table is made of four buttons used to navigate the table, one button
used to create a new record, and a text box. Each button plays a specific role:
To have a table as part of your database, you must create it. You have various options. If you
create a database using one of the local templates, it would provide you with a few tables that
you can start using. Otherwise, to create a table, on the Ribbon, you can click Create. In the
Tables section, click Table. This would cause the Ribbon to switch to a section labeled Fields:
Like everything that is part of a database, a table must have a name that can be used to refer to
that object throughout the database and in other files that can be linked to the table. There are
two main ways you can specify the name of a table, either when you save it for the first time or if
you decide to rename it.
If a table has not been saved before, you will be asked to provide a name for the table. A table
can have almost any name: Employees, 2&&4DG, Pestes, verTT#@tg, etc. Because you and
your users should be able to easily identify a table, there are suggestions you should follow when
naming it:
In our lessons, we will not use the convention of prefixing the name of a
database object with three letters. For example, the names of tables will not
start with tbl. We came to this decision because most other database
environments, including Microsoft SQL Server, do not suggest this rule.
Although the lack of this rule may create some confusion, because you will end
up having a table and a form with the same name, we will strive to explicitly
state what object type we are referring to. For example, we will avoid writing,
"Open Employees" or "Open the Employees object". Instead, we will usually
state, "Open the Employees table".
Practical Learning: Saving a Table
3. Click OK
4. To close the table, click its Close button
Table Management
The Tables in the Navigation Pane
Because the table is the primary object of a database, when you create a table and save it by
giving it a name, Microsoft Access creates a section labeled Tables in the Navigation Pane and
displays the name of thew new table in that section. In the same way, you can have as many
tables as possible in the Tables section. Here is an example:
As we will see in the next lesson, you can create other object and they will have their sections.
Each section is expandable and collapsible. To expand a section, click the header of that section.
To the same to collapse a section.
Opening a Table
The most regular operations you will perform on a table require that you open it first. To open a
table, first locate it in the Navigation Pane then:
Any of these actions causes the table to display in Datasheet View in the central area of the
screen. In the same way, you can open as many tables as necessary.
Closing a Table
After using a table, you can close it. Before closing a table, first select its tab. Then, to close a
table:
You can click the close button on the right side of the tabs
You can press Ctrl + Shift + F4
Selecting a Table
In order to use a table, some operations require that you (or rather the user) first select(s) it:
Renaming a Table
We saw that, when or after creating a table, you must save it to make it part of your database.
When saving it for the first time, you must give it a name. If the name of a table is not
appropriate, you can change it. To rename a table, in the Navigation Pane, you can right-click the
name of the table and click Rename.
1. In the Navigation Pane window, right-click the Corporate Items table and click Rename
2. Type Employees Resources as the new name of the table
3. Press Enter
Deleting a Table
If you have a table you don't need anymore, you can remove it from your database. Because you
cannot delete a table if it is opened, you must first close it.
In each case, you will receive a warning to confirm what you want to do. It is important to know
that if you delete a table, because it is not a file, it does not go into the Recycle Bin: it is lost,
including its records. Therefore, before deleting a table, make sure you really want to get rid of
it. When in doubt, do not delete it.
3. Click OK
4. To close the table, click its Close button
Table Management
The Tables in the Navigation Pane
Because the table is the primary object of a database, when you create a table and save it by
giving it a name, Microsoft Access creates a section labeled Tables in the Navigation Pane and
displays the name of thew new table in that section. In the same way, you can have as many
tables as possible in the Tables section. Here is an example:
As we will see in the next lesson, you can create other object and they will have their sections.
Each section is expandable and collapsible. To expand a section, click the header of that section.
To the same to collapse a section.
Opening a Table
The most regular operations you will perform on a table require that you open it first. To open a
table, first locate it in the Navigation Pane then:
You can double-click the table
You can right-click the table and click Open
Any of these actions causes the table to display in Datasheet View in the central area of the
screen. In the same way, you can open as many tables as necessary.
Closing a Table
After using a table, you can close it. Before closing a table, first select its tab. Then, to close a
table:
You can click the close button on the right side of the tabs
You can press Ctrl + Shift + F4
Selecting a Table
In order to use a table, some operations require that you (or rather the user) first select(s) it:
Renaming a Table
We saw that, when or after creating a table, you must save it to make it part of your database.
When saving it for the first time, you must give it a name. If the name of a table is not
appropriate, you can change it. To rename a table, in the Navigation Pane, you can right-click the
name of the table and click Rename.
1. In the Navigation Pane window, right-click the Corporate Items table and click Rename
2. Type Employees Resources as the new name of the table
3. Press Enter
Deleting a Table
If you have a table you don't need anymore, you can remove it from your database. Because you
cannot delete a table if it is opened, you must first close it.
In each case, you will receive a warning to confirm what you want to do. It is important to know
that if you delete a table, because it is not a file, it does not go into the Recycle Bin: it is lost,
including its records. Therefore, before deleting a table, make sure you really want to get rid of
it. When in doubt, do not delete it.
When you start a table in the Datasheet View, the Ribbon becomes equipped with a new tab
labeled Fields. The sample fields and their configurations are distributed in various sections. One
of the sections of the Fields tab is named Add & Delete:
Microsoft Access provides many pre-configured fields you can add to your table. These ready-
made sample columns are referred to as a Field Templates. To use a field template, while the
table is displaying in Datasheet View:
Click or right-click the header of a column. This would bring a menu from where you can
select an option
On the table, click the header column or a cell under the column. In the Add & Delete
section of the Fields tab of the Ribbon, click the type of field you want
In the Add & Delete section of the Ribbon, click More Fields to display a list and click an
option from that menu
1. Click File
2. In the list of previously opened databases, click Clarksville Ice Cream
3. To create a new table, on the Ribbon, click Create
4. In the Tables section, click Table
Although a column completely depends on a table, both objects are closely related when it comes
to their maintenance. In other words, the maintenance performed on one object can directly
affect the other. For example, you can import a table from a text file or from another application.
A table cannot exist without at least one column.
Selecting a Column
Some operations will require that you select a column but it depends on the operation you want
to perform. In some cases, when any cell under a column has focus (for example if the caret is
blinking in a cell of a column), the column is considered to be selected. Otherwise:
To select one column, position the mouse on its name until the cursor points down and
then click
To select columns in a range, click and hold your mouse on one of them, then drag to the
left or to the right to cover the other desired column or columns. When all desired
columns are highlighted, release the mouse
To select a range of columns, click one column that will be at one end, press and hold
Shift, then click the column that will be at the other end, and release Shift
If you create a table using one of the Table Templates or if you get a table from a Database
Template, the columns of the tables are wide enough to show their names. If you create a table
from scratch in the Datasheet View, Microsoft Access assigns it a default width. That width can
appear to be too narrow or too wide. For example, when data exceeds the regular width of a
column, part of the information would be hidden. If a particular column contains data that you
want to display at all times, you can enlarge the column. On the other hand, if a column displays
tinny pieces of information, you can narrow the column to let it just fit the data as desired. There
are various techniques you can follow to widen or narrow a column.
you can position the mouse on the right border of a column header. The mouse pointer
would change into a horizontal double arrow crossed by a vertical line:
If you double-click, the column would be resized to the widest value of the column,
provided the widest value is wider than the column header. If the widest value is
narrower than the column header, the column width would be widened enough to display
the name of the column.
You can click the column's right border and drag in the desired direction, left or right
until you get the desired width
You can right-click a column's name and click Column Width... This would open the
Column Width dialog box where you can type the desired value and click OK
Moving a Column
If you find out that a particular column is misplaced in a table, you can change its position.
To move a column in Datasheet View, first select it. Click and hold your mouse on it. Then, start
dragging left or right in the desired direction. While your mouse is moving, a thick vertical line
will guide you. Once the vertical line is positioned to the desired location, release the mouse:
To move a group of columns, first select them as we reviewed earlier. Click and hold the mouse
on one of the selected columns. Start dragging left or right in the desired direction until the thick
vertical guiding line is positioned in the desired location, then release the mouse:
Inserting a Column
Inserting a column consists of adding one between two existing fields. To do this, right-click the
column that will succeed it and click Insert Field
Renaming a Column
Once the name is in edit mode, type the desired name and press Enter.
If a table contains many columns and at one time you think you don't need all of them, you can
hide some. To hide a column, you can drag the right border of its column header completely to
its left border as we saw earlier to change the width of a column; when the vertical guiding line
reaches the left border, release the mouse: the column would be hidden from the table:
To hide one or a group of columns, you can right-click and click Hide Fields. You can also right-
click any column and click Unhide Fields. This would open the Unhide Columns dialog box.
Here is an example:
To reveal a column or a group of columns previously hidden, right-click any column header on
the table and click Unhide Column. In the Unhide Columns dialog box, put a check mark on
each column you want to show.
Deleting a Column
If you have an undesirable column in a table, you can delete it. It is important to keep in mind
that if you delete a column, it also goes with any information under it.
Any of these actions would present you a warning to confirm whether you still want to delete the
column(s) or you want to change your mind. If you still want to
On the Ribbon, click Create and, in the Forms section, click Form Design
Save the form as Rental Rates and change the following characteristics in the Property Sheet:
Record Source: Categories
Caption: Rental Rates
Default View: Continuous Forms
Navigation Buttons: No
Design the form as follows (don't try to match the fonts; use whatever font you have on your
computer):
Save the table as Customers and close it
Create a form for the Customers table, save it as Customers, and design it as you see fit.
Here is an example:
Save the form
Create some customers before closing the form
Create a new table in Design View with the following fields:
Field Name Data Type Caption Field Size Other Properties
RentalOrderID (Primary Rental Order
AutoNumber
Key) ID
Long
EmployeeID Number Processed By
Integer
Long
CustomerID Number Processed For
Integer
Long
CarID Number Car
Integer
CarCondition Text Car Condition 50
TankLevel Text Tank Level 50
MileageStart Number Mileage Start Integer
MileageEnd Number Mileage End Integer
TotalMileage Number Total Mileage Integer
StartDate Date/Time Start Date
EndDate Date/Time End Date
TotalDays Number Total Days Integer
RateApplied Number Rate Applied Double Format: Fixed
Format: Percent
TaxRate Number Tax Rate Double
Default Value: 7.50
Default Value:
OrderStatus Text Order Status 50
"Unknown"
Notes Memo
Click TankLevel and, in the bottom section of the table, click the Lookup tab. Change the
properties as follows:
Display Control: Combo Box
Row Source Type: Value List
Row Source: "Empty";"1/4 Empty";"Half";"3/4 Full";"Full"
Bound Column: 1
Column Count: 1
Column Widths: 1"
List Width: 1"
Click OrderStatus and, in the bottom section of the table, click the Lookup tab. Change the
properties as follows:
Display Control: Combo Box
Row Source Type: Value List
Row Source: "Unknown";"Car On Road";"Order Completed";"Order Reserved"
Bound Column: 1
Column Count: 1
Column Widths: 1"
List Width: 1"
Save the table as RentalOrders
Close it
Tables and fields relationships can be created and managed in a special window called the
Relationships window. To display it:
If no table is currently opened, on the Ribbon, click Database Tools. In the Show/Hide
If no relationship exists among the tables in the current database, the Show Table dialog
box would come up, asking you to select the tables whose relationship(s) you want to
create. To add a table, select it, click Add and click Close
If at least one relationship has been created between two tables, the Relationships
window would come up and display that relationship or the already existing relationships
When you are working on the relationships of your tables, a window with a tab labeled
Relationships displays in Microsoft Access. Also, the Ribbon is equipped with a tab labeled
design and that includes two sections:
The Design tab of the Ribbon provides various tools to assist you with creating and managing the
relationships. For example, if the Show Table dialog box has been closed and if you want to
show it:
You can create a relationship only between two tables that are present on the Relationships
window. This means that even if a table is part of your database and you want to link it to
another table (of your database), if the table has not been added to the Relationships window,
you cannot create or manage its relationship to another table. Of course, there are other ways you
can create relationships without using the Relationships window but the Relationships window
gives you detailed means of creating and managing relationships.
To establish a relationship that does not yet exist between two tables, you can drag the primary
key from the parent table to the foreign key of the desired table. If you drag and drop accurately,
the relationship would be acknowledged and you can just click Create to make it formal. If you
dropped the primary key on the wrong field, you would have time to select the appropriate fields
in the Edit Relationship dialog box.
2. In the Show/Hide section, click the Relationships button . The Show Table
property sheet comes up:
3. Click Categories
4. Click the Add button
5. Double-click Cars
6. On the Show Table dialog box, click the Close button
7. To add another table as if we forgot it, right-click an empty area in the Relationships
window and click Show Table...
8. In the Show Table dialog box, click Customers
9. Press and hold Shit
10. Click RentalOrders and release Shift
11. Click Add and click Close
12. Drag the CategoryID field from the Categories table and drop it on top of the CategoryID
field in the Cars table:
The Edit Relationship dialog box would come up
15. Once again, the Edit Relationship dialog box comes up.
On the dialog box, under the left Table/Query, click the field that is selected to display its
combo box. In that left combo box, select CarID and press Tab
16. Under Related Table/Query, click the field that is selected. Click the arrow of its combo
box and select CarID
17. Click Create
18. In the same way, drag EmployeeID from the Employees table and drop it on EmployeeID
in the RentalOrders table
Click Create
In the same way, drag EmployeeID from the Employees table and drop it on EmployeeID in the RentalOrders
table
Click Create
Drag CustomerID from the Customers table and drop it on CustomerID in the RentalOrders table
Click Create
-Datasheet
You can also expand all records. To do this, open the table in Datasheet View. In the Records
section of the Home tab of the Ribbon, click More -> Subdatasheet -> Expand All
button
8. Set its Caption to Actor ID
9. In the upper section of the table, under ActorID, create a new field as follows:
Field Name: Actor
Data Type: Text
Field Size: 50
10. Set the last field as Notes with a Memo as Data Type
11. To switch the table to the other view, on the Ribbon, click the View button
12. When you are asked whether you want to save the table, click Yes
13. Type Actors and press Enter
14. Press Enter and enter the following names of actors:
2. (To get the © character, you can open Microsoft Word, type (c) then select and copy it.
Then paste it in the Caption property of the table field)
3. Save the table as Videos and switch it to Datasheet View
4. Enter a few videos:
©
Video ID Title Director Length Genre Category Rating
Year
1 Distinguished Gentleman (The) 8 112 2 3R
2 Wall Street 12 1987 126 1 R
3 Ransom 4 121 1 R
4 Not Another Teen Movie 11 2005 100 2 4 Unrated
5 Harlem Nights 6 1989 116 2 R
6 M:i:III 7 2006 125 1 6 PG-13
7 Devdas 5 175 13 Unrated
8 Passion of the Christ (The) 9 2004 12 R
9 Platoon 12 1986 120 3 R
10 Day After Tomorrow (The) 1 2004 123 1 5 PG-13
11 Beautiful Mind (A) 4 2001 135 1 PG-13
Click OK
A message box information informs you and asks whether you want to create a relationship
between both tables. Read it and click Yes
Click a + button and notice the related records. Close the Directors table