Information Systems Using Microsoft Access for Database Systems

advertisement
Information Systems
Using Microsoft Access for
Database Systems
Higher
6441
Spring 2000
HIGHER STILL
Information
Systems
Using Microsoft Access
for Database Systems
Higher
Support Materials


ACKNOWLEDGEMENTS
The Higher Still Development Programme gratefully acknowledges permission
granted by Microsoft Corporation for screenshots from Microsoft® Access 97,
copyright © 1992-1996 Microsoft Corporation. All rights reserved.
Every attempt has been made to trace copyright owners. The Higher Still
Development Programme apologises for any omission which, if notified, it will be
pleased to rectify at the earliest opportunity.
This publication may be reproduced in whole or in part for educational purposes provided that no profit
is derived from the reproduction and that, if reproduced in part, the source is acknowledged.
First published 2000
Higher Still Development Unit
PO Box 12754
Ladywell House
Ladywell Road
Edinburgh
EH12 7YH
Information Systems: Using Microsoft Access for Database Systems (H)
CONTENTS
Section 1
Staff notes
Section 2
Student notes
Section 3
Study materials
Information Systems: Using Microsoft Access for Database Systems (H) – Staff notes
1
Information Systems: Using Microsoft Access for Database Systems (H) – Staff notes
2
SECTION 1: STAFF NOTES
This unit uses two case studies to teach the aspects of Microsoft Access that are
essential for the Scottish Qualifications Authority National Unit in Database Systems
which is a core unit of the National Qualification in Information Systems at Higher.
Case study 1 is taken through the stages of analysis, design, implementation and
evaluation. The material consists of a question sheet and a supplied answer (for tasks
based on Outcomes 1. 2 and 3e) and a step-by-step guide on how to use Microsoft
Access 97 (or greater) to complete the implementation for Outcome 3.
Case study 2 is another database system that should be analysed, designed,
implemented and then evaluated. The question sheet for case study 2 contains the
details of the tasks to be completed. A set of sample answers is also provided.
Aim
This unit is designed to develop knowledge and understanding of data analysis and
structuring techniques and to provide an opportunity to apply this knowledge through
the use of Microsoft Access.
Status of this learning and teaching pack
These materials are for guidance only. The mandatory content of this unit is detailed
in the unit specification of the Arrangements document.
Target audience
While entry is at the discretion of the centre, students would normally be expected to
have attained one of the following (or possess equivalent experience):
 Database Systems (Int 2) unit
 Information Systems course at Intermediate 2
 Standard Grade in Computing Studies (Grade 1 or 2).
Progression
This unit builds on skills acquired particularly at Intermediate 2 (or Standard Grade)
level in database work, but emphasises the design of database structures. It links
closely with Information Organisation (H) and gives useful insights and skills in
preparation for the Advanced Higher units Database Systems and Information Systems
Project.
Learning and teaching approaches
This pack is designed to be used in conjunction with the previous Database Systems
Support Materials pack (5749). This pack consists of two case studies that involve the
student in the analysis, design, implementation and evaluation of database systems.
Detailed commentary and instructions are included with the first case study so that the
student can gain a greater understanding of database techniques and can gain
experience implementing database systems using Microsoft Access.
Information Systems: Using Microsoft Access for Database Systems (H) – Staff notes
3
You should note that Outcomes 1 and 2 represent a different approach to the teaching
of database systems to that commonly used in Standard Grade and Intermediate 2.
The emphasis in this unit is on the analysis of an existing system (non-computerised)
and the design of a corresponding database structure which is then implemented in
Outcome 3. The differences between the manual and computerised systems and the
advantages of computerisation should be stressed throughout the unit and particularly
during the evaluation phase.
The outcomes and performance criteria are covered in the order stated in the
Arrangements.
A student-centred, resource-based learning approach is recommended for this pack.
Students will require access to appropriate computer hardware and software at various
stages within this unit.
Please see the previous database systems support pack for details of recommended
timings for each outcome.
Hardware and software resources
This unit requires that the student has regular access to a computer system which can
be used to implement a relational database. At the time of going to print, such a
system would have:
 Pentium, Pentium II or Pentium III PC with MMX technology
 sufficient RAM e.g. 64 Mb RAM
 sufficient backing store e.g. 5 to 8 GB hard disc
 Microsoft Access 97 or greater.
Each student will require at least 15 hours of access to such a system during the
course of this unit.
References
Books
The following books may be of use as a general introduction to the unit:
Whitehorn, M and Marklyn B 1998. Inside Relational Databases with examples in
Access, Springer, ISBN 3-540-76092-X
Swanson, M 1997. Microsoft Access 97 At A Glance, Microsoft Press, ISBN 1-57231369-2
Viescas, J L 1997. Running Microsoft Access 97, Microsoft Press, ISBN 1-57231323-4
Please see the previous support materials for other suitable texts.
Information Systems: Using Microsoft Access for Database Systems (H) – Staff notes
4
SECTION 2: STUDENT NOTES
This unit, Database Systems, is a core unit of Information Systems (Higher). You will
find it easier if you have already studied database systems either at Standard Grade or
Intermediate 2. However, there is an important difference in Database Systems at
Higher. This can be explained by looking at the outcomes, which are as follows:
1. Construct a data model of an existing, non-computerised system.
2. Design database structures to represent the data model.
3. Implement a designed database system.
You can see from this that computer work is required for Outcome 3 only. Outcomes
1 and 2 are about analysis and design, and you will be spending approximately 60%
of your time on them. If you have successfully completed Database Systems at
Intermediate 2 or Standard Grade, you will find the work for Outcome 3
straightforward, but for Outcomes 1 and 2 it may be unfamiliar to you.
How to tackle this unit
 Work through the first case study and implement the solution using Microsoft
Access. Ensure that you check each stage of your solution against the supplied
answers.
 Complete the second case study and then discuss your solution with your teacher/
lecturer. He/she may issue you with a sample solution to the second case study
for the purpose of self-evaluation.
Assessment
Assessment will normally follow each outcome, but your teacher or lecturer may
choose to assess you at different times. Possible assessment items are as follows:
Outcome 1
Assignment involving an analysis leading to the production of a data model.
Outcome 2
Assignment involving the design of a database corresponding to the data model.
Outcome 3
Practical exercise involving the implementation of the designed data structures.
Or
Your teacher/lecturer may use the integrated course work as your assessment. This
coursework will count as both your unit and coursework assessment. The coursework
assessment would normally be completed after you have finished the tasks in this
pack.
Information Systems: Using Microsoft Access for Database Systems (H) – Student notes
5
Information Systems: Using Microsoft Access for Database Systems (H) – Student notes
6
SECTION 3: STUDY MATERIALS
CASE STUDY ONE - OUTCOME 1
Construct a data model of an existing system
Reid and Wilson Limited are a carpentry company that make special items of
furniture to order. When a prospective client contacts them the client is sent a pad of
pre-printed order forms and the company’s product catalogue. These items look as
follows:
Figure 1 - Reid and Wilson Limited pre-printed order forms
Figure 2 - Reid and Wilson Limited Product Catalogue






Each order form has a unique order number pre-printed on it.
A number of different products can be ordered on each order form.
The customer always enters his/her details on each order form.
Only products in the company’s product catalogue can be ordered.
The delivery date is entered on the order form when the order is dispatched.
The orders manager calculates the total for each order and for each part of an order
and enters this information on the order forms.
 The orders manager also creates reports to show completed order forms, the
products sorted into ascending order by the quantity sold and a list of customers.
 The maximum value for any product is £10,000 and the minimum value is £1.00.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
