Module 5 Manual

advertisement
MODULE 5
DATABASES
Module Goals
Module 5 - Databases, requires candidates to understand some of the basic concepts of databases
demonstrate the ability to use a database on a personal computer. Candidates acquire the skill to
create and modify tables, queries, forms and reports and prepare printed outputs. They will also be
able to relate tables and will develop competency in retrieving and manipulating information from
existing databases using the query and sort tools.
Content
5.1
Using the Application.................................................................................. 1
5.1.1
Database Concepts ................................................................................................................. 1
• Fields .................................................................................................................................1
• Data Type ..........................................................................................................................1
• Field Properties .................................................................................................................1
• Tables................................................................................................................................1
• Forms ................................................................................................................................1
• Queries ..............................................................................................................................1
• Reports ..............................................................................................................................2
• Primary Key .......................................................................................................................2
• Index..................................................................................................................................2
• Relating Tables..................................................................................................................2
• Relationship Rules ............................................................................................................2
First Steps with Databases...................................................................................................... 2
• Open a Database Application............................................................................................2
• Open an Existing Database when Access is Run .............................................................4
• Open an Existing Database...............................................................................................4
• Create a New Database ....................................................................................................4
• Save a Database onto a Hard Disk or Diskette.................................................................4
• Close the Database...........................................................................................................5
• Use Help Functions ...........................................................................................................5
Adjust Basic Settings............................................................................................................... 5
• Change Viewing Modes ....................................................................................................5
• Display / Hide Toolbars .....................................................................................................6
5.1.2
5.1.3
5.2
Tables ........................................................................................................... 6
5.2.1
Main Operations ...................................................................................................................... 6
• Design and Plan a Database.............................................................................................6
• Create a Table...................................................................................................................6
• Field Name ........................................................................................................................7
• Data Type ..........................................................................................................................7
• Description.........................................................................................................................7
• Field Properties .................................................................................................................7
• Exercise 5.1.......................................................................................................................8
• Enter Data into a Table .....................................................................................................8
• Exercise 5.2.......................................................................................................................8
• Modify Data .......................................................................................................................8
• Delete Data in a Table.......................................................................................................9
• Add Records to the Database ...........................................................................................9
• Delete Records in a Database ..........................................................................................9
• Navigate throughout a Table .............................................................................................9
• Delete a Table .................................................................................................................10
Module 5
Unauthorised Photocopying is Unlawful
5.2.2
5.2.3
5.2.4
• Close a Table ..................................................................................................................10
Define Keys ...........................................................................................................................10
• Define a Primary Key ......................................................................................................10
• Assign a Field a Primary Key ..........................................................................................10
• Set up an Index ...............................................................................................................10
Table Design / Layout............................................................................................................11
• Field Format Attributes ....................................................................................................11
• Modify Field Size .............................................................................................................11
• Modify Number Format....................................................................................................11
• Modify Date Format.........................................................................................................11
• Consequence of Changing Field Size Attributes.............................................................12
• Validation Rule ................................................................................................................12
• Move a Column within a Table ........................................................................................12
• Change Column Widths ..................................................................................................12
• Sort a Table .....................................................................................................................13
• Exercise 5.3.....................................................................................................................13
Table Relationships ...............................................................................................................14
• One-To-One Relationship ...............................................................................................14
• One-To-Many Relationships............................................................................................15
• Delete a Relationship ......................................................................................................16
• Relationship Rules ..........................................................................................................16
5.3
Forms ......................................................................................................... 16
5.3.1
Working with Forms...............................................................................................................16
• Open a Form ...................................................................................................................16
• Create a Form .................................................................................................................17
• Create a Form using the AutoForm Facility ....................................................................19
• Enter Data into Database using a Form..........................................................................19
• Modify Data in a Database using a Form........................................................................19
• Delete Records using a Form..........................................................................................19
• Form Navigation ..............................................................................................................19
• Exercise 5.4.....................................................................................................................20
Modify Form Layout...............................................................................................................20
• Format Text .....................................................................................................................21
• Change Background Colours in a Form Layout ..............................................................21
• Import an Image or Graphic into a Form .........................................................................21
• Add a Header to a Form..................................................................................................22
• Add a Footer to a Form ...................................................................................................23
• Change Arrangement of Objects within a Form ..............................................................23
• Delete a Form..................................................................................................................23
• Save and Close a Form...................................................................................................23
• Exercise 5.5.....................................................................................................................23
5.3.2
5.4
Retrieving Information .............................................................................. 24
5.4.1
Main Operations ....................................................................................................................24
• Find a Record ..................................................................................................................24
• Apply a Filter....................................................................................................................24
• Remove a Filter ...............................................................................................................24
• Filter by Form ..................................................................................................................24
• Remove Filter by Form....................................................................................................25
Queries ..................................................................................................................................25
• Create a Simple Query....................................................................................................25
• Save a Query...................................................................................................................26
• Run a Query ....................................................................................................................27
• Delete a Query ................................................................................................................27
• Create a Query with Multiple Criteria ..............................................................................27
• Using AND and OR to Affect Query Results ...................................................................28
• Find Duplicates Query.....................................................................................................28
• Exercise 5.6.....................................................................................................................29
5.4.2
Module 5
Unauthorised Photocopying is Unlawful
5.4.3
• Add Fields to a Query......................................................................................................29
• Remove Fields from a Query ..........................................................................................29
• Hide Fields in a Query.....................................................................................................30
Sort Records..........................................................................................................................30
• Sort Data based on a Query............................................................................................30
• Sort Data based on Common Logical Operators ............................................................30
• Sort a Table .....................................................................................................................31
• Sort a Form......................................................................................................................31
• Exercise 5.7.....................................................................................................................31
5.5
Reports....................................................................................................... 32
5.5.1
Working with Reports ............................................................................................................32
• Create a Report ...............................................................................................................32
• Modify a Report ...............................................................................................................35
• Align Fields and Format Text in Header and Detail Sections .........................................35
• Delete a Control...............................................................................................................35
• Create and Customise Headers and Footers..................................................................35
• Group Data in Reports using the Wizard ........................................................................36
• Group Data in a Report ...................................................................................................37
• Delete a Report ...............................................................................................................37
• Exercise 5.8.....................................................................................................................38
• Exercise 5.9.....................................................................................................................38
5.6
Prepare Outputs ........................................................................................ 38
5.6.1
Prepare to Print .....................................................................................................................38
• Preview............................................................................................................................38
• Change Report Orientation .............................................................................................38
• Change Paper Size .........................................................................................................38
• Print Table Options..........................................................................................................39
• Print from Form................................................................................................................39
• Print Result of a Query ....................................................................................................39
• Print a Report ..................................................................................................................39
5.7
Extra Exercises.......................................................................................... 40
Disclaimer:
Please note that all assessments in this module of the workbook are designed solely for practice of
the skills explained in this module. They are not ECDL certification test items and should not be
construed as such.
Module 5
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
5 DATABASE
5.1
USING THE APPLICATION
5.1.1 Database Concepts
An Access database is a collection of data related to a particular topic / purpose, e.g. customer
data. Information in a database is organised into Fields such as customer name. A group of
related fields, such as all the information on a particular customer, is called a Record. A collection
of related records is called a Table. A database, specifically a relational database, is a collection of
one or more related tables that can share information.
•
Fields
Fields within a database have associated properties and data types.
•
Data Type
Data types are attributes that determine what kind of data a field can have. Data types are selected
from a drop-down list and include:
− Text - which includes text or a combination of text and numbers that do not require calculations.
This data type can be up to 255 characters.
− Memo – includes lengthy text or a combination of text and numbers.
− Number – this data type consists of numeric data to be used in calculations.
− Date/Time – for date and time values.
− Currency – for currency values.
− AutoNumber – this is a unique sequential number that Access assigns to each new record; it
cannot be edited.
− Yes/No – for fields that will contain only one of two values – Yes or No.
− Hyperlinks – stores hyperlink addresses.
− Lookup Wizard - creates a field that displays either a Lookup List or a Value List, which makes
data entry simpler. A Lookup list displays values looked up from an existing table or query while a
Value list displays a fixed set of values that are entered when the field is created.
•
Field Properties
For each data type, field properties can be set. These determine the format, size and other
characteristics of the data that affect its appearance and accuracy.
There are four main components to an Access database that we will become familiar with, i.e. Tables,
Forms, Queries and Reports.
•
Tables
Tables are the basic storage structures where all data is stored in columns and rows.
•
Forms
Forms are created from tables and display either the entire table or selected fields on a single page.
Thus in a form each record is viewed on a separate page.
•
Queries
Queries are used to search for specific data contained in the table and then present the selected
fields and records in a table format.
Module 5 – Page 1
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Reports
Reports are used to present data from a table or query on paper for printing.
•
Primary Key
The power of a database system comes from its ability to quickly find and bring together information
stored in separate tables. In order to do this, each table should include a field that uniquely identifies
each record stored in the table. This information is called the primary key of the table. Once you
designate a primary key for a table, to ensure uniqueness, Microsoft Access will prevent any duplicate
values from being entered in the primary key fields.
•
Index
An index can refer to the ordering and the uniqueness of values. When linking tables, indexes are
used to ensure links work correctly. Linking tables is beyond the scope of this module. They help
speed up queries – which will be discussed later in this module – but slow down data entry as indexes
need to be updated each time data is entered. Indexes are set when designing the table.
•
Relating Tables
When using Access a number of tables, such as Customers, Products, Orders, Employees, etc. are
used. A relationship between these tables must be established. Once tables are linked, queries,
reports and forms can be created to display or print information that is spread across multiple tables.
•
Relationship Rules
Unique field: It is necessary to have one field in every table that can uniquely identify each record.
This field is called the primary key. It is usually some kind of identification number, as they will not
repeat, e.g. RSI number, as no two people will have the same RSI number. Fields like name and
surname are not suitable as primary keys because people in a database may have the same name.
Fields functionally dependent: Each field in the record should relate to the subject of the record. If
not, it is redundant and belongs in another table.
Ensure each field is independent: It should be possible to alter any one field in a record without
affecting any of the others.
Ensure fields do not contain calculated or derived data: For example, only hold gross pay and
deductions on a person’s salary record as net pay can be calculated when required.
Data in its smallest logical part: Break information into their smallest parts so that specific queries
can be generated, e.g. separate County Galway into a prefix field (County) and a county field
(Galway).
5.1.2 First Steps with Databases
•
Open a Database Application
Microsoft Access can be started in several different ways depending on the set up of your personal
computer. The Start, Programs menu will contain a Microsoft Access option. There may be a
shortcut to Microsoft Access on your Desktop or the Microsoft Office Toolbar will have an Access
icon.
Access
Shortcut
MS Office
Toolbar
Module 5 – Page 2
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
When Access starts, the user is requested to:
− Create a Blank Database
− Access Database Wizards
− Open an existing Database
−
−
−
−
−
Click on the radio button beside Open an existing file and select the database file to open or
alternatively:
Click on the radio button beside Blank Access Database.
Click on OK and the File New Database window will be displayed.
Type in a suitable name for the database and save it in a suitable location. (In an ECDL test you
may be asked to save the file on a floppy disk).
Click on Create.
When creating a database, a name is assigned to it from the outset. Once the file is created, the user
can then create the tables that contain the data.
The Database window opens displaying the new empty database with the Create Table options
displayed:
Menu Bar
Database
Toolbar
Database
Window
The Database window is where all the elements of the database come together. A database may
have many tables, queries, forms, reports, macros and modules and it is the Database window that
organises these components into specific sections. By clicking on the Table tab at the top left of the
window, all the tables in the database will be displayed.
Module 5 – Page 3
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Open an Existing Database when Access is Run
When Microsoft Access is launched, you are
immediately presented with the Microsoft Access
screen with a number of options as outlined above.
− Click on the radio button Open an Existing
Database.
− Select the database to be opened from the list
available.
− Click on Open.
•
Open an Existing Database
The File, Open command can also be used to open
an existing database. Another alternative is to use
the Open file icon from the toolbar.
•
Create a New Database
When Access is started, the user is requested to:
− Create a Blank Database, Access Database Wizards or Open an Existing Database.
− Click on the radio button beside Blank Access Database.
− Click on OK and the File New Database window will be displayed.
− Type in a suitable name for the database and save it in a suitable location. (In an ECDL test you
may be asked to save the file on a floppy disk).
− Click on Create.
When creating a database, a name is assigned to it from the outset. Once the file is created, the user
can then create the tables that contain the data.
•
Save a Database onto a Hard Disk or
Diskette
−
With the active database on the screen, click on the
File menu and the Export option.
Select the database into which to export the table
and click on Save All.
In the Save In text box, click on the drop-down
arrow and select the required drive and folder. This
can be 3½ Floppy (A) if it is required to save the
database to a floppy disk.
Click on Save All.
−
−
Module 5 – Page 4
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Close the Database
−
−
−
When the database is active on the screen, click on the File menu.
Click on the Close option to close the specific database file.
Click on the Exit option to exit out of Microsoft Access.
•
Use Help Functions
Access has a very comprehensive Help facility. The Help menu or the
Office Assistant can be used to obtain help.
−
Click on the Help menu and the Office Assistant will be displayed.
Type in a question and press Search.
Click Microsoft Access Help on the Help menu. If the
Assistant is turned on, it appears. If the Assistant is turned
off, the Help window appears. To scroll through a table of
contents for Help, click the Contents tab. This is very
comprehensive and covers most topics in Access. Doubleclick on the book icon beside the option to display further
details. When an icon with a question mark is shown, click
on it for details on that topic. In the example to the right,
the topic Working with Data has several sub-topics. The
sub-topics with the book icon have further sub-topics. The
topics with the question mark icon have details on that
topic.
To type a question in the Help window, click the Answer
Wizard tab. The Index tab allows you to type in a word
or string of words. A list of related topics are displayed.
Double-click on the required topic.
To see a ScreenTip for a menu command, toolbar button,
or screen region, click What's This? on the Help menu
and then click the item you want information about.
5.1.3 Adjust Basic Settings
•
Change Viewing Modes
When in the Database window, tables, queries, forms, reports, etc., can be viewed by clicking on the
appropriate icon to the right of the Database window. Clicking View, Database Objects can also
activate these views, and the corresponding view
from here selected.
Module 5 – Page 5
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Tables, queries, etc., within the database can be viewed as Large icons,
Small icons, List or Details. The standard view is List as evident from the
menu on the right.
Clicking the required button on the toolbar can access these options also.
•
Display / Hide Toolbars
Clicking on the View menu Toolbars option to list the toolbars that are available in Access. There
are only two, the Database and Web toolbars. Clicking on a toolbar will display or hide it. Selecting
the Customise option displays all available command buttons. These buttons can be dragged onto
the toolbar and be available for future use. Click on Close in the Customise screen when complete.
5.2
TABLES
5.2.1 Main Operations
•
Design and Plan a Database
Before information is entered into a database, the goal and purpose of the database should first be
identified and a plan of how data is stored in it decided. The planning stage involves deciding how
many tables the database will involve and what data will be stored in each table. Although the table
can be modified at any stage, up-front planning makes the process easier. In planning a database,
the following guidelines should be considered:
− Determine the purpose of the database and give it a meaningful name.
− Determine the results or outputs from the information stored in a database.
− Collect all the information that will be used to produce the results.
− Sketch the structure of the table including each field’s data type.
•
Create a Table
−
−
Select the Table tab in the Database window.
Double-click on the Create Table in Design View option or alternatively click on the
New button and select the option Design View.
Module 5 – Page 6
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
The Table Design Grid appears where field names, data types, descriptions and field properties are
entered.
•
Field Name
A field name can contain up to 64 characters and include letters, numbers, spaces and some special
characters.
•
Data Type
Data types are attributes that determine what kind of data a field can have. Data
types are selected from a drop-down list and include:
− Text - which includes text or a combination of text and numbers that do not
require calculations. This data type can be up to 255 characters.
− Memo – includes lengthy text or a combination of text and numbers.
− Number – this data type consists of numeric data to be used in calculations.
− Date/Time – for date and time values.
− Currency – for currency values.
− AutoNumber – this is a unique sequential number that Access assigns to each
new record; it cannot be edited.
− Yes/No – for fields that will contain only one of two values – Yes or No.
− Hyperlinks – stores hyperlink addresses.
− Lookup Wizard - creates a field that displays either a Lookup List or a Value List, which makes
data entry simpler. A Lookup List displays values looked up from an existing table or query while
a Value List displays a fixed set of values that are entered when the field is created.
•
Description
An optional description can be entered for each field. The description, if added, appears in the status
bar when a field is selected for data entry or editing.
•
Field Properties
For each data type, field properties can be set. These determine the format, size and other
characteristics of the data that affect its appearance and accuracy.
−
−
−
−
When the table design is complete, click on the File, Save option or the Save icon on
the toolbar. The Save dialog box is displayed.
Give the table an appropriate name and click on OK.
Access will then prompt the user to set a primary key.
Click on No.
Click on the File menu.
Choose the option Close.
Module 5 – Page 7
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Exercise 5.1
1. Create a database called Employees.
2. Insert the following field names and attributes in the table:
Name
Text
Address
Text
Date of Birth
Date
Salary
Currency
3. Save the table calling it Personnel Details.
4. Do not set a primary key.
5. Close the database.
•
Enter Data into a Table
−
−
−
−
−
Click on the table and click on Open to enter data into the table.
Click on the New Record button or click into the first field in the first record and type in data.
Press the Tab or Enter key to advance to the next field.
Continue to enter data in all fields for each record.
Click on Save when complete.
•
Exercise 5.2
1. Open the database called Employees.
2. Enter the following records into the table called Personnel Details.
Name
Address
Date of Birth
Salary
John Martin
Mary Smith
Avoca Avenue
Bray Heights
12/08/68
05/01/72
€25000
€22500
Ann Kavanagh
Mansion Estate
08/09/77
€20000
3. Save the table and close it.
•
Modify Data
−
−
Open the table that contains the records to be edited.
The table is displayed in the Datasheet view. Click on the record to be edited, click into the
required field and type in the new details.
First
Previous
Next
Last
New
Module 5 – Page 8
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
−
−
Press the Tab or Enter key to advance to the next field.
Continue to edit data in all fields for each record.
Click on the Save button on the toolbar to save changes.
•
Delete Data in a Table
−
−
Click into the field to be edited.
Press Delete key or Backspace key.
If data was incorrectly deleted, it can be undone by clicking on the Undo button on the
toolbar.
•
Add Records to the Database
−
−
With the table open, click on the New Record button at the bottom of the table or on
the toolbar or click on Insert, New Record.
Enter new record details.
•
Delete Records in a Database
−
−
−
−
Click on the Record Selector next to the record that is to be deleted.
Click on the Edit menu.
Click on the option Delete Record or Delete icon on the toolbar. Access will confirm
to the user that a record is being deleted and needs confirmation as to whether to
continue.
Once a record is deleted it is not possible to recover it again.
•
Navigate throughout a Table
At the bottom of the table in Datasheet view, there are a number of buttons used for navigating
through a table.
Edit Record
New Record
Go to First Record
Go to Previous Record
Go to Next Record
Go to Last Record
Module 5 – Page 9
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Delete a Table
−
In the Database window, click on the table to be deleted and press the Delete key or
the Delete icon on the toolbar.
A message is displayed confirming the deletion and click on OK if you wish to
proceed with the deletion.
−
•
Close a Table
Click on the Table icon and click on the Close command or alternatively
click on the Close Window button on the top right of the window.
If changes were made to the layout of the table, you will be prompted to save the
table.
5.2.2 Define Keys
•
Define a Primary Key
The power of a database system comes from its ability to quickly find and bring together information
stored in separate tables. In order to do this, each table should include a field that uniquely identifies
each record stored in the table. This information is called the primary key of the table. Once you
designate a primary key for a table, to ensure uniqueness, Microsoft Access will prevent any duplicate
values from being entered in the primary key fields.
•
Assign a Field a Primary Key
−
−
In the Design view, select the required field.
Click on the Primary Key icon on the toolbar.
•
Set up an Index
An index in this context refers to the ordering and the uniqueness of values. When linking tables,
indexes are used to ensure links work correctly. Linking tables is beyond the scope of this module.
They help speed up queries – which will be discussed later in this module – but slow down data entry
as indexes need to be updated each time data is entered. Indexes are set when designing the table.
−
Open the table in Design view by
clicking on the Table name and
Design in the Database window or
if the table is displayed, click on the
View, Design View command or
click on the Design icon on the
toolbar.
− Click on the field that is to be
indexed and in the Field Properties
section, click on the drop-down
arrow beside Indexed (on the
General tab).
A field can be indexed with:
Module 5 – Page 10
Unauthorised Photocopying is Unlawful
OlasIT © 2003
−
−
−
ECDL/ICDL Module 5 Database/Filing Systems
Duplicates allowed – used in the case of a person’s name, where there may be more than one
occurrence of the same name. Select Yes (Duplicates OK).
Duplicates not allowed – used in the case of a personal ID or PRSI number where more than
one occurrence is not allowed. Select Yes (No Duplicates).
Close out of the table’s Design view and Save it when prompted.
5.2.3 Table Design / Layout
•
Field Format Attributes
−
−
Open the table in Design view by selecting the table and clicking the Design icon.
Click on the field to be modified and edit its attributes by either changing its data type
or its field properties.
•
Modify Field Size
−
Click in the Field Size section of the dialog box and type in the required size, i.e. the number of
characters that the user will enter into this field.
•
Modify Number Format
−
−
Click on a field that has its data type set to Number.
Click in the Format section of its field properties and
from the drop-down arrow to the right of the Format
option, select the desired format option.
•
Modify Date Format
−
In Design view, click on a field whose data type is set to Date/Time and click on the drop-down
arrow to the right of the Format option and selected the desired format.
Module 5 – Page 11
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Click to select
Click and drag
to new location
•
Consequence of Changing Field Size Attributes
−
If the field size is too small, the field
will not accept the data as you type it
in the table.
•
Validation Rule
−
−
In the table’s Design view, select a field to apply a validation to it, e.g. the Date/Time field.
In the Field Properties section, click on the Validation Rule text box and enter criteria such as
>=01/01/2000 which requires that dates prior to the 01/01/2000 will not be accepted by this field.
Alternatively, click on the Expression Builder icon for help with
creating validation rules.
Use the logical operators and type in the date as displayed below.
Click on OK when complete.
•
Move a Column within a Table
−
−
Click on the Title of the field to be moved.
Click on it a second time and drag it to the new location.
•
Change Column Widths
When a table is created, Access begins by making all the columns the same width. This may result in
some of the data being hidden.
− Click on the dividing line between a title and the one to its right. The shape of the cursor changes
to a double-sided arrow.
− Drag the cursor left or right until the column is the right size.
Before changing
column widths
After changing
column widths
Module 5 – Page 12
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Sort a Table
−
−
−
Select the table to sort and click on Open.
Click into the field that is to be sorted.
Click on the Sort Ascending or Sort Descending icon on the toolbar.
•
Exercise 5.3
1. Open the database Employees.
2. Open the table Personnel Details.
3. Add the following records:
Name
Address
Date of Birth
Salary
Joe Slevin
Main Street
23/07/65
€21500
Grainne Brophy
Whitethorn Grove
05/05/75
€24250
Maire Moran
Riverview
09/11/73
€23400
4.
5.
6.
7.
Change the column widths so that all field details can be viewed.
Sort the table in ascending order on the Name field.
Move the Date of Birth column after Salary column.
Joe Slevin has moved from Main Street to Blackhorse Ave - modify this record to recall the
change.
8. Ann Kavanagh is no longer with the company – delete this record.
9. Marie Moran’s salary has been increased by €1000 - edit this record.
10. Save the table and exit Access.
Module 5 – Page 13
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
5.2.4 Table Relationships
•
One-To-One Relationship
−
Click on the Tools menu and select Relationships….or click on the Relationship icon
on the toolbar.
If the Show Table dialog box is not displayed, click on the Show Table icon on the
Relationship toolbar.
Select the table to add from the list of tables displayed. Use the CTRL key to add more
than one table or the Shift key to select a block of tables.
Click on Add and Close.
−
−
−
The Relationship window resembles the screen below:
−
−
To create the relationship link from a field in one table to a field in another table, simply drag the
field from the first table and drop it on top of the field in the second table.
The Edit Relationships dialog box will be displayed showing the link between the two different
tables, in this case the Employee Number field.
Module 5 – Page 14
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
Click on Create and a line appears in the Relationship window representing the link between the
two tables.
•
One-To-Many Relationships
−
−
−
Click on the Relationship icon, the Show Table icon and select the tables.
Click on Add and Close.
In the example illustrated below, we wish to create a relationship between the Department Code
field in the Department Codes and Human Resource tables. The Department Code field in the
Department Codes table is unique but in the Human Resource table, a repetitive Department
Code can be entered, as some employees will be in same departments. Therefore there is a
need to create a One-To-Many Relationship
−
Drag the field Department Code from the Department Code table to the Department Code field in
the Human Resources table.
Join type will display as One-To-Many and click the option to Enforce Referential Integrity to
ensure that changes made in Department Code table are replicated in the Human Resources
table.
−
Module 5 – Page 15
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
Click Create to display the relationship.
•
Delete a Relationship
−
−
−
In the Relationship window, click on the Relationship line that you wish to delete.
Press the Delete key.
In the dialog box displayed, click on Yes to permanently delete the relationship.
•
Relationship Rules
When you create a relationship or double-click on an existing relationship in the Relationship window,
the Edit Relationship dialog box is displayed.
Relationship rules can be applied by clicking on Enforce Referential Integrity check box. This
ensures that relationships between records in related tables are valid. It means that the user will not
be able to accidentally modify related data.
Cascade Update Related Fields means that if you change the primary key in the record of a primary
table, Access will update the corresponding fields in related records with the new value.
Cascade Delete Related Records means that if a primary record is deleted, the corresponding
records in related tables will be deleted.
5.3
FORMS
5.3.1 Working with Forms
•
Open a Form
−
Click on the Forms icon on the left of the Database window and select the form you
wish to open.
Click on the Open icon from the toolbar.
−
Module 5 – Page 16
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Create a Form
−
−
−
In the Database window, click on the Forms tab and double-click on
Create Form by using Wizard.
Alternatively, click on New and the New Forms dialog box is displayed.
Select the option Form Wizard.
−
−
Select the table on which the form will be based.
Click on OK and the dialog box below is displayed which lists all the fields in the selected table.
Module 5 – Page 17
Unauthorised Photocopying is Unlawful
OlasIT © 2003
−
−
−
−
−
−
−
−
−
ECDL/ICDL Module 5 Database/Filing Systems
Add a single field
Add all fields
Remove a single field
Remove all fields
Select the field required in the form from the
available fields list and click the Add Single Field
button.
Continue to select and add until all required fields
are selected.
Click on Next to display the Layout dialog box.
Select the required layout from the four available
options:
Columnar, Tabular, Datasheet and Justified.
Click on Next and the Form Style dialog box is
displayed.
Select the required style from the list of available
options. As you click on each style, a preview is
displayed on the left-hand side.
Click on Next.
The final dialog box suggests the table name as a
title for the form but this can be changed if
required.
Click Finish and the form opens displaying the
fields and data for the first record in the table.
Module 5 – Page 18
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Create a Form using the AutoForm Facility
Forms can also be created using the AutoForm facility. This option creates a form either in a
Columnar, Tabular or Datasheet layout depending on the AutoForm option selected. The user is not
required to make any decisions, except to select the table or query on which the AutoForm is to be
based.
•
Enter Data into Database using a Form
−
−
−
−
Click on the New Record button on the Form View toolbar to display a new blank record.
Enter information into the first field.
Press the Tab key to advance to the next field and enter information into it.
Continue to enter data for the record, pressing Tab to move from field to field.
•
Modify Data in a Database using a Form
Use the Record Navigation keys to display the record that you wish to alter. Modify as required.
•
Delete Records using a Form
−
−
−
Display the form for the record that you wish to delete.
Click on the Delete Record icon.
Click Yes if you wish to permanently delete the record.
•
Form Navigation
The Form Navigation bar is located at the bottom of the form:
Go to First Record
Go to Previous Record
Go to Next Record
Module 5 – Page 19
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Go to Last Record
Enter new Record
•
Exercise 5.4
1. Open the Employees database.
2. Generate a simple form from the Personnel Details table and call it Details.
3. Enter the following records into the table using the form:
Name
Address
Date of Birth
Salary
Mary Mannion
Broadstone
26/10/77
€18000
Stephen Ryan
Rosbeg Woods
12/08/80
€18250
4. Close the form.
5. Open the table to see the extra records.
5.3.2 Modify Form Layout
A form can be modified easily by changing the location of the fields, adding or deleting fields, adding
graphics, changing the colour of the background, text and field data, etc.
A form is modified in Design view. Form design is divided into three sections:
− Form Header appears at the beginning of each screen form and can contain a title or logo.
− Detail section displays the fields for each record.
− Form Footer appears at the bottom of each screen and
can contain totals, instructions or command buttons.
Each element on a form is called a Control.
A control consists of the field label and the
data it contains which is the field value
text box. The appearance and properties
associated with a control can be changed.
Field Label
Form Design View
− While in the Database window, select the Form tab.
− Select the required form and click on the Design icon
and the Form Design screen is displayed.
− The form’s background changes to a grid, which helps
keep fields aligned horizontally and vertically
− An extra toolbar, called Toolbox, which contains extra buttons that may be used to
modify the design, may also be displayed. If not click on the Toolbox
icon on the toolbar to display it.
Module 5 – Page 20
Value text
box
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Format Text
Both the field label and value text box are formatted to display in
font style MS Sans Serif, font size 8. This can be formatted to any
other style or size by selecting options from the Font Style and
Font Size icons on the toolbar. Text can also be emboldened or
italicised using the corresponding icons on the toolbar. Different
colours can also be applied to text by selecting the label and then
selecting the colour from the Text Colour icon on the toolbar.
To Change the Font Style and Font Size of a Field Label
− Select the field label and click on the drop-down arrow beside the Font Style box to select
another style.
− Click on the drop-down arrow beside the Size box and select a larger size.
To Change the Font Style and Font Size of all Field Labels and Value Text boxes
− Select the field label, hold the Shift key down and select all other field label and value text boxes.
− Click on the drop-down arrow beside the Font Style box to select another style.
− Click on the drop-down arrow beside the Size box and select a larger size.
To Change the Font Colour and Embolden a Label
− Select the label.
− Select a colour from the drop-down arrow on the Font Colour icon.
− Click on the Bold icon.
•
Change Background Colours in a Form Layout
−
−
Click on the Title bar labelled Detail.
Select a colour from the drop-down list on the Fill/Back
Colour icon.
•
Import an Image or Graphic into a Form
−
−
Click on the form and then click on the Insert menu and select Picture.
Locate the image or graphic from its required location, click on it and then click on OK to insert
into the form (use the View button to display a preview of the image).
−
The image may have to be resized or moved within the form. This is achieved by selecting the
image and when the mouse shape appears as a flat-hand, move the image to the required
location. Position the mouse on the corner of the image and when the mouse is a double-sided
arrow, drag to re-size
The image properties must be amended so that the picture can be seen in the form.
Select the picture and click on the Properties icon on the toolbar.
On the Format tab, click in the Picture Size Mode box and select the option Zoom, which
adjusts the size of the image to the required size. Close the Properties screen.
−
−
Module 5 – Page 21
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Image when resized and
before size mode is set.
Image after size mode is
set to Zoom.
•
Add a Header to a Form
−
−
−
Position the mouse between the Header and Detail bars in
the form.
When the mouse changes shape, drag it down to increase
the Header area.
Click on the Label button on the Toolbox toolbar.
Click into the Header area and hold down the mouse and drag to draw a text box.
−
−
Click into the box and type an appropriate header for the form.
Format the header as you format text (see above).
−
Design View
−
Click on the View menu and Form View to display the form or alternatively click on
the View button.
Form View
Module 5 – Page 22
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Add a Footer to a Form
−
−
A footer is added to a form in the same way as a header is added to a form.
In Form Design view, drag the mouse below the footer area to display the footer.
−
−
−
−
Click on the Label icon on the Toolbox toolbar.
Click into the Footer area and hold down the mouse and drag to draw a text box.
Click into the box and type an appropriate footer for the form.
Format the footer as you formatted text (see above).
•
Change Arrangement of Objects within a Form
−
−
−
Select the field by clicking the control for that field.
Black squares called handles appear around the perimeter of the selected control.
If the field label control is selected then only the label is selected, but if the field value text box is
clicked then the field label is also selected.
When the pointer changes shape, drag the control to its new location.
Continue to select and drag each of the controls as required.
−
−
Handles
•
Delete a Form
−
From the Database window, select the form to delete and click on the Delete icon
on the toolbar.
−
Click Yes to permanently delete the form.
•
Save and Close a Form
−
−
From the File menu, click on Save option.
From File menu, click on Close.
•
Exercise 5.5
1.
2.
3.
4.
5.
6.
7.
Open the form called Details in Design view.
Position the Salary field to the right of the Date of Birth field.
Put in a header formatted in Arial, 12pt, Red and Bold.
Change the colour of all the Value text boxes to blue and font size 10.
Change the background colour in the Header area to Blue and in the Detail area to Red.
View the form.
Save and close the form.
Module 5 – Page 23
Unauthorised Photocopying is Unlawful
OlasIT © 2003
5.4
ECDL/ICDL Module 5 Database/Filing Systems
RETRIEVING INFORMATION
5.4.1 Main Operations
•
Find a Record
−
−
Open a table within the database.
Click on the Edit menu and select the option Find. Alternatively, click on the
Find icon on the toolbar.
Enter the data in the Find What text box.
Click the drop-down arrow in the Look In box
and ensure that the whole table is accessed
for the data.
All records can be searched for a whole field,
part of a field or the start of a field.
Wildcards can be used when searching for
data. Wildcards are symbols used as
substitutes for characters in text:
* represents any group of characters.
? stands for any single character.
# stands for a single digit.
For example, to find any name beginning with S, type “s*” in the Find What text box.
−
−
−
−
•
Apply a Filter
Filters are simple queries but they only apply to open tables or forms. They are best used for
temporarily altering the view of the data in a table such as filtering out records not required, viewing
records that meet complex criteria, sorting records on content of several fields, etc.
Filter by Selection in a Table
− Open a database table.
− Click into the cell containing the item that you wish to filter on.
− Click on the Filter by Selection icon on the toolbar to display the filtered data as below. Data is
filtered on the County field as Dublin.
•
Remove a Filter
−
Click on the Remove Filter icon on the toolbar.
•
Filter by Form
−
−
In the Database Table view, click into the field that you want to filter out data.
Click on the Filter by Form icon.
Module 5 – Page 24
Unauthorised Photocopying is Unlawful
OlasIT © 2003
−
−
ECDL/ICDL Module 5 Database/Filing Systems
The table is redisplayed with a drop-down arrow beside the field that is to be filtered and the
status bar contains two tabs – a Look for tab and an Or tab.
Select the required county from the drop-down field. If more that one option is required, click on
the Or tab (a second Or tab will appear) and reselect another county on which to filter data.
−
Click on the Apply Filter icon to display all related records.
•
Remove Filter by Form
−
Click on the Remove Filter icon on the toolbar.
5.4.2 Queries
•
Create a Simple Query
A query is used to search through a database to locate a particular record or records that conforms to
specified criteria. These are collected into a special kind of table called a Dynaset. Queries are
developed by using the Query Wizard or by directly specifying requested fields and query criteria in
the Query Design view. The resulting query datasheet is not a duplication of the data that resides in
the original table’s datasheet but rather a logical view of the data. If changes are made in the query
datasheet, the data in the underlying table is updated automatically.
−
−
In the Database window, click on the Query tab.
Double-click on Create Query in Design View or alternatively click on New and the New Query
dialog box is displayed.
Module 5 – Page 25
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
Select the option Design View.
−
−
Click on OK.
The Show Table dialog box is displayed showing the
tables available on which a query can be performed.
Select the required table from the list.
Click on Add.
Click on Close to close this Show Table window.
The Select Query window displays the field names
belonging to the selected table in the upper part of
the window and the lower half, called the query grid,
is used to specify the fields to display and for what
records they are to be displayed.
Point and drag each field name required from the
table list into a separate column in the query grid.
Click in the Criteria box under the field name and type in the data on which the query is to base
its selection.
−
−
−
−
−
−
Table
Field Names
Query Grid
−
−
Click on the View menu and select Datasheet to perform the
query or select it from the toolbar. Alternatively, click on the Run
icon from the toolbar.
A Dynaset consisting of all qualifying records is displayed.
•
Save a Query
−
−
Click on the File menu.
Click the option Save and give the query an
appropriate name.
Click on OK.
Click on File menu.
Click on Close.
−
−
−
Module 5 – Page 26
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Run a Query
−
−
From the Query Design view, click on the Run icon on the toolbar.
From the Database window, click on Queries and the required query from the previously created
queries and click Open.
•
Delete a Query
−
−
From the Database window, click on Queries and the required query from the previously
created queries and click the Delete icon.
Click on Yes to permanently delete the query.
•
Create a Query with Multiple Criteria
The criteria specified for a query can be as simple as a list of customer names or as complex as a list
of all customers over the age of 40, who live in Dublin and Galway. By using expressions,
combinations of field names and arithmetic operators, the numbers of records returned by a query
can be restricted. The arithmetic operators used in criteria when creating queries include: greater
than; < less than; = equals; >= greater than or equal to; <=less than or equal to; <> not equal to.
Click into the criteria row under the required field and enter the value required to apply criteria, e.g.
to find all customers who are Dublin based would entail entering the text Dublin under the field city on
the criteria row in the query grid.
Click on the Run icon to display all Dublin based customers. On returning to Query Design
view, notice the quotation marks that Access inserts around the text “Dublin”. This query can
be further expanded to display all Dublin based customers who contacted the office during the
year 2000.
Display the Query Design view and under the Date field in the criteria row, enter Between 1/1/2000
and 1/1/2001.
Click the Run icon and Access will display in Datasheet format all customers living in Dublin that
contacted the office between the 1st January 2000 and 1st January 2001. On returning to the Query
Design view, notice the hash symbol (#) Access inserts around each date.
Module 5 – Page 27
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
The wildcard * can also be used to find variations of text entered. If D* is entered into the criteria row
under the City field, all records will be displayed for customers living in a city that begins with the letter
D, e.g. Derry, Dublin, Dundalk, etc.
Between 1/1/2000 and 1/1/2001 will select specific records falling within this range of dates.
Alternatively the operators >=1/1/2000 and <1/1/2001 would give the same result.
In (Dublin, Galway) will select only those records that meet this criteria.
To query numerical fields, use the operators >,>=,<,<= in the criteria row under the required field.
•
Using AND and OR to Affect Query Results
The AND criteria requires that both criteria be true for a record to be selected. The OR criteria only
requires one of the other criteria to be true in order for the record to be selected. A combination of the
above can be used in a query grid by typing directly into the criteria line in the grid.
Records can be queried based on more than one criterion. In the above example, all Dublin or
Galway based customers who contacted the office after the 1/1/2001 will be displayed on running the
query.
•
Find Duplicates Query
A Find Duplicates query determines if there are duplicate records in a table or which
records in a table share the same value.
− In the Database window, click on Queries and click on New.
− Click on the Find Duplicates Query Wizard from the New Query
dialog box.
− Click on OK.
− Select the table on which to base the query from the available list.
− Click on Next.
Module 5 – Page 28
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
−
Select the fields that might have duplicates and click on Next.
Select the fields to view if duplications are located and click on Next.
−
−
Give the query an appropriate name.
Click on Finish and the results of the Find Duplicate Query are displayed.
•
Exercise 5.6
1. Open the database Employees.
2. Create a query on the Personnel Details table listing all those whose salary is greater than
€22000.
3. Run the query and save the result as Salary greater than €22000.
•
Add Fields to a Query
In the Query Design view, click on the field name
and drag onto the query grid to add that field to a
query. Alternatively, double-click on the field name
and it will automatically be inserted onto the grid. If
the table is not displayed, click on the Show Table
icon on the toolbar.
•
Remove Fields from a Query
Position the mouse over the field to be removed from the query grid. When the mouse changes
shape to a black arrow pointing down, click on the Delete key or alternatively remove the tick from the
show box as displayed below.
Module 5 – Page 29
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Hide Fields in a Query
In Query Design view displaying the query grid, remove the tick in the checkbox beneath the field to
hide. The screen below shows the field Employee Number, which will not now be displayed when you
run the query.
5.4.3 Sort Records
•
Sort Data based on a Query
In the query design grid, click into the Show box to display records in the Dynaset matching the
specified criteria. Removing the tick mark in the Show box will not display that field in the Dynaset but
will apply the criteria.
To sort data in ascending or descending order in a query, click on the drop-down arrow in the Sort
row of the field to be sorted and select either the Ascending or Descending option.
Sort Order
Show removed
•
Sort Data based on Common Logical Operators
In the query design grid on the sort row of the field that has a criteria set, select the sort option
required.
If you do not wish to show the records on which the query is based, remove the tick from the Show
box.
If you do not want to display
records, remove the tick from
Show box.
Module 5 – Page 30
Displays records where the city
is Galway or the date is after
the 12/5/2000. Records are
sorted LastName in Ascending
sequence while the City field is
not displayed in the result.
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
Sort a Table
−
Select the table to sort and
click on Open.
Click into the field that is to be
sorted.
Click on the Sort Ascending
or Sort Descending icon on
the toolbar.
−
−
ECDL/ICDL Module 5 Database/Filing Systems
•
Sort a Form
−
−
−
Open the form.
Click into the field that is to be sorted.
Click on the Sort Ascending or Sort Descending icon on the toolbar.
•
Exercise 5.7
1. Create a query displaying all those born between 1972 and 1975. Do not show the address field
in this query.
2. Sort the query according to Salary in descending order.
3. Save the query as 1972 to 1975.
Module 5 – Page 31
Unauthorised Photocopying is Unlawful
OlasIT © 2003
5.5
ECDL/ICDL Module 5 Database/Filing Systems
REPORTS
5.5.1 Working with Reports
•
Create a Report
−
−
−
In the Database window, click on Reports.
Double-click on Create report by using Wizard or alternatively, click on New.
Click on the Report Wizard option.
−
−
−
Choose the table or query where the report data will come from by clicking the drop-down list
arrow and selecting required table/query.
Click on OK.
Select the fields required in the report from those available by clicking the field name and
the Add Single Field button or the Add All Fields button to include all available fields in
the report.
−
−
Click Next and the Grouping dialog box is displayed.
Click Next for a simple ungrouped report or select the field on which the report is to be grouped.
Module 5 – Page 32
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
The report can be sorted in a specific order by selecting the required field name from the dropdown list of field names.
−
Click Next to select the required layout and page orientation from this dialog box.
−
Click Next to select a suitable report style from the available options.
Module 5 – Page 33
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
−
Click Next and give the report a suitable name.
−
Click Finish. Access compiles the report and displays it in the Print Preview window.
Module 5 – Page 34
Unauthorised Photocopying is Unlawful
OlasIT © 2003
•
ECDL/ICDL Module 5 Database/Filing Systems
Modify a Report
Modifications to the formatting of a report such as bolding column headings or changing the alignment
of fields in a column can be made in the Report Design window. The Report Design window is
divided into designated areas called sections in which controls and formatting specifications are
placed.
Report Header - appears only at the top of the first page of the report and usually contains the report
name or company logo.
Page Header - appears at the top of every page (but below the report header on the first page) and
usually contains the field labels.
Group Header - appears at the top of each group of records (‘Group’ is replaced by the field name).
Detail - appears once for every record in the underlying datasheet and usually contains bound field
text boxes.
Group Footer - appears at the end of each group of records and usually contains summary
information on the group of records such as total values, etc.
Page Footer - appears at the end of each page and usually contains the current date and page
number.
Report Footer - appears at the end of the last page of the report.
A Toolbox toolbar is also displayed in the Design View window.
This contains tools that will be used in modifying a report.
•
Align Fields and Format Text in Header and Detail Sections
−
−
−
−
−
Press and hold down the Shift key and click on each of
the control headings in the Page Header section of the
Report Design window.
Click Centre button on the Formatting toolbar.
Click the Font Size drop-down arrow to increase the font size from the default size 8.
Hold the Shift key down while clicking on each of the controls in the Detail section.
Release the Shift key and click the Centre button.
•
Delete a Control
−
−
Click on the control to select it.
Press Delete and the control is deleted.
•
Create and Customise Headers and Footers
−
−
In the Report Design view, click the Label tool on the Toolbox toolbar.
Click in the Report Header section and type in an appropriate header for the report.
Module 5 – Page 35
Unauthorised Photocopying is Unlawful
OlasIT © 2003
−
ECDL/ICDL Module 5 Database/Filing Systems
Select the control and apply suitable formatting to the text such as increase font size, bold and
font colour.
Design View
−
Click on the View menu and select Print Preview or alternatively click on the Preview
icon.
Print Preview
−
−
Click the Label tool into the Report Footer section and type a descriptive
footer.
Select the control and apply suitable formatting as for the header.
−
Click on the Print Preview icon to preview.
•
Group Data in Reports using the Wizard
When generating a report initially using the Report Wizard, a dialog box enquires if a grouped report
is required. If fields are to be grouped within a report, select the fields from this dialog box. Click on
the Summary Options button.
Module 5 – Page 36
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Select the required function and if a Detail and Summary report is required. This will display subtotals at the end of each grouped field. Click OK and follow the wizard options as for a Simple
Report.
•
Group Data in a Report
−
−
In Design view, select the Sorting and Grouping command from the View menu.
Click within the Field / Expression column and select the field to apply grouping to.
−
−
−
By default the field will be sorted into ascending order. To change this, click within the Sort
Order column and choose Descending from the menu.
Click on the Close icon in the top right of the dialog box to apply the grouping and sorting options.
Switch back to Print Preview to see results.
•
Delete a Report
−
From the Database window, select the report to delete and click on the Delete icon
from the toolbar.
Click Yes to permanently delete the report.
−
Module 5 – Page 37
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Exercise 5.8
1.
2.
3.
4.
Generate a report based on the Personnel Details table in the Employees database.
Sort the report in ascending order on the name field.
Preview the report.
Save the report as Employee Details.
•
Exercise 5.9
1. Generate a grouped report, grouped on the Salary field. Do not show the address field in this
report.
2. Preview the report and save it as Salary.
3. Modify this report and insert a header - Employees Salaries.
4. Format the header using the font style Arial, Size 16 and colour Blue.
5. Preview the report and save it.
5.6
PREPARE OUTPUTS
5.6.1 Prepare to Print
•
Preview
−
−
Select the object to preview, e.g. table, form, query or report.
Click on the File menu and Print Preview.
•
Change Report Orientation
−
−
−
Select the report.
Click on the File menu and Page Setup.
From the Page tab, select the required Orientation.
•
Change Paper Size
−
−
−
Select the report.
Click on the File menu and Page Setup.
From the Page tab, select the required paper size in the Paper section.
Module 5 – Page 38
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
•
Print Table Options
−
−
Open the table and select the required records.
From the File menu, select the Print option and in the Print Range section, specify to print All or
the number of pages to print or the selected records.
•
Print from Form
−
−
Open the required form.
From the File menu, select the Print option and in the Print Range section, specify to print All or
the number of pages to print or the selected record.
•
Print Result of a Query
−
−
−
Display the query that you want to print from.
Click on the Print icon to print the entire query result. If only part of the query is required then
select the File menu and the Print command.
Within the displayed dialog box, select what you want to print.
•
Print a Report
−
−
Open the required report.
From the File menu, select the Print option and within the Print Range section, specify to print
All or the number of pages to print or the selected record.
Module 5 – Page 39
Unauthorised Photocopying is Unlawful
OlasIT © 2003
5.7
ECDL/ICDL Module 5 Database/Filing Systems
EXTRA EXERCISES
Exercise 1 – Covering topics 5.1 to 5.4.3
1. Open the database application and create a database called Friends
2. Insert the following field names and data types in the table:
Name
Address
Birthday
No of Children
3.
4.
5.
6.
7.
8.
Text
Text
Date
Number
Save the table as Personal Details.
Do not set a primary key.
Close the database.
Exit the application.
Open the Access application and open the database called Friends.
Open the table Personal Details and enter the following records:
Name
Michael Mangan
Sharon Smyth
Jean Cooke
Sean Mullins
Address
16 The Pines
24 Beech Lawn
8 Willow Green
31 Oak Lawn
Birthday
12/07/1969
05/10/1972
18/02/1959
30/04/1962
No of Children
3
1
4
2
9. Sort the table on the Name field.
10. Close the table and exit the application.
Module 5 – Page 40
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Exercise 2 – Covering topics from 5.1 to 5.4.3
1. Open the database application and create a database called Hotels.
2. Insert the following field names and data types in the table:
Name
Location
Cost per Night
No of Rooms
Text
Text
Currency
Number
3. Save the table as General Details.
4. Enter the following records into the table:
Name
Grosvenor
Royal Park
Mammoth
Salas
5.
6.
7.
8.
9.
10.
Location
Cork
Dublin
Galway
Dublin
Cost per Night
€45
€86
€50
€75
No of Rooms
120
80
95
100
Sort the table on Location.
Add another field to the table called Manager and set the required data type.
Add a manager’s name into the new field on the table for each hotel.
Change the order of fields in the table so that the Manager field appears after the Name field.
Adjust the column widths so that field details can be viewed.
Exit the application.
Exercise 3 – Covering topics from 5.1 to 5.4.3
1. Open the database created in Exercise 2 called Hotels.
2. Open the table created in Exercise 2 called General Details.
3. The Mammoth Hotel has changed ownership and is now called Fawlty Towers and charges €65 a
night. Modify this record to reflect these changes.
4. The Grosvenor Hotel has closed for renovations so delete this record.
5. The Salas Hotel has 110 rooms not 100 – modify this record.
6. Add the following hotel to the table:
Name
Starlight
Location
Cork
Cost per Night
€50
No of Rooms
70
7. Sort the table on Hotel Name.
8. Exit the application.
Module 5 – Page 41
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Exercise 4 – Covering topics from 5.1 to 5.4.3
1. Open the database application.
2. Create a new database called Videos.
3. Create a table called Stock with the following fields and data types:
Name
Classification
Issue Date
Cost
Text
Text
Date
Currency
4. Enter the following records into the table:
Name
Angela’s Ashes
Notting Hill
The Full Monty
Scream
5.
6.
7.
8.
9.
Classification
Historic
Drama
Comedy
Horror
Issue Date
15/01/2000
12/11/1999
01/03/1998
06/06/1997
Cost
€25
€20
€12
€9
Sort the table according to Classification.
Using the Find icon, locate the record for the film Notting Hill.
Edit the classification of this film to Comedy.
Create a simple form from the Stock table and called it Stock Details.
Enter the following record using the form:
Name
Trainspotting
Classification
Comedy
Issue Date
10/05/1998
Cost
€15.50
10. Close the application.
Exercise 5 – Covering topics from 5.1 to 5.4.3
1.
2.
3.
4.
5.
6.
7.
8.
Open the database called Videos created in Exercise 6.
Open the form Stock Details in Design view and add a header called Stock Inventory.
Format this header to display as Arial, 18, Bold and in Yellow.
Format all field labels and value text boxes to Arial, 10 and also Yellow.
Adjust the width of label names if necessary.
Change the background colour of the form to Blue.
View the form.
Close the form and exit the application.
Module 5 – Page 42
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Exercise 6 – Covering topics from 5.1 to 5.4.3
1. Open the Access application.
2. Create a new database called Tours.
3. Within this database, design a table to include the following field names and data types:
Tour Name
Destination
Date
Cost
Places
Text
Text
Date
Currency
Number
4. Save the table as Trips.
5. Enter the following records into the table:
Tour Name
Flyaway
Dream Trip
Wild Hike
Road Runner
High Sights
Destination
France
Germany
France
Austria
Germany
Date
12/8/2002
24/7/2002
20/8/2002
29/7/2002
22/8/2002
Cost
€250
€300
€280
€320
€305
Places
15
20
18
5
10
6.
7.
8.
9.
Close the table.
Create a form based on this table with the title Tour Details.
In Form Design view, insert a header called Future Tours.
Format this header to Tahoma, 16 and Bold and change the background colour of the whole form
to green.
10. Close the form.
Exercise 7 – Covering topics from 5.1 to 5.4.3
1.
2.
3.
4.
5.
Open the database called Tours created in Exercise 6.
Create a query to show all the tours to France.
Save this query as French Tours.
Create a query to show all tours during August 2002, call this query August Tours.
Create a query to show the tour name and cost of tours with less than 15 places available. Sort
this query in ascending order by Tour Name.
6. Save the query as Under 15 Places.
7. Exit the application.
Module 5 – Page 43
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Exercise 8 – Covering topics from 5.1 to 5.5.1
1. Open the Access application.
2. Create a new database called Accommodation.
3. Within this database, design a table to include the following field names and data types:
Hotel Name
Rooms
Rating
Cost
Rooms Free
Text
Number
Text
Currency
Number
4. Save the table as Hotels.
5. Enter the following records into this table:
Hotel Name
Grande
Rio
Superior
Roco
Samba
Albatros
6.
7.
8.
9.
Rooms
120
80
100
70
130
100
Rating
****
**
****
***
***
****
Cost
€80
€35
€75
€65
€40
€50
Rooms Free
5
10
0
14
3
0
Sort the table in ascending order by Hotel Name.
Create a query to display all records that have a rating of ***
Save this query as 3 Stars.
Close the application.
Exercise 9 – Covering topics from 5.1 to 5.5.1
1. Open the database called Accommodation created in Exercise 8.
2. Create a query to display the Hotel Name, Rating and Cost of hotels that have more than 10
rooms free.
3. Save this query as Free.
4. Generate a query to display in ascending order by Rooms, the Hotel Name, Cost and Rating of
Hotels that cost between €35 and €55 and have a free room.
5. Save this query as 35 to 55 free.
6. Generate a report based on the table Hotels and sort it according to Hotel Name and save it as
Accommodation 2002.
7. Generate a grouped report, grouped by Ratings and based on the table Hotels and save it as
Ratings for Hotels.
8. Format the report title using Font style Arial, size 18 and Blue text colour.
9. Preview the report and close it.
10. Exit the application.
Module 5 – Page 44
Unauthorised Photocopying is Unlawful
OlasIT © 2003
ECDL/ICDL Module 5 Database/Filing Systems
Exercise 10 – Covering topics from 5.1 to 5.5.1
1. Open the Access application.
2. Create a new database called Albums.
3. Within this database design a table to display the following fields and data types:
Artist
Album
Date Sold
Cost
Text
Text
Date
Currency
4. Save the table as Artists.
5. Enter the following records into the table:
Artist
Meatloaf
U2
Prodigy
Oasis
U2
Oasis
6.
7.
8.
9.
Album
Bat out of Hell
Pop
Fat of the Land
This is Now
Joshua Tree
What’s the Story
Date Sold
12/11/2001
05/12/2001
14/01/2002
06/07/2001
02/01/2002
25/10/2001
Cost
€15.50
€20.99
€18.50
€12.50
€14.99
€22.50
Generate a query based on this table to show albums by Oasis.
Remove the field cost from this query and sort by Date Sold in ascending order.
Save the query as Oasis.
Close the application.
Exercise 10 – Covering topics from 5.1 to 5.5.1
1.
2.
3.
4.
5.
6.
7.
8.
Open the database called Albums created in Exercise 10
Show all albums sold during 2001 and save it as 2001 Sales.
Generate a grouped report, grouped on artist, based on the table Artists.
Give the report a title called Sales by Artist.
Format the header as Tahoma, 18, Bold and Italics.
Remove the field Cost from this report.
Preview the report and save it as Sales by Artist.
Exit the application.
Module 5 – Page 45
Unauthorised Photocopying is Unlawful
Download