2.2 Adding, Removing, and Editing Tables
The basic tables added by the
Employees, Clients, and Projects nouns are close to the application’s
requirements, but the current configuration offers no mechanism to
track a consultant’s location. The Tasks table is extraneous and should
be removed to prevent end user confusion. The following steps walk you
through the process to remove the Tasks table and to add two completely
custom tables. After the database contains the tables necessary to meet
the requirements to track consultants on projects and consultants at
locations, you need to configure the relationships between tables. Figure 2 demonstrates the relationships necessary for the application to function properly.
Defining a relation between tables in an Access
web app is managed through the Lookup data type. A Lookup can work
either as a choice column or as a link to data from a table or query.
In addition to the linking of tables, some of the column names in the
Projects table need to change to keep a consistent application
vocabulary for the end users. The necessary column changes are
reflected as underlined columns (refer to Figure 2). Follow these steps to create the new lookup and edit the existing column names:
1. Return to
the Access 2013 client, and right-click Tasks in the Tile Pane. Notice
that the Settings/Actions dialog pops up offering choices such as View
Data, Edit Table, Delete, and Hide. Hide removes Tasks from the Tile
Pane but does not delete the back-end table or associated views.
2. Select Delete and proceed through the confirmation dialog.
3. Open the Projects table.
4. Change the Owner field name to Consultant.
5. Change the Customer field name to Client.
6. To add a
table, click the Table button in the Create section of the Ribbon.
Click the Add a New Blank Table link on the right to create the
following table:
LOCATIONS
FIELD NAME |
DATA TYPE |
LocationID |
AutoNumber |
Street |
Short Text |
Neighborhood |
Short Text |
City |
Short Text |
State |
Lookup |
The LocationID functions as the primary key. When
you enter Lookup as the Data Type for State, a Lookup Wizard
automatically pops up. Select I Will Type in the Values that I Want,
and type in several codes, as shown in Figure 3.
7. Click the Save button to name the table Locations and save it to the server.
8. Create
another new table, the Project Locations table. This table serves as
the Many-to-Many Lookup table between the Projects and Locations
tables. The following table describes the necessary columns:
PROJECT LOCATIONS
FIELD NAME |
DATA TYPE |
NOTES |
ID |
AutoNumber |
Functions as the primary key. |
LocationID |
Lookup |
As shown in Figure 3, a Lookup Wizard automatically pops up. Set this field to retrieve data from the Locations table, neighborhood column. Figure 4 demonstrates the proper wizard settings. |
ProjectID |
Lookup |
Create a lookup to the Projects table. |
9. Click the Save button to name the table Project Locations and save it to the server.
10.
In the Tile Pane in the Access client, drag the Projects tab to the top
and hide the Project Locations table. The Project Locations table is a
linking table that should not be directly edited by end users.