7
Task 1
Using this information write down the primary entities as they exist in the current
system.
Task 2
Now take the un-normalised data model and normalise it to first normal form by
removing repeating groups.
Task 3
Create an E/R diagram to illustrate the data model in first normal form.
Task 4
Create a data dictionary for the data model.
Task 5
List the inputs, processes and outputs required for the system to function.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
8
CASE STUDY ONE - OUTCOME 1
Answer to Task 1
There are two entities in the existing system. The un-normalised relation table for Order Forms is as follows:
Customer
ID
Customer
Name
Customer
Address
Customer
Postcode
Customer
Telephone
Number
Order
Number
Order
Date
Delivery Date
1527
Smith, D
12 Leith Dr
EH6 8TY
02872 7627
11
12/12/00
10/04/01
7162
Shaw, C
18 Smith Rd
EH8 8JK
02867 82910
51
13/12/00
12/03/01
8821
Kinder, F
169 Broom Way
EH7 9AS
02837 99181
189
11/11/00
01/02/01
This can be written as follows.
Order Forms { Customer ID
Customer Name
Customer Address
Customer Postcode
Customer Telephone Number
Order Number
Order Date
Delivery Date
*Product ID
Product Name
Quantity
Unit Cost}
Product
ID
Product Name
Quantity
928
213
827
928
617
712
827
Carver Dining Chair
Oak Dining Table
Pine Bedside Table
Carver Dining Chair
Ornate Coat Rack
Basic Kitchen (1)
Pine Bedside Table
3
1
2
3
1
1
2
Unit Cost
£156.50
£412.89
£128.00
£156.50
£45.00
£1029.00
£128.00
The primary key for the entity is a concatenated key of Order Number and
Product ID. Each order can contain many order lines (that is lines containing
Product ID, Product Name, Quantity and Unit Cost). Therefore Order
Number on its own would not be sufficient to uniquely identify each record.
We cannot use Product ID as the sole primary key because the same product
can be ordered on many different order forms.
In order to identify each order and order line combination we need to use
both the Order Number and the Product ID. Product ID is also a foreign key
because it appears in the Product Catalogue.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
9
The other entity is the Product Catalogue.
Product ID
928
827
617
Product Name
Carver Dining Chair
Pine Bedside Table
Ornate Coat Rack
Product Description
Large hardwood carvers in a Mexican Style
Small Pine Table with Sign Draw
Black lacquered table
Unit Cost
£156.50
£128.00
£45.00
Product Catalogue { Product ID
Product Name
Product Description
Unit Cost}
Each product has a unique identifier. This is the primary key, Product ID
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
10
CASE STUDY ONE - OUTCOME 1
Answer to Task 2
The following tables show the entities in the data model normalised to 1NF.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
11
Order Lines
Order Forms
Customer
ID
Customer
Name
Customer
Address
Customer
Postcode
Customer
Telephone
Number
1527
7162
8821
Smith, D
Shaw, C
Kinder, F
12 Leith Dr
18 Smith Rd
169 Broom Way
EH6 8TY
EH8 8JK
EH7 9AS
02872 7627
02867 82910
02837 99181
Order
Number
Order
Date
Delivery Date
11
51
189
12/12/00
13/12/00
11/11/00
10/04/01
12/03/01
01/02/01
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
Order
Number
Product
ID
Quantity
11
11
11
51
51
189
189
928
213
827
928
617
712
827
3
1
2
3
1
1
2
12
Product Catalogue
Product ID
928
827
617
Product Name
Carver Dining Chair
Pine Bedside Table
Ornate Coat Rack
Product Description
Large hardwood carvers in a Mexican Style
Small Pine Table with Sign Draw
Black lacquered table
Unit Cost
£156.50
£128.00
£45.00
Each customer’s details are included on the order form that they complete and can therefore be identified by the Order Number. Customer
Name, Address, Postcode and Telephone Number are dependent on the non-key attribute Customer ID. These would be removed to a separate
entity as part of the process of third form normalisation. They should not to be removed as part of first normal form.
Product Name and Unit Cost are already attributes of Product Catalogue and are dependent on Product ID. Therefore they can be removed
from the Order Lines entity. If we know an item’s Product ID then we can retrieve its name and unit cost from the Product Catalogue.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
13
Each record in Order Lines has a primary key of the Order Number and Product ID. Both these values together uniquely identify each record.
Order Forms {
Customer ID
Customer Name
Customer Address
Customer Postcode
Customer Telephone Number
Order Number
Order Date
Delivery Date}
Order Line {
*Order Number
*Product ID
Quantity}
Product Catalogue { Product ID
Product Name
Product Description
Unit Cost}
If the student has completed the normalisation process to third normal form then the following entities would be required. Note: There is no
difference between the 1NF and 2NF for this particular data model.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
14
Customers
Order Lines
Customer
ID
Customer
Name
Customer
Address
Customer
Postcode
Customer
Telephone
Number
1527
7162
8821
Smith, D
Shaw, C
Kinder, F
12 Leith Dr
18 Smith Rd
169 Broom Way
EH6 8TY
EH8 8JK
EH7 9AS
02872 7627
02867 82910
02837 99181
Order Forms
Customer
ID
Order
Number
Order
Date
Delivery Date
1527
7162
8821
11
51
189
12/12/00
13/12/00
11/11/00
10/04/01
12/03/01
01/02/01
Order
Number
Product
ID
Quantity
11
11
11
51
51
189
189
928
213
827
928
617
712
827
3
1
2
3
1
1
2
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
15
Product Catalogue
Product ID
928
827
617
Product Name
Carver Dining Chair
Pine Bedside Table
Ornate Coat Rack
Product Description
Large hardwood carvers in a Mexican Style
Small Pine Table with Sign Draw
Black lacquered table
Unit Cost
£156.50
£128.00
£45.00
To achieve this representation of the data model in third normal for the data items that were dependent on the non-key attribute, Customer ID
were removed to a new entity called Customers.
Customers {
Order Forms {
Customer ID
Customer Name
Customer Address
Customer Postcode
Customer Telephone Number}
*Customer ID
Order Number
Order Date
Delivery Date}
Order Lines {
*Order Number
*Product ID
Quantity}
Product Catalogue { Product ID
Product Name
Product Description
Unit Cost}
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
16
CASE STUDY ONE - OUTCOME 1
Answer to Task 3
The E/R diagram of the system in 1NF is as follows.
Order Forms
1
are made up
of
M
M
Order Lines
items are
placed on
1
Product
Catalogue
The E/R diagram is created by linking primary keys that are single data items (i.e. non-concatenated keys) to their corresponding foreign keys.
The foreign keys are on the many side of the relationship and the primary keys are on the one side. The relationship in the diamond boxes
briefly describes the nature of the relationship between the two entities. We normally read the relationship from the one side to the many side
e.g. Product catalogue items are placed on order lines.
Please also notice that a 1 denotes the one side of the relationship and an M denotes the many side.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
17
CASE STUDY ONE - OUTCOME 1
Answer to Task 4
The data dictionary for the data model in 1NF is as follows.
Entity
Order Forms
Order Lines
Attributes
Customer Number
Customer Name
Customer Address
Customer Postcode
Customer Telephone Number
Order Number
Order Date
Delivery Date
*Order Number
*Product ID
Product Catalogue
Quantity
Product ID
Product Name
Product Descriptions
Unit Cost
Description
Unique Customer Identifier. Numbers in the range 1 to 99999, required.
The name of the customer. Text only, required.
All address details for the customer excluding postcode. Required, Text and numbers.
Postcode of customer, required, 8 characters matching standard postcode format.
The customers telephone number, numbers and text, required.
Unique Order Form Identifier, Primary key for Order Forms entity, Numbers, required.
The date the customer placed the order, Date only, required.
The date that the order is dispatch, date only.
Unique Order Form Identifier, Part of concatenated primary key and a foreign key from
Order Forms, Numbers, required.
Unique product catalogue identifier, part of concatenated primary key and a foreign key
from Product Catalogue, Numbers, required.
The number of items ordered. Numbers, required.
Unique product catalogue identifier, primary key, Numbers, required.
The name of a product. Text and Numbers, required.
A long description of a product, text and numbers, required.
The cost of the item. A number in the range 1 to 10,000.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
18
CASE STUDY ONE - OUTCOME 1
Answer to Task 5
Entity
Order Forms
Order Lines
Product Catalogue
Input
Enter new order forms into the system.
Enter delivery date when order is
dispatched.
Enter new order forms into the system.
Process
Automatically calculate the total
amount due for any order.
Output
Completed Order Forms and Totals.
List of customers.
Automatically calculate the total
amount due for any order.
Add a new product to the product catalogue.
Edit a product’s details in the product
catalogue.
Delete a product from the product catalogue
Automatically calculate the total
amount due for any order.
Completed Order Forms and Totals.
List of products in order of quantities
sold.
Completed Order Forms and Totals.
List of products in order of quantities
sold.
Inputs
The company needs to add new order forms to the system. This has an impact on the Order Forms and Order Lines entities. When orders are
dispatched the despatch date is entered. This has an impact on the Order Forms entity. The company maintains the Product Catalogue. They
add, edit and delete product-related information.
Processes
The company uses the computer system to automatically calculate the total amount due for each order. This draws data from all three entities.
Outputs
The company needs to print out completed order forms. This requires data from the Order Forms, Order Lines and Product Catalogue entities.
Reports are also required to show product sales by quantity (data drawn from the Order Lines and Product Catalogue entities) and a list of all
customers.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
19
CASE STUDY ONE - OUTCOME 2
Design database structures to represent a data model of an existing system
Reid and Wilson Limited now wish to implement the database system based on the
data model constructed. They want to use the Access RDBMS that is developed by
Microsoft.
In order for the database to be created a design must be completed that matches the
data model to the features available with in the proposed implementation software.
The design should meet the following requirements:
 database structure and data item names are appropriate to the data model
 unique keys are chosen for all database structures
 data item characteristics correctly represent the data model (such as field sizes,
types and keys)
 data item validity checks correctly represent the data model. This should include at
least one presence, range and restricted choice check.
 designed database structures are appropriate to the intended implementation
method.
Task 6
Complete a detailed design showing the characteristics of each data item in the
system.
Task 7
List the data items that are linked in order to create the relationships between the
tables.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
20
CASE STUDY ONE - OUTCOME 2
Answer to Task 6
Database: Reid and Wilson Limited Table: Order Forms
Fieldname
Type
Size Validation
Customer Number
Number
Auto >=1 and <= 99999
Customer Name
Text
50
Customer Address
Text
255
Customer Postcode
Text
8
Customer Telephone Number Text
22
Order Number
AutoNumber Auto
Order Date
Delivery Date
Date/Time
Date/Time
Auto
Auto
Format
>LL00 0LL;;_
Short Date
Short Date
Database: Reid and Wilson Limited Table: Order Lines
Fieldname
Type
Size Validation
Format
*Order Number
Number
Auto Lookup from Order
Forms
*Product ID
Number
Auto Lookup from
Product Catalogue
Quantity
Number
Auto
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
Req’d
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Req’d
Yes
Yes
Yes
Index
No.
No
No
No
No
Unique Primary Key for Order Forms
(Indexed, No Duplicates)
No
No
Index
Part of Primary Key (Indexed,
Duplicates OK)
Part of Primary Key (Indexed,
Duplicates OK)
No
21
Database: Reid and Wilson Limited Table: Product Catalogue
Fieldname
Type
Size Validation
Product ID
AutoNumber Auto
Product Name
Product Descriptions
Unit Cost
Text
Text
Currency
30
255
Auto >= 1 And <=10000
Format
£99,999.99
Req’d
Yes
Yes
Yes
Yes
Index
Unique Primary Key for Product
Catalogue (Indexed, No Duplicates)
No
No
No
All the selected data types meet the requirements of the system.
 Order Number and Product ID are each of the AutoNumber type. This gives a unique sequential (incremented by 1) number or random
number assigned by Microsoft Access whenever a new record is added to a table. In this way each new order or product is automatically
assigned a new unique number.
 The text data type has been chosen for a number of different fields. Each of these has been given an appropriate length. The length is the
maximum number of characters that we expect to enter in that field. It is important to note that Customer Telephone Number is a text field.
This allows the database to store leading zeros, brackets and spaces within the telephone number. For example, (09273) 787231. Also the
Product Description is a text field with the maximum length of 255 characters. If more than 255 characters were required then the field
would be made a Memo type.
 Number fields are left to the automatic size for Microsoft Access. This size is called long integer and is entered automatically by Access
when the field is created. Note that both of the foreign keys in Order Lines, which link with primary keys in Order Forms and Product
Catalogue, are of the number type so that the AutoNumber values can be related (relationship created through the lookup).
 The Date/Time data type is a Short Date format for both the Order Date and the Delivery Date. This will display the dates in the
dd/mm/yyyy format i.e. 25/06/1999.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
22
 Validation has been entered for the Customer Number, Order Number, Product ID and Unit Cost. Where this is a range check the validation
makes use of a formula. Where it is a Lookup it is implying that only values from the associated table can be entered. This is known as
Referential Integrity.
Answer to Task 7
The following relationships should be implemented in the system:
[Order Forms].[Order Number]
[Product Catalogue].[Product ID]
1:M
1:M
[Order Lines].[Order Number]
[Order Lines].[Product ID]
In Microsoft Access these relationships will be created by using the lookup wizard and then by enforcing referential integrity through the
relationships view.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
23
CASE STUDY ONE - OUTCOME 3 (IMPLEMENT DESIGN)
We now implement the detailed design using Microsoft Access.
1. Double click the Microsoft Access shortcut (see Figure 3) on the desktop. This
will start up the RDBMS.
Figure 3 - Microsoft Access Shortcut
2. When Access loads you will be prompted to start a Blank Database, use the
Database Wizard or Open an Existing Database (see Figure 4).
Figure 4 - Microsoft Access start up dialogue box
Left click the Blank Database radio button and then left click the OK button.
3. You will then be prompted to save your blank database (Figure 5).
Figure 5 - Microsoft Access File New Database dialogue box
Enter Order System as the file name and left click the Create button.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
24
4. Your new blank database will be saved and then Access will display the main
database window (Figure 6).
Figure 6 - Microsoft Access main database window
It is from this window that we create our tables, queries and reports.
5. Let us now create the first of our tables from our detailed design. This is the
Order Forms table.
Click the New button to create a new table. Access will prompt you with the New
Table dialogue box (Figure 7).
Figure 7 - Microsoft Access New Table dialogue box
Click Design View and then select OK.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
25
6. In the first row enter the Field Name Customer Number and then press Return.
Now use the mouse to select Number from the pull-down list of data types
(Figure 8).
Figure 8 - Microsoft Access Table Design View with pull-down list for Data Type
When you have selected number press return to move to the Description column.
Enter the description as A unique customer identifier.
7. Make sure that the text entry point (the flashing line cursor) is still in the first row
of the table design. Now look at the Field Properties at the bottom of the design
window. This is where we enter more detail about the fields in the table.
Click in the Default Value text box. Delete the 0 that is in the box and type 1.
This gives a default value for the customer number of 1.
Press return to move to the Validation Rule text box.
8. Enter the validation rule as >=1 and <=99999. The means that only values
greater than or equal to 1 and less than or equal to 99999 will be accepted as valid
for this field.
Press return to move to the Validation Text text box
9. Here we enter a message that will appear if the user enters invalid data for this
field. Enter the text as Value must be between 1 and 99999.
Press return to move to the Required text box
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
26
10. In our detailed design we specified that this field was required. This means that a
blank value (called a Null value) is not acceptable. Use the mouse to select Yes
from the pull down list for the Required text box. Your design window should
now look exactly like Figure 9.
Figure 9 - Microsoft Access Table Design View completed for Customer Number
11. Now we enter the details for the Customer Name field.
Field Name:
Data Type:
Description:
Field Size:
Validation Rule:
Validation Text:
Required:
Customer Name
Text
The customer’s name
50 Characters
None (Do not type anything in the Validation Rule text box)
None (Do not type anything in the Validation Text text box)
Yes
Once you have entered these details your design view window will look like
figure 10.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
27
Figure 10 - Microsoft Access Table Design View completed for Customer Name
12. Now enter the details for Customer Address.
Field Name:
Data Type:
Description:
Field Size:
Required:
Customer Address
Text
The complete address for the customer without postcode.
255
Yes
Figure 11 - Microsoft Access Table Design View completed for Customer Address
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
28
13. Enter the following details for Customer Postcode.
Field Name:
Data Type:
Description:
Field Size:
Required:
Indexed:
Customer Postcode
Text
The customer’s postcode.
8
Yes
No1
14. This field requires us to use an input mask to validate the data entered into it.
This input mask ensures that the data enter is the correct format for a postcode.
Microsoft has a wizard that makes constructing the input mask easier. We will
use this wizard.
To start the wizard click in the Input Mask text box. A button with three dots in
it will appear to the right hand side of the text box (Figure 12).
Figure 12 – Starting the Input Mask Wizard
Click this button to start the input mask wizard.
1
Access will automatically try to index postcodes for us. We do not require this and must, therefore,
set the indexed property back to No.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
29
15. When the wizard starts the first thing it wants to do is to save the table (Figure 13).
Figure 13 – Input Mask Save Table dialogue box
Click Yes to start the saving process.
16. The Save As dialogue box will appear. Here you enter a name for the table. Type
Order Forms as the name for the table and then click OK (Figure 14).
Figure 14 – Save As dialogue box
17. Microsoft Access likes all tables to have a primary key and prompts us to create a
primary key. At this stage in the design of our table we are not ready to create the
primary key so we click No (Figure 15). We will create a primary key later on.
Figure 15 – No Primary Key dialogue box
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
30
18. The first dialogue box of the Input Mask Wizard is displayed. You’ll notice that it
already has a postcode input mask defined. We will base our input mask on this.
Click the postcode input mask and then click Next (Figure 16).
Figure 16 – Input mask wizard – Step 1
19. The input uses the following characters to specify the mask.
Character
0
9
#
L
?
A
A
&
C
. , : ; - /
<
>
!
\
Description
Digit (0 to 9, entry required, plus [+] and minus [–] signs not allowed).
Digit or space (entry not required, plus and minus signs not allowed).
Digit or space (entry not required; spaces are displayed as blanks while in Edit
mode, but blanks are removed when data is saved; plus and minus signs
allowed).
Letter (A to Z, entry required).
Letter (A to Z, entry optional).
Letter or digit (entry required).
Letter or digit (entry optional).
Any character or a space (entry required).
Any character or a space (entry optional).
Decimal placeholder and thousand, date, and time separators.
Causes all characters to be converted to lowercase.
Causes all characters to be converted to uppercase.
Causes the input mask to display from right to left, rather than from left to right.
Characters typed into the mask always fill it from left to right. You can include
the exclamation point anywhere in the input mask.
Causes the character that follows to be displayed as the literal character (for
example, \A is displayed as just A).
Figure 17 – Input mask Characters
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
31
You will notice that the input mask provided by the wizard means that the format
of a postcode must be LL00 0LL (letter, letter, number, number, space, number,
letter, letter).
We want to make the second letter of the postcode optional because some
postcodes have single numbers in them. Change the second zero in the input mask
to a 9 (Figure 18). A 9 means that the second number will be optional.
Figure 18 – Input mask wizard – Step 2
Click Next to move to the next step of the wizard.
20. Access now asks how to store the data in the table. It is more efficient (in terms of
storage space) to store the data without the spaces, however, the data is easier to
read if the data is stored with the spaces in it.
Click the With the symbols in the mask radio button and then click Next (Figure 19).
Figure 19 – Input mask wizard – Step 3
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
32
21. The only thing left to do is to click the Finish button on the final step of the wizard
in order to create the input mask (Figure 20).
Figure 20 – Input mask wizard – Step 4
22. The input mask for the Customer Postcode has now been created. You will see
that the input mask now appears in the Input Mask text box (Figure 21).
Figure 21 – Table design showing input mask in field properties
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
33
23. Now enter the following details for Order Number.
Field Name:
Data Type:
Description:
Order Number
AutoNumber
The primary key for this table
24. Order Number is the primary key for this table. We need to tell the Access
software that it is the primary key. To do this we make sure that the text entry
point is somewhere in the Order Number row and then click the Primary Key
button on the toolbar.
The design view window will now look like Figure 22. Notice the key icon next
to Order Number.
Figure 22 – Order Number specified as primary key
25. Enter the following details for Order Date.
Field Name:
Data Type:
Description:
Format:
Required:
Order Date
Date/Time
The date the order was first placed
Short Date (Figure 23)
Yes
Figure 23 – Choosing Order Date Format
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
34
26. Enter the following details for Delivery Date.
Field Name:
Data Type:
Description:
Format:
Delivery Date
Date/Time
The date the order is dispatched
Short Date
The design view window should now look like Figure 24.
Figure 24 – Completed Order Forms table design
27. Close the table by clicking the cross in the top-right corner of the window (Figure
25).
Figure 25 – Top left corner of design window with the Close Icon (the cross) shown
28. Access will prompt you to save the changes you have made to the design of the
table. Select the Yes button (Figure 26).
Figure 26 – Save changes dialogue box
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
35
29. Access returns you to the main database window. You will now see an icon for
the Order Forms table under the Tables tab (Figure 27).
Figure 27 – Main database window with Order Forms shown
30. Create a New table for Product Catalogue and enter the following details for the
data items.
Field Name:
Product ID
Data Type:
AutoNumber
Description:
A unique ID for each product
Make Product ID the primary key.
Field Name:
Data Type:
Description:
Size:
Required:
Product Name
Text
The name of the product
30
Yes
Field Name:
Data Type:
Description:
Size:
Required:
Product Description
Text
A brief description of the product
255
Yes
Field Name:
Data Type:
Description:
Default Value:
Validation Rule:
Validation Text:
Required:
Unit Cost
Currency
The cost on a product
1
>=1 And <=10000
Value must be between 1 and 10000
Yes
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
36
The finished table design should look like Figure 28.
Figure 28 – Completed Product Catalogue table design
31. Save this new table as Product Catalogue.
32. Create a New table for Order Lines and enter the following details.
Field Name:
Data Type:
Description:
Required:
Indexed:
Order Number
Number
The order number from the order form for this order line
Yes
Yes (Duplicates OK)
Field Name:
Data Type:
Description:
Required:
Indexed:
Product ID
Number
The product ID from the Product catalogue
Yes
Yes (Duplicates OK)
Field Name:
Data Type:
Description:
Required:
Quantity
Number
The number of items ordered
Yes
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
37
33. We now have to specify the primary key for this table. The primary key is a
concatenated key of Order Number and Product ID. To create the Primary Key
click the grey box on the left of the row with Order Number in it. This will select
the row (Figure 29).
Figure 29 – Order Lines with Order Number selected
34. To complete the primary key hold down the Control (Ctrl) key on the keyboard
and then select the grey box to the left of the row with Product ID in it. Both the
Order Number and Product ID will be highlighted (Figure 30).
Figure 30 – Order Lines with Order Number and Product ID selected
35. Now click the primary key button on the toolbar to make the concatenated primary
key (Figure 31).
Figure 31 – Order Lines with the primary key
36. Now click the Save button (Figure 32) on the toolbar and enter the name for this
table as Order Lines.
Figure 32 – Save button on toolbar
37. Now click the Save button (Figure 32) on the toolbar and enter the name for this
table as Order Lines.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
38
38. To complete the database design we need to create relationships between:
[Order Forms].[Order Number] and [Order Lines].[Order Number]
[Product Catalogue].[Product ID] and [Order Lines].[Product ID]
To begin to create the relationships we use a lookup in Order Lines which looks
for values for Order Number in Order Forms.
39. Select Lookup Wizard… from the Data Type pull down list in the Order Number
row (Figure 33).
Figure 33 – Lookup wizard from Data Type pull down list
40. The values that we wish to enter for Order Number should already exist in the
Order Forms table. This is because the detail of an Order Form is entered before
the detail for each Order Line on that Order Form.
The values required for the lookup are in the Order Forms table so, on the first
step of the lookup wizard, click the top radio button (Figure 34) then click Next.
Figure 34 – Step 1 of the Lookup wizard for Order Number in Order Lines
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
39
41. The table that contains the values we require is Order Forms. Click the table name
in the text area and then click Next (Figure 35).
Figure 35 – Step 2 of the Lookup wizard for Order Number in Order Lines
42. The next stage of the wizard involves selecting the fields that will be included in
the pull down menu that will represent the lookup. Double click the fields on the
left-hand side in the following order:
Order Number
Customer Name
Customer Number
Order Date
Delivery Date
Click Next to continue with the wizard (Figure 36).
Figure 36 – Step 3 of the Lookup wizard for Order Number in Order Lines
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
40
43. The next stage of the wizard shows you what the headings for the lookup would
look like.
Click the Hide key column (recommended) check box so that it is not ticked.
Order Number is the key column and we need to see it for this lookup to work
(Figure 37).
Figure 37 – Step 4 of the Lookup wizard for Order Number in Order Lines
Click Next to continue.
44. The primary key of Order Forms is Order Number. This field uniquely identifies
each record in the table Order Forms. Make sure that Order Number is selected
and then press Next (Figure 38).
Figure 38 – Step 5 of the Lookup wizard for Order Number in Order Lines
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
41
45. To complete the creation, enter a label for the lookup column to be stored as. The
name you enter should be the name of primary key for the lookup. In this case
that would be Order Number.
Figure 39 – Step 6 of the Lookup wizard for Order Number in Order Lines
Click Finish to exit the lookup wizard.
46. Create a lookup for Product ID that uses the Product Catalogue table. The lookup
should use all the fields in the table and should use the Product ID to uniquely
identify each record.
Remember to use the lookup wizard and to following it step-by-step.
47. Once you have created the second lookup, save and close the table. This will
return you to the main database window.
By creating the lookups, you have linked the Product ID in Order Lines with the
Product ID in Product Catalogue and the Order Number in Order Lines with the
Order Number in Order Forms.
However, this link (called a relationship), can be more accurately specified. We
need to change the relationships so that only Product IDs that already exist in the
Product Catalogue can be enter in an Order Line and that only Order Numbers
that appear in Order Forms can be entered in Order Line.
We do this by enforcing referential integrity.
To begin click the Relationships button (
) on the toolbar: (Figure 40).
Figure 40 – Main database toolbar
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
42
48. This displays the relationships view. You will see that the 3 tables that you
created earlier are shown as small windows with the fields within the tables listed
(Figure 41).
Figure 41 – Relationships view
49. All the fields in the Order Forms table are not visible. To show all the fields we
need to resize the Order Forms window. Point to the bottom-left corner of the
window and the resize mouse pointer will appear. Click and drag the corner of the
window until all the fields are visible.
50. The lines between the tables represent the relationships. Point to the line between
Order Forms and Order Lines (Figure 42) and double click the left mouse button.
Figure 42 – Relationships view
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
43
51. The Relationships dialogue will be displayed (Figure 43). Select the Enforce
Referential Integrity check box. As discussed earlier, this will ensure that only
Order Numbers that already exist in the Order Forms table can be entered in
Order Lines.
Figure 43 – Relationships dialogue
52. Now select both Cascade Update Related Fields and Cascade Delete Related
Records and then click OK.
Figure 44 – Relationships dialogue with check boxes selected
This means that if an Order Form record is deleted all related Order Line details
would also be deleted. Also if an Order Number were changed for some reason
all occurrences of that Order Number in Order Lines would also be updated.
Notice that the relationship type is One-to-Many which matches the relationship
identified earlier between the two entities in the E/R diagram.
53. Do the same for the other relationship between Order Lines and Product
Catalogue.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
44
54. The relationship view now looks like figure 45. The 1 represents the one side of
the relationship and the infinity () symbol represents the many side of the
relationship.
Figure 45 – The relationships view with relationship types completed
55. Close the relationships window and click Yes to save the layout when prompted.
The design of the tables and their relational links is now completed. You are now
ready to enter data into the system.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
45
CASE STUDY ONE - OUTCOME 3 (ENTER DATA)
1. In the main database window, double click the Order Forms table.
2. This will open the Order Forms table in data sheet view. You can now type data
directly into the table. Enter the following details.
If, while you are entering the data, you find that you make a mistake and the
AutoNumber values for Order Number do not match those below, DO NOT
WORRY.
Customer
Number
Customer Name
6251
Mr Melvin Spiers
1092
Miss Jane Baxter
1929
Mrs Carol Watson
4591
Mr John Western
4591
Mr John Western
Customer
Address
32 Wedgewood
Street, Anaston
76 West Way,
Bonnytown
The Birches,
Anderton
12 Park Road,
Treward
12 Park Road,
Treward
Customer
Postcode
Order
Number
Order Date
AN78 8UY
1
16/12/00
BT8 8IU
2
17/12/00
AT91 7YU
3
17/12/00
TW12 7YH
4
18/12/00
TW12 7YH
5
5/01/01
Delivery
Date
05/01/01
Figure 46 – Data for Order Forms
3. Once you have entered the data click the Save button on the menu bar to save the
records and then close the Order Forms data sheet view window.
4. Now open the Product Catalogue and enter the following data.
Product ID
Product Name
Product Description
Unit Cost
1
Pine Dining Table
An antique effect pine table with drop down
features
£150.00
2
Antique Pine Dining Chair
A beautifully crafted item for the dining room.
£87.50
3
Outdoor Picnic Table
Made from robust treated timber. Ideal for
any garden.
£95.00
4
Pine Carver Chair
For the foot and head of a formal table. A
magnificently finished chair.
£110.75
5
Child’s Play Swing
A low swing for outdoors with its own frame
and safety features.
£125.00
6
Ornamental Rocking Horse
Age wood, hand carved into a traditional
rocking horse.
£368.00
Figure 47 – Data for Product Catalogue
5. Enter the details for the following Orders into the Order Lines table. Use the pull
down lists (the lookups) for the Order Number and Product ID fields to help you
enter the order details.
Mr Melvin Spiers’ order, with the order date 16 December 2000, is for
 1 Pine Dining Table @ £150.00 each
 4 Antique Pine Dining Chairs @ £87.50 each
 2 Pine Carver Chairs @ £110.75 each
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
46
Mr John Western’s order, with the order date 18 December 2000, is for
 1 Ornamental Rocking Horse @ £368.00 each
 2 Child’s Play Swings @ £125.00 each
Miss Jane Baxter’s order, with the order date 17 December 2000, is for
 2 Outdoor Picnic Tables @ £95.00 each
Mrs Carol Watson’s order, with the order date 17 December 2000, is for
 1 Outdoor Picnic Table @ £95.00 each
 1 Pine dining table @ £150.00 each
Mr John Western’s order, with the order date 5 January 2001, is for
 1 Pine Dining Table @ £150.00 each
 4 Antique Pine Dining Chairs @ £87.50 each
6. Close the Order Lines table.
7. Open the Order Forms table. Click the File and then Print…The print dialogue
box will appear (Figure 48). If possible change the properties of your printer so
that it will print the table landscape rather than portrait.
Figure 48 – Print dialogue box
8. Click OK to print your table.
9. Also open and print the Product Catalogue and the Order Lines tables. Keep
these printouts with your work folder or jotter so that your teacher can check them
when convenient.
10. Check your printouts against the following figures.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
47
Figure 49 – Print out of Order Forms 2
Figure 50 – Print out of Product Catalogue
Figure 51 – Print out of Order Lines
2
Because the AutoNumber data type is used in this system it may be the case that your Order Number
and Product ID values are different from those shown above and in subsequent tables. Please examine
the other data in the tables to assess the accuracy of your results.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
48
CASE STUDY ONE - OUTCOME 3 (MANIPULATIONS)
1. Add the following items to the Product Catalogue.
Product ID
Product Name
7
America White Oak
Wall Unit
8
Dylan Style Cot
Product Description
A modern style wall mounted display
unit with glass front panel.
Beech cot in five pieces for easy
self-assembly.
Unit Cost
£124.00
£327.00
Figure 52 – Additions to Product Catalogue
2. Change the price of the child’s play swing to £145.00.
3. The order for Miss Jane Baxter with the Order Date 17/12/00 was delivered on
20/01/01. Update the appropriate record.
4. Miss Jane Baxter also places an order on 07/01/01. She orders one American
White Oak Wall Unit. Enter the appropriate details in the database.
5. Mr Harry Walker of 90 West Way, Bonnytown, BT8 8IU places an order on
07/01/01. His Customer Number is 1041. He orders one American White Oak
Wall Unit. Enter the appropriate details in the database.
6. The order form for Mrs Carol Watson, dated 17/12/00 is an error and should not
be in the database. Delete the appropriate record from the Order Forms table.
To delete the record, open the Order Forms table. Highlight the row that the
record is in by clicking on the left-hand side of the row. Press the Delete button
on the keyboard or select Delete Record from the edit menu. Click OK or press
enter to confirm that you wish to delete this record.
When you delete the order all associated data in the Order Lines table is also
deleted. This is because, when the database was created, referential integrity was
enforced and cascade deletes was selected.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
49
CASE STUDY ONE - OUTCOME 3 (QUERIES)
1. The first query that you will create will show all orders where the Delivery Date
has not been entered.
2. Select the Query tab in the main database window (Figure 53).
Figure 53 – Print out of Order Lines
3. Select the New button to begin to create a new query. The new query dialogue
box opens up. Select Design View and then click OK (Figure 54).
Figure 54 – New query dialogue box
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
50
4. This opens the design view for the new query and the Show Table dialogue box so
that you can add the tables to the query that you require (Figure 55).
Figure 55 – New query dialogue box
Click Add to add the Order Forms table to the query then click Close.
5. Maximise the Query1: Select Query by clicking the maximise button in the top
right of the query window (Figure 56)
Figure 56 – Maximising query design view
6. Now click and resize the Order Forms table until you can see all the fields within
it (Figure 57).
Figure 57 – Resized order forms table
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
51
7. Move the mouse pointer over the Order Number field (Figure 58).
Figure 58 – Selecting order number
8. Click and hold down the left mouse button and drag the field to the first column in
the design grid (Figure 59).
Figure 59 – Dragging order number
9. Release the left mouse button to drop the Order Number field in the first column
(Figure 60).
Figure 60 – Order number in design grid
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
52
10. Drag the following fields into the other columns of the design grid: Order Date,
Delivery Date, Customer Number, Customer Name, Customer Address and
Customer Postcode (Figure 61).
Figure 61 – Order forms design grid
11. Click in the Criteria row for Delivery Date and enter the text Is Null. This means
that the query will select records where there is no data entered in the Delivery
Date field.
Also click the Show tick box so that the tick is not in the box (Figure 62). This
means that the Delivery Date field will not be shown in the answer table that the
query produces.
Figure 62 – Delivery date criteria
12. To see the answer table produced by the query click the View button on the
toolbar (Figure 63).
Figure 63 – View button on toolbar
13. The following answer table will be displayed (Figure 64). Remember that an
answer table is the result of a query.
Figure 64 – Answer table for delivery date is Null
14. Click the Save button on the toolbar and save the query as Delivery Date is Null
and then close the answer table by clicking File then Close.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
53
15. The next set of queries will calculate the total amount due for each of the orders.
This is the process identified as part of Task 5 for Outcome 1.
16. Start a new query by clicking the New button under the Queries tab (as shown
earlier).
17. Select Design View and click OK.
18. In the Show Table dialogue box click Order Lines and then Add.
19. Also click Product Catalogue and then click Add, then Close.
20. From the Order Lines table add Order Number and Quantity to the design grid.
From the Product Catalogue table add Unit Cost. The design grid should now
look like Figure 65.
Figure 65 – Answer table for delivery date is Null
21. At this point save the query as Calculate Order Line Totals by clicking the save
button on the toolbar and entering the above text.
22. Point to the Field row of the fourth column of the design grid and click the right
mouse button. The design grid context menu will appear (Figure 66).
Figure 66 – Query design grid context menu
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
54
23. Point to the command Build… and click the left mouse button. This will display
the expression builder dialogue box (Figure 67).
Figure 67 – Expression builder dialogue box
24. Double click Quantity in the second text window. It will appear in the expression
box at the top of the dialogue (Figure 68).
Figure 68 – Expression builder with Quantity in the expression box
25. Click the * (asterisk) operator button. The asterisk operator is used for
multiplication.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
55
26. Double click Unit Cost to add it to the expression box. The expression box should
now look as follows (Figure 69).
Figure 69 – Expression builder with calculation in expression box
27. Click OK to close the expression builder.
28. Click View on the toolbar to see the answer table created by this query (Figure
70).
Figure 70 – Expression builder with calculation in expression box
The answer table includes a calculation that is labelled Expr1. This is the
Quantity * Unit Cost. Now return to the query design view by clicking the design
button on the toolbar. This is so that the name Expr1 can be changed to something
more meaningful.
29. Click in the Field row of the fourth column of the design grid. Delete the text
Expr1 and add the text Order Line Total. Press enter when you are finished editing
the field name. It should now look like Figure 71.
Figure 71 – Order line total calculated field
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
56
30. Change the width of the query column so that all of the formula for Order Line
Total can be seen. Do this by pointing to the edge of the column, near the top, and
click then drag the mouse to make the row bigger (Figure 72).
Figure 72 – Order Line Total query column before and after resize
31. View the answer table for the query again by selecting the View button and then
save the query by clicking the Save button on the toolbar.
Here are some more examples of performing arithmetic operations in queries.
You enter the expression in the Field cell in the query design grid. The fields you
reference in the expression are from the tables or queries in the current query.
Expression
PrimeFreight: [Freight] * 1.1
OrderAmount:
[Quantity] * [UnitPrice]
LeadTime:
[RequiredDate] - [ShippedDate]
TotalStock:
[UnitsInStock]+[UnitsOnOrder]
FreightPercentage:
Sum([Freight])/Sum([Subtotal]) *100
Description
Displays freight charges plus 10 percent in
the PrimeFreight field.
Displays the product of the values in the
Quantity and UnitPrice fields in the
OrderAmount field.
Displays the difference between the values
in the RequiredDate and ShippedDate fields
in the LeadTime field.
Displays the sum of the values in the
UnitsInStock and UnitsOnOrder fields in the
TotalStock field.
Displays in the FreightPercentage field the
percentage of freight charges in each
subtotal, by dividing the sum of the values
in the Freight field by the sum of the values
in the Subtotal field. (This example uses the
Sum function.) The Total row in the design
grid must be displayed, and the Total cell for
this field must be set to Expression.If the
Format property of the field is set to Percent,
don’t include the *100.
Figure 73 – Examples of arithmetic operations carried out in queries
Note: When you use an arithmetic operator (+, -, *, /) in an expression and the
value of one of the fields in the expression is Null, the result of the entire
expression will be Null. If some records in one of the fields you used in the
expression might have a Null value, you can convert the Null value to zero using
the Nz function; for example:
Nz([UnitsInStock])+Nz([UnitsOnOrder])
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
57
The previous query calculated the total for each line of an order. The next query
will calculate the total for each order.
32. Start a new query in design view.
33. Choose Order Forms from the Show Table dialogue box.
34. Click the Queries tab in the Show Table dialogue and add the Calculate Order
Line Totals query.
35. Click Close to close the dialogue box.
36. Maximise the query design grid and drag the column area down the screen to
leave more room for the table area (Figure 74).
Figure 74 – Resizing a query design grid
37. Resize each of the tables so that all the fields are visible (Figure 75).
Figure 75 – Calculate order totals query resized
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
58
38. Add the following fields from Order Forms to the query: Order Number,
Customer Number, Customer Address, Customer Postcode, Order Date and
Delivery Date. Also add Order Line Total from Calculate Order Line Totals. The
design grid should look like Figure 76.
Figure 76 – Required fields in query
39. There are a number of statistical options that can be applied to queries. These are
added to the query by selecting the Totals button on the toolbar (Figure 77).
Figure 77 – Totals button from toolbar
40. The Total row is added to the query design grid (Figure 78).
Figure 78 – Totals row added to query design grid
41. Click the left mouse button in the Total row in the column for Order Line Total.
Select Sum from the menu that appears (Figure 79).
Figure 79 – Total pull down menu
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
59
42. This query will now add together all the Order Line Totals for order lines with the
same Order Number. To view the answer table created by this query click the
view button on the toolbar. The answer table will show the SumofOrder Line
Total as one of the column headings (Figure 80).
Figure 80 – Calculation of Order Totals
43. Save this query as Calculate Order Form Totals.
44. The next query will find items in the Product Catalogue that cost over £150. Start
a new query in design view and add the Product Catalogue table.
45. Add each of the four fields from the product catalogue into the design grid
columns.
46. In the Unit Cost column add the following criteria, >150.
47. Save the query as Cost greater than 150.
48. Click the View button to see the results of the query (Figure 81).
Figure 81 – Product costing greater than £150.00 answer table
In Access you can create queries to retrieve records that contain values within a
specific range or ranges.
In query design view, create a query. Add the tables whose records you want to
use, and then add the fields you want to include in the results to the query design
grid.
In an expression in the Criteria cell of the appropriate field, identify a range by
using the Between...And operator or the comparison operators (<, >, <>, <=,
and >=). For example, you can find orders placed before 1-Jan-93 or products that
have between 10 and 35 units in stock. The following table shows some examples
of operators used in expressions.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
60
Expression
>=234
Between #2/2/93# And #12/1/93#
<1200.45
>="Morrison"
Meaning
Numbers greater than or equal to 234
Dates from 2-Feb-93 through 1-Dec-93
Numbers less than 1200.45
All names from Morrison through to the end of
the alphabet
Figure 82 – Examples of comparison operators in queries
49. The next query will calculate the total quantity sold for each product and will then
sort the products into descending order according to the quantity sold.
Start a new query in the usual way.
50. Add the tables Order Lines and Product Catalogue to the query.
51. Add Product ID, Product Name and Unit Cost from Product Catalogue and
Quantity from Order Lines.
52. Click the Totals button to display the Total row in the design grid.
53. Select Sum from the pull down list for Total in the Order Lines column.
54. Select Descending from the pull down list for Sort in the Order Lines column.
Your query should now look like Figure 83.
Figure 83 – Products with sorted quantity totals query
55. Save the query as Products with quantity totals.
56. Select View from the toolbar to see the results of your query. The answer table
produced should look as follows (Figure 84).
Figure 84 – Products with sorted quantity totals query
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
61
57. Change the width of the Product Name column so that you can see all the data in
it. To do this click between the column headings Product Name and Unit Cost
and drag the column to make it wider (Figure 85).
Figure 85 – Resizing an answer table column
58. Finally, you will create a query that uses wildcards. Wildcards are operators that
mean "anything". For example, we want to find orders for all people who have a
"J" in their name. To do this start a new query in the usual way.
59. Add the table Order Forms to the query.
60. Add the fields Customer Name, Order Number and Order Date to the design grid.
61. Enter *j* as the criteria for Customer Name and press return. The criteria will
change to Like "*j*" (Figure 86).
Figure 86 – Query using wildcards
62. Save this query as Customer Names containing J.
63. View the answer table created by the query (Figure 87).
Figure 87 – Answer table for Customer Name containing J
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
62
64. Now create the following queries and check the answer tables produced against
the figures below:
a) The total cost of orders for Miss Jane Baxter (Figure 88). Hint: Add all three
tables.
b) Product ID and Product Names for products where more than one has been
sold (Figure 89).
c) The names of customers who have ordered chairs (Figure 90).
d) All Customer Names and Order Numbers for orders placed on or after
1 January 2001 (Figure 91).
Figure 88 – Total Cost of Orders for Miss Jane Baxter
Figure 89 – Total Sales for Products greater than 1
Figure 90 – People who have ordered chairs
Figure 91 – Sales on or after 1 Jan 2001
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
63
CASE STUDY ONE - OUTCOME 3 (QUERIES)
ANSWERS TO QUESTIONS
a)
b)
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
64
c)
d)
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
65
CASE STUDY ONE - OUTCOME 3 (REPORTS)
A report is an effective way to present your data in a printed format. Because you
have control over the size and appearance of everything on a report, you can display
the information the way you want to see it.
Most of the information in a report comes from an underlying table or query, which is
the source of the report’s data. Other information in the report is stored in the report’s
design.
The following outputs are required for this database system (from Outcome 1, Task 5).
Entity
Order Forms
Order Lines
Product Catalogue
Output
Completed Order Forms and Totals.
List of customers.
Completed Order Forms and Totals.
List of products in order of quantities sold.
Completed Order Forms and Totals.
List of products in order of quantities sold.
Figure 92 – Outputs for the Order System
1. Click the Reports option in the main database window (Figure 93).
Figure 93 - Reports Tab in main database window
2. Click New to start a new report.
3. Choose Calculate Order Form Totals as the underlying table/query by selecting
it from the pull-down list.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
66
4. Ensure that Design View is also selected. The New Report dialogue should now
look like Figure 94.
Figure 94 - New Report dialogue
5. Click OK.
6. Maximise the report design window.
7. Point anywhere in the design window and click the right mouse button. The
Report design context menu will be displayed (Figure 95).
Figure 95 - Report design context menu
8. Point to Page Header/Footer and select it so that the paper headers and footers
are removed from the design window.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
67
9. Resize the area for the report by dragging the edges of the report area until they
are similar to Figure 96.
Figure 96 - Report design grid
10. Click Field List and Toolbox from the toolbar (Figure 97).
Field List
Toolbox
Figure 97 - Field List and Toolbox on toolbar
11. The Field List window and the Toolbox floating toolbar will be displayed in the
report design window. Drag and resize them until they are similar to Figure 98.
Figure 98 - Field List window and Toolbox toolbar
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
68
12. Click on Order Number in the field list window and drag it into the fourth box in
the first row of the design grid (Figure 99).
Figure 99 - Placing Order Number in report design
13. Drop the field in the box. It will appear on the report design (Figure 100).
Figure 100 - Order Number in report design
14. Drag and drop all the other fields apart from SumOfOrder Line Total. You will
need to resize the Customer Address text box so that all the customer’s address
will be shown in the report. The report design should now look like Figure 101.
Figure 101 - Report design
15. Save the report as Order Form with Order Lines.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
69
16. Ensure sure that the Select Objects and Control Wizards buttons are selected
(Figure 102).
Select
Objects
Control
Wizards
Figure 102 - Report design
17. Select the Subform/Subreport button from the toolbox (Figure 102).
18. Drag a rectangle using the Subreport tool (Figure 103).
Figure 103 - Subreport rectangle
19. When you release the mouse the Subform/Subreport wizard will start up. A
Subreport is an area of a report that is based on a different underlying table or
query from the main report. The subreport is linked to the main report by a
common field which creates a relationship between the two.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
70
20. Select Table/Query as the basis of the report then click Next (Figure 104).
Figure 104 - Subreport wizard step 1
21. Select the Query: Calculate Order Line Totals and use the double arrow button
to select all the fields (Figure 105)
Figure 105 - Subreport wizard step 2
Click Next.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
71
22. The next step of the wizard allows you to create the link between the two forms.
Select the Define my own radio button. Choose Order Number from both the
pull-down lists (Figure 106).
Figure 106 - Subreport wizard step 3
This will show records from Calculate Order Line Totals where the Order
Number is the same as the Order Number shown in the main form.
Click Next.
23. The final part of the wizard saves the subreport using the name you enter. The
default name is satisfactory so click Finish (Figure 107).
Figure 107 - Subreport wizard step 4
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
72
24. Access will take a few seconds to create and save the subreport. When the
subreport is created you will not see it in the design view. You will only see the
space on the main form reserved for the subform (Figure 108).
Figure 108 - Subreport area within main report
25. Finally, drag and drop the SumOfOrder Line Totals field to the bottom of the
report, underneath the subreport (Figure 109).
Figure 109 - Report with overall total added
26. To view what the report will look like when printed click the Print Preview
button on the toolbar (Figure 110).
Figure 110 - Print Preview Button
27. Use the navigation button at the bottom of the window to move forward and back
through the pages of the report (Figure 111).
Figure 111 - Navigation buttons
28. Click Close to close the Print Preview view then click the Save button to save the
changes to the report.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
73
29. Close the report design view.
30. You will notice that in the main database window there are now two reports:
Order Form with Order Lines and Calculate Order Line Totals subreport.
An alternative to creating a report from scratch is to use the Report Wizard.
Nearly every report you create can be constructed using the ReportWizard. The
wizard takes you through a number of steps in the construction of a report.
31. To start the report wizard click New within the Reports tab.
32. The New Report dialogue will appear. Click Report Wizard and base the report
on the Query: Products with quantity totals by choosing Products with quantity
totals from the pull-down list of tables and queries (Figure 112).
Figure 112 - Starting the Report Wizard
33. Click OK to start the Report Wizard.
34. Use the double arrow button to add all the fields from the source query to the
report then click Next (Figure 113).
Figure 113 - Adding fields using the Report Wizard
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
74
35. Grouping levels show a particular field’s values before others. You don’t need
grouping levels for your queries so click Next to proceed to the next stage of the
wizard.
Figure 114 - Adding grouping levels
36. Sorting is now added to the report. The report can be sorted on multiple fields.
For this particular report you will sort it on the SumOfQuantity and then on
Product ID (Figure 115) both ascending.
Figure 115 - Sorting the report
Click Next.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
75
37. The next step is to define the type of layout used for the report and the orientation
for the page. Select the Justified radio button and the Portrait radio button
(Figure 116) the click Next.
Figure 116 - Selecting a layout
38. You can choose a range of pre-set styles that can be applied to your report. Select
the Bold style (Figure 117) and click Next.
Figure 117 - Selecting a Style
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
76
39. The final step of the wizard allows you to save the report and either view it in
print preview or open it for modification. Select the Preview the report radio
button (Figure 118) and click Finish.
Figure 118 - Saving and previewing a report
40. The previewed report should look like Figure 119.
Figure 119 - Products list produced by Report Wizard
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
77
41. The final report that we are going to construct requires a new query. Create a new
query as follows (Figure 120):
Figure 120 - Products list produced by Report Wizard
42. The new query uses the Group By option to show only unique records for the
customer details. Save this query as Customer Details and return to the main
database window.
43. Start a new report based on this query. Add all the fields from the query to the
report and sort the report on descending Customer Number (Figure 121).
Figure 121 - Sorting Customer Number into descending order
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
78
44. Finish the remaining stages of the report wizard and save the report as Customer
Details.
45. To print the report to the printer select Print from the File menu and click OK or
select the printer icon from the toolbar.
46. Now construct the following reports on your own. You may have to construct
some queries on which to base your reports.
a) Create a new report that shows complete order forms generated by customers.
Each order line on the order forms should include the Product ID, Product
Name, Quantity, Unit Cost and Order Line Total.
b) Produce a columnar style report showing all product details sorted by Product
ID.
c) Produce a columnar style report showing all products sorted by the total cash
value of their sales (Hint: Unit Cost * Total Quantity Sold).
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
79
CASE STUDY ONE - OUTCOME 3 (EVALUATION)
Finally, you should write an evaluation of the new electronic system compared to the
original paper-based manual system. Your evaluation should answer the following
questions:
a) How easy is it to enter, update and delete data using the electronic system
compared to the original system?
b) Can many users access the electronic system compared to the original system?
c) What improvements are there to reports and other outputs produced by the
electronic system compared to the original system?
d) What improvements are there to the accessing, locating and calculation of data
items within the electronic system compared to the original system?
e) How much physical storage does the new electronic system require compared to
the original system?
Task 8
Use the above points as the basis for an evaluation of the new electronic database
system compared to the original manual paper-based system.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
80
Answer to Task 8 - Evaluation of Reid and Wilson Limited electronic database
system
Reid and Wilson have replaced the old manual system that they used for processing
customer orders with a new electronic database system. This system has a number of
advantages over the previous system:

Data can now be updated using a computer keyboard. Order Forms no longer
have to be stored in paper files and then processed by hand. The operator now
enters and edits the data at the keyboard and then the saved data can be made
available to others because it is in an electronic form which can be opened using
any computer system with the correct software installed.

The electronic system provides more efficient access to data because rather than
searching through many paper-based records and files the company can now
search the system electronically and receive answers to their questions in seconds.
The range of possible searches is far more than was possible for them to carry out
using the manual system. Queries can look for criteria across different tables and
popular queries can be saved so that they can be carried out again.

Custom reports can be created according to any special set of circumstances. The
software has tools within it that support any table or subset of a table being used
as the basis of a report. The reports can be specially formatted and summary
information can be added such as totals, averages and so on. The overall quality
of the presentation of the data produced by the electronic system is far superior to
the hand written or typed reports that were produced from the data in the original
system.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
81
CASE STUDY TWO - OUTCOME 1
Construct a data model of an existing system
The Total Ten Pin League is a collection of ten-pin bowling teams from around the
city of Glasgow. The league is currently organised by a co-ordinator that arranges
games for the teams. Each Wednesday, the co-ordinator sends all the team captains a
scorecard that tells the captain where his/her team is playing the coming Saturday.
The scorecard looks like this:
Team Name:
Venue Name:
Venue Address:
Venue Postcode:
The Vipers
Tens-Away
15 Brewer Street
Glasgow
GL12 7RQ
Venue Hire Charge: £90.00
Team Capt.:
Date of Game:
Charlie D Burton
10/03/2001
Venue Tel:
0141 829 827
Final Score:
Figure 122 - A typical scorecard
The league is very friendly and the purpose is to give the teams the opportunity to
visit all the different ten-pin bowling alleys in the city. The games are not
competitive. In fact, no team plays against another one.
The only competitive aspect of the league is that the team captain sends the score card
back to the co-ordinator at the end of the team’s game with the final score for the team
written into the space provided.
When the co-ordinator receives the card she files it in a card index. At the end of the
year she totals up the scores for each team and then sorts them into descending order
by the score. This shows each team how they have performed that year against the
others.
At then end of each year she also has to calculate how much the league has to pay
each venue for the use of their facilities. She uses the index cards to calculate the
total charges for each venue.
In order that this money can be paid she has to issue each team with a bill. This bill is
equal to the total hire charges against the team plus an administration fee of 20%.
As well as the scorecards she also has card indices showing details of the venues
available and the teams that are members of the league. Here are two samples of
these cards.
Team Name:
Team Address:
Team Postcode:
The Vipers
12 West Loan St
Glasgow
G15 9LQ
Team Capt.:
Team Tel:
Charlie D Burton
0141 822 222
Figure 123 - A sample team index card
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
82
Venue Name:
Venue Address:
Venue Postcode:
Tens-Away
15 Brewer Street
Glasgow
GL12 7RQ
Venue Tel:
Venue Hire Charge:
0141 829 827
£90.00
Figure 124 - A typical venue index card
Additional Information
 No two venues have the same name. No two teams have the same name.
 Teams only play in one venue each Saturday. Each venue only hosts one team per
Saturday.
 The hire charge varies according to which venue is being played in. All teams that
play in a particular venue are charged the same hire cost for that venue.
 All the teams can play in all the venues.
 Any team can play any venue more than once in a year.
 The venue hire charge is always between £40.00 and £120.00. It should be shown
in this format to two decimal places.
 Venues and teams can be added, amended and deleted. When a venue or team is
deleted all the associated scorecards are also deleted. This can only be done at the
end of a year of the league and after all the hire charges etc. have been dealt with.
 Each team’s final score will be greater than or equal to 0.
Now do the following:
Task 1
Using the above information write down the primary entities as they exist in the
current system.
Task 2
Now take the un-normalised data model and normalise it to first normal form by
removing repeating groups.
Task 3
Create an E/R diagram to illustrate the data model in first normal form.
Task 4
Create a data dictionary for the data model.
Task 5
List the inputs, processes and outputs required for the system to function.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
83
CASE STUDY TWO - OUTCOME 2
Design database structures to represent a data model of an existing system.
The Total Ten Pin League now wants to implement the database system using the
Microsoft Access RDBMS.
In order for the database to be created a design must be completed that matches the
data model to the features available with in the proposed implementation software.
The design should meet the following requirements:
 database structure and data item names are appropriate to the data model.
 unique keys are chosen for all database structures.
 data item characteristics correctly represent the data model (such as field sizes,
types and keys).
 data item validity checks correctly represent the data model. This should include at
least one presence, range and restricted choice check.
 designed database structures are appropriate to the intended implementation
method.
Task 6
Complete a detailed design showing the characteristics of each data item in the
system.
Task 7
List the data items that are linked in order to create the relationships between the
tables.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
84
CASE STUDY TWO - OUTCOME 3
Task 8
Implement your designed database structure by creating tables and fields as per your
design.
The Total Ten-pin League has supplied you with data from the existing system. Enter
this data into your database.
Team Name Team Captain
Team Address
The Vipers
Blue Pins
Red Socks
Charlie D Burton 12 West Loan St, Glasgow
Harry Ramsey 17 Church Street, Coatbridge
Mike Rally
The Loanings, Cedar Walk,
Cumbernauld
The Trolls
Amber Rose
3 Cliff Side Way, Greenock
Eighty-Ones June Stewart
98b Dunkeld Road, Livingstone
Team
Postcode
GL15 9LQ
GL98 8UY
GL87 9QW
Team Tel No
0141 822 222
01356 87278
0141 777 878
GL90 8AB
GL76 6QW
01452 1411
01418 9892
Figure 125 - Team data from the existing system
Venue Name
Venue Address
Tens-Away
ABC Bowl
Venue
Postcode
GL12 7RQ
GL56 6RT
15 Brewer Street, Glasgow
12 St Vincents Street,
Glasgow
The Right Place 87 Argyll Road, Glasgow
GL11 8YU
Bowl Away
Unit 7, Park Industrial Estate, GL5 8YH
Glasgow
Venue Tel No
0141 829 827
0141 762 111
Venue Hire
Charge
£90.00
£116.00
0141 672 762
0141 878 897
£76.00
£49.00
Figure 126 - Venue data from the existing system
Team Name
The Vipers
Eighty-Ones
Blue Pins
The Trolls
The Vipers
Red Socks
Red Socks
Blue Pins
Eighty-Ones
The Trolls
Venue Name
Tens-Away
Bowl Away
Tens-Away
Bowl Away
ABC Bowl
The Right Place
ABC Bowl
The Right Place
Tens-Away
ABC Bowl
Date of Game Final Score
10/03/01
1092
10/03/01
1262
17/03/01
982
17/03/01
1302
17/03/01
1498
17/03/01
915
24/03/01
1400
24/03/01
1298
24/03/01
870
24/03/01
1092
Figure 127 - Scorecard data from the existing system
Print each of the tables created. Keep these printouts to shown your teacher/
lecturer.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
85
Task 9
Now carry out the following manipulations on the data:
a) The following games will take place on 31 March 2001:
 Blue Pins at ABC Bowl
 Eighty-Ones at The Right Place
 Red Socks at Bowl Away
 The Vipers at Tens-Away
b) The score entered for the Eighty-Ones on 24 March 2001 has been entered
incorrectly. It should be 1870 rather than 870.
c) Mike Rally, the captain of the Red Socks, has left the area. The new captain of
the team is Neve Pollock and her address is 981 Long Street, Glasgow, GL99
5FR. Her telephone number is 0141 762 981.
d) Charlie D Burton, the captain of The Vipers, has moved house. His new address
is 3 Croft Lane, Glasgow, GL43 8UY. His phone number remains as before.
e) The venue called The Right Place has been taken over by new management. They
have changed the name of the bowling alley to Blazing Alley. They have also
increased the hire charge to £90.00 and backdated it to the start of the season.
f) Sort the Teams table on ascending Team Name and print it out.
g) Sort the Venues table on descending Hire Charge and print it out.
h) Sort the Scorecards on descending Final Score and print it out.
Task 10
Create the following queries. Output the results of the queries by designing a suitable
report.
a) Calculate the total score for each team. In the report show all the team details
with the total.
b) Calculate the total hire charges for each team. Show the Team Name, Team
Captain and the Total in the report.
c) Calculate the total hire charges for each venue. Show all the venue details in the
report along with the total.
d) Produce a report that prints a scorecard, like the original system example above,
for each game where the final score is 0.
Task 11
Finally, you should write an evaluation of the new electronic system compared to the
original paper-based manual system. Use the information on page 73 to help you.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
86
CASE STUDY TWO - SOLUTION
Answer to Task 1
Scorecards ( Team Name*
Team Capt.
Date of Game
Venue Name*
Venue Address
Venue Postcode
Venue Tel
Venue Hire Charge
Final Score)
Venues (
Venue Name
Venue Address
Venue Postcode
Venue Tel
Venue Hire Charge)
Teams (
Team Name
Team Capt.
Team Address
Team Postcode
Team Tel)
Answer to Task 2
Scorecards ( Team Name*
Date of Game
Venue Name*
Final Score)
Venues (
Venue Name
Venue Address
Venue Postcode
Venue Tel
Venue Hire Charge)
Teams (
Team Name
Team Capt.
Team Address
Team Postcode
Team Tel)
Answer to Task 3
Teams
1
M
complete
Scorecards
M
host games
on
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
1
Venues
87
Answer to Task 4
Entity
Teams
Attributes
Team Name
Team Capt.
Team Address
Team Postcode
Team Tel
Venues
Venue Name
Venue Address
Venue Postcode
Venue Tel
Venue Hire Charge
Scorecards
Team Name
Date of Game
Venue Name
Final Score
Description
The name of the team, unique team
identifier, text, required.
The name of the team captain, text,
required.
All address details for the team excluding
the postcode, text and numbers, required.
Postcode of the team, required, 8
characters matching the standard postcode
format.
The telephone number of the venue,
numbers and text, required.
The name of the venue, unique venue
identifier, text, required.
All address details for the venue excluding
the postcode, text and numbers, required.
Postcode of the venue, required, 8
characters matching the standard postcode
format.
The telephone number of the venue,
numbers and text, required.
The cost to hire the venue, required, a
number in the currency format in the range
between 40 and 120.
The name of the team, unique team
identifier, text, required, lookup from the
teams entity.
The date that the game is played, required,
date format.
The name of the venue, unique venue
identifier, text, required, lookup from the
venues entity.
The score for a game, numbers only,
required, greater than or equal to zero.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
88
Answer to Task 5
Entity
Teams
Venues
Scorecard
Input
Add a new team to
the league.
Update a team’s
details.
Delete a team from
the league at the end
of the year.
Add a new venue.
Update a venue’s
details.
Delete a venue from
the league at the end
of the year.
Create a new
scorecard.
Amend the details on
a scorecard.
Enter the final score
from a returned
scorecard.
Delete a scorecard at
the end of the year.
Process
Calculate the total
hire charges for each
team.
Calculate the total
score cost for each
team.
Output
The total hire charges
for each team.
The total score for
each team.
A scorecard for each
team for each game.
Calculate the total
hire charges for each
venue.
Calculate the total
hire cost for each
team.
Calculate the total
hire charges for each
team.
Calculate the total
hire charges for each
venue.
Calculate the total
score charges for each
team.
The total hire charges
for each team.
The total hire charges
for each venue.
A scorecard for each
team for each game.
The total hire charges
for each team.
The total score for
each team.
The total hire charges
for each venue.
A scorecard for each
team for each game.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
89
Answer to Task 6
Database: Total Ten-pin League
Table: Teams
Fieldname
Type
Size
Team Name
Text
25
Team Captain
Text
45
Team Address
Text
255
Team Postcode
Text
8
Team Tel No
Text
20
Validation
Database: Total Ten-pin League
Table: Venues
Fieldname
Type
Size Validation
Venue Name
Text
25
Venue Address
Text
255
Venue Postcode
Text
8
Venue Tel No
Text
20
Venue Hire Charge
Currency
Auto >40 AND <120
Database: Total Ten-pin League
Table: Scorecards
Fieldname
Type
Size Validation
Team Name
Text
25
Lookup from
Teams
Venue Name
Text
25
Lookup from
Venues
Date of Game
Date
Auto
Final Score
Number
Auto >=0
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
Format
LL09 0LL
Format
LL09 0LL
£999.00
Format
Req’d
Yes
Yes
Yes
Yes
Yes
Index
Yes (No Duplicates); Primary Key
No
No
No
No
Req’d
Yes
Yes
Yes
Yes
Yes
Index
Yes (No Duplicates); Primary Key
No
No
No
No
Req’d
Yes
Index
Yes (Duplicates OK); Part of Primary
Key
Yes (Duplicates OK)
Yes
Short date
Yes
Yes
Yes (Duplicates OK); Part of Primary
Key
No
90
Answer to Task 7
[Teams].[Team Name]
[Venue].[Venue Name]
1:M
1:M
[Scorecards].[Team Name]
[Scorecards].[Venue Name]
Answer to Task 8
Check printouts against tables on page 78.
Answer to Task 9
Table: Teams
Team Name
Blue Pins
Eighty-Ones
Red Socks
The Trolls
The Vipers
Team Captain
Harry Ramsey
June Stewart
Neve Pollock
Amber Rose
Charlie D Burton
Team Address
17 Church Street, Coatbridge
98b Dunkeld Road, Livingstone
981 Long Street, Glasgow
3 Cliff Side Way, Greenock
3 Croft Lane, Glasgow
Team
Postcode
GL98 8UY
GL76 6QW
GL99 5FR
GL90 8AB
GL43 8UY
Team Tel No
01356 87278
01418 9892
0141 762 981
01452 1411
0141 822 222
Table: Venues
Venue Name
ABC Bowl
Blazing Alley
Tens-Away
Bowl Away
Venue Address
12 St Vincents Street, Glasgow
87 Argyll Road, Glasgow
15 Brewer Street, Glasgow
Unit 7, Park Industrial Estate,
Glasgow
Venue
Postcode
GL56 6RT
GL11 8YU
GL12 7RQ
GL5 8YH
Venue Tel No
0141 762 111
0141 672 762
0141 829 827
0141 878 897
Venue Hire
Charge
£116.00
£90.00
£90.00
£49.00
Table: Scorecards
Team Name
Eighty-Ones
The Vipers
Red Socks
The Trolls
Blue Pins
Eighty-Ones
The Trolls
The Vipers
Blue Pins
Red Socks
The Vipers
Red Socks
Eighty-Ones
Blue Pins
Venue Name
Tens-Away
ABC Bowl
ABC Bowl
Bowl Away
Blazing Alley
Bowl Away
ABC Bowl
Tens-Away
Tens-Away
Blazing Alley
Tens-Away
Bowl Away
Blazing Alley
ABC Bowl
Date of Game Final Score
24/03/01
1870
17/03/01
1498
24/03/01
1400
17/03/01
1302
24/03/01
1298
10/03/01
1262
24/03/01
1092
10/03/01
1092
17/03/01
982
17/03/01
915
31/03/01
0
31/03/01
0
31/03/01
0
31/03/01
0
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
91
Answer to Task 10
a) Total score for each team
Query Design
Report Output
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
92
b) Total Hire Charges for Team
Query Design
Report Output
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
93
c) Total Hire Charges for Venue
Query Design
Report Output
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
94
d) Scorecards
Query Design
Report Design
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
95
Answer to Task 11
The Total Ten-pin League has replaced the old manual system that they used for
recording the games with a new electronic database system. This system has a
number of advantages over the previous system:

Data can now be updated using a computer keyboard. Scorecards no longer have
to be stored in card indices and then processed by hand. The co-ordinator now
enters and edits the data at the keyboard rather than by hand. This leads to fewer
errors occurring during the data entry process.

The electronic system provides more efficient access to data because rather than
searching through many paper-based records and files the co-ordinator can now
search the system electronically and receive answers to their questions in seconds.
The range of possible searches is far more than was possible for them to carry out
using the manual system. Queries can look for criteria across different tables and
popular queries can be saved so that they can be carried out again.

Custom reports can be created according to any special set of circumstances. The
software has tools within it that support any table or subset of a table being used
as the basis of a report. The reports can be specially formatted and summary
information can be added such as totals, averages and so on. The use of the
computer software to carry out calculations decreases greatly the number of
errors that occur in the system.

The overall quality of the presentation of the data produced by the electronic
system is far superior to the hand written or typed reports that were produced
from the data in the original system.
Information Systems: Using Microsoft Access for Database Systems (H) – Study materials
96
Download