SlideShare a Scribd company logo
DATABASES
Ajiro Ndi
Designed by
Certified Cambridge ICT Teacher and Examiner
TABLE OF CONTENT
Create a database structure
Manipulate data
Present data
CREATE A DATABASE STRUCTURE
Teacher ID Forename Surname Subject
001 Ajiro Ndi ICT
002 Amina Yusuf Maths
003 Farah Ahmed Physics
004 Ibrahim Khalid English
005 Hassan Ali Geography
006 Gideon Sunday Chemistry
1
WHAT IS A DATABASE?
A database is an organised collection of data. A database program is software
which stores and retrieves data in a structured way. This includes the data
that is stored and the links between the data items. All databases store data
using a system of files, records and fields:
A field is a single item of data, such as a forename or date of birth. Each
field has a field name that is used to identify it within the database. Each
field contains one type of data, for example numbers, text or a date.
A record is a collection of fields, for example, all the information about
one person or one item. These may contain different data types.
A file (in database terms) is an organised collection of records, usually
where all the records are organised so that they can be stored together. A
file can have one or more tables within it.
Although all databases have these three elements in common, there
are two types:
flat-file databases
relational databases.
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
FLAT-FILE DATABASES
A flat-file database stores its data in one table, which is organised by rows and
columns. For example, in the following database about teachers, each record
(row) in the table contains data about one person. Each column in the table
contains a field, which has been given a field name, and each cell in that column
has the same, predefined data type.
Field name
Records
Fields
RELATIONAL DATABASES
A relational database stores data in more than one linked table, stored in a file.
Relational databases are designed so that the same data is not stored many times.
Teacher_ID Forename Surname Subject Student_ID Student_FName Student_SName
AND Ajiro Ndi ICT G12345 Jasmine Hall
AND Ajiro Ndi ICT G12346 James Ling
AND Ajiro Ndi ICT G12348 Addy Paredes
AND Ajiro Ndi ICT G12349 Hayley Lemon
AND Ajiro Ndi ICT G12351 Jennie Campbell
KEO Kelechi Okpara Biology G12345 Jasmine Hall
KEO Kelechi Okpara Biology G12348 Addy Paredes
KEO Kelechi Okpara Biology G12349 Hayley Lemon
JKW Jennie Kwong English G12345 Jasmine Hall
JKW Jennie Kwong English G12349 Hayley Lemon
JKW Jennie Kwong English G12351 Jennie Campbell
GSD Gideon Sunday Chemistry G12346 James Ling
GSD Gideon Sunday Chemistry G12351 Jennie Campbell
SJR Sarah Jordan English G12346 James Ling
SJR Sarah Jordan English G12348 Addy Paredes
2
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Each table within a relational database will have a key field. The relationships
linking the tables use these key fields.
KEY FIELDS
Most tables will have a primary key field that holds unique data (no two records
are the same in this field) and is the field used to identify that record. Some
tables will have one or more foreign key fields. A foreign key field in one data
table stores values from a primary key field in another table.
PRIMARY AND FOREIGN KEY FIELDS
Using the earlier example, if we wanted to add to the table the names of
each student taught by each teacher using a flat-file database, the table
would look like this:
If the data is split into two tables – one for the teachers and one for the students – that
are linked together, it can be stored and retrieved more efficiently, like this:
Teachers table:
Teacher_ID Forename Surname Subject
AND Ajiro Ndi ICT
KEO Kelechi Okpara Biology
JKW Jennie Kwong English
GSD Gideon Sunday Chemistry
SJR Sarah Jordan English
Students’ table:
Student_ID Student_FName Student_SName English maths Science
G12345 Jasmine Hall JKW AND KEO
G12346 James Ling SJR AND GSD
G12348 Addy Paredes SJR AND KEO
G12349 Hayley Lemon JKW AND KEO
G12351 Jennie Campbell JKW AND GSD
These two tables are linked with a ‘one-to-many’ relationship, because one teacher’s
record is linked to many students’ records. The primary key fields (which must contain
unique data) are the Student_ID and Teacher_ID.
ADVANTAGES AND DISADVANTAGES OF USING FLAT-FILE AND RELATIONAL DATABASES
There are three common types of changes which can be made to the data contained in a
database. Records/data can be added, edited or deleted. Because data is not repeated in a
relational database, each change to an item of data or to a record has to be made only
once. It is also much easier for users to produce reports from a relational database, where
data is held in two or more tables, than from two or more flat-file databases.
Although people often think that it is quicker to search using relational rather than flat-file
databases, it is not always the case. In some cases, where indexed values are used, it can be
true. It depends on the structure of both databases and the quantity of the data being
searched.
You will need to create both flat-file and relational databases, but the data for these will be
provided. You will be using Microsoft Access, which is part of the Microsoft Office suite.
When used with a single table Access is a flat-file database, but it can also be a relational
database when used with more than one linked table.
3
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
When you create a new database you will set a data type for each field. The data
type tells Access how to store and manipulate the data for each field. You will
usually decide what data type should be used for each field.
in Access an alphanumeric field is called a text field. The three main types of field
are alphanumeric, numeric and Boolean.
DATA TYPES AND SUB-TYPES
Note:
While it is listed in the syllabus, in Access ‘percentage’ is not a numeric data sub-
type, it is just a formatting option.
There are other data types, such as autonumber (which generates unique
numbers). Some packages, such as Access, have long and short versions of their
data types (for example, long text and short text) but these are still versions of
alphanumeric data types.
Alphanumeric data can store alpha characters (text) or numeric data
(numbers) that will not be used for calculations. In Access this is called a text
field.
A Boolean (or logical) data type stores data as -1/0 but can display it as Yes/
No (or True/False, -1/0).
A numeric data type (as the name suggests) is used to store numeric values
that may be used for calculations. This does not include numeric data such as
telephone numbers, which should be stored in an alphanumeric data type. In
Access this is called a number field.
There are different types of numeric field including:
integer sub-type, which stores whole numbers. In Access you can select
an integer field or a long integer field. It is wise to use a long integer
field if it is going to contain three or more digits
Note:
Microsoft Excel is not suitable for database tasks as you cannot define data types.
Note:
The data types that you select when creating your database will restrict what data
can be stored in your database. If you set a numeric field to be an integer (with 0
decimal places), then import data with 2 decimal places, like 45.87, Access will
only store 45. The rest of the data will be lost and cannot be recovered. It is
important that you chose your data types very carefully.
decimal sub-type, which will allow a large number of decimal places, or a
specified restricted number if this is set in the field properties when the
database is created
currency sub-type, which will allow currency formatting to be added to the
display. This includes currency symbols and regional symbols. The database
does not store these symbols as this would use up valuable storage space
date and time sub-type, which stores a date and/or time as a number.
Field name Data type
Who manufactured the car? Text
Model Text
Colour Text
Price that we bought the car for Numeric/Currency/2 decimal places
Price that we will sell the car for Numeric/Currency/2 decimal places
Year Numeric/Integer
Extras Text
Does the car need cleaning? Boolean/Logical
Note:
4
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
You work for a small garage called ‘Dodgy Dave’s Motors’. This garage sells used
cars. Using a suitable database package, import the file cars.csv. Assign the
following data types to the fields.
Some field names are
inappropriate. Create
appropriate and meaningful field
names for those fields. You may
add another field as a primary
key field if your software
requires this. Save the database.
It is important to make sure that you use the field names exactly as given in
a question, unless you are asked to provide appropriate and meaningful field
names.
In this question you are asked for appropriate and meaningful field names, so start
by looking at the detailed descriptions given instead of the field names, or even
examine the data to work out what information each field contains
For this question, the descriptions help you to work out meaningful field names. These
should always be short enough to allow printouts to fit easily on to as few pages as
possible. The first example is Who manufactured the car?; this could be shortened to
Manufacturer or even Make. Make is short, meaningful and appropriate, so use that.
Price that we bought the car for could be changed to Purchase Price, Purchase, P Price,
P_Price or just PPrice. Although Access will allow any of these, do not use field names
with spaces in them, as they may cause problems if you try to do more complex
operations with the database. You could use any of the other three options, as all would
be acceptable. For this question, use PPrice. Similarly, the next field can be called SPrice.
Consider the final field, Does the car need cleaning?. Simply using the fieldname Clean
could give the wrong idea, as it could mean ‘Does the car need cleaning?’ or ‘Is the car
clean?’. It is sensible to plan this and make the changes in the .csv file before importing
the data into Access. so lets use Valet
5
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
CREATE A FLAT-FILE DATABASE FROM AN EXISTING FILE IMPORT DATA FROM EXISTING FILES
To import the file cars1.csv (remember, we saved
it with a new filename in an earlier section) for
the task, select the External Data tab. In the
Import & Link section, click on the New Data
Source icon, then from the drop-down menu
select From File. From the sub-menu select the
option for Text File as files saved in .csv format
are text files with each data item separated from
the next by a comma.
6
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
The Import Text Wizard
window will open. As comma
separated value (.csv) files are
delimited files (the comma is
the delimiter), select the
Delimited radio button
For the next part of the wizard, make sure that Comma is selected using the radio buttons
(unless you have changed the .csv file so that it uses semicolons as delimiters). Examine the
first row of the data and decide whether this row contains the field names that you need or if
it contains the first row of data. If the first row contains the field names click on the First Row
Contains Field Names tick box. As you tick this box, the first row changes from 9 to 10
SET APPROPRIATE DATA TYPES
Check that all the field names and data
types match those specified in the task. In
this case the PPrice, SPrice and Valet fields
do not have correct data types. The PPrice
and SPrice fields need to be changed to
numeric (currency) fields and the Valet field
needs to be changed to a Boolean (Yes/No)
field.
Ensure the Code Page is set to Western
European Windows and the Date order is in
DMY
Note:
7
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
In the next screen, ensure that the
radio button for Let Access add
primary key is selected – this adds
a new field called ID to the table;
Access will use this as the primary
key field.
in the Import to Table: box, enter tblCars. This is a meaningful table name as
‘tbl’ shows you that it is a table and ‘Cars’ gives relevance to the data.
The icon in the Views section of the Home tab will let you change between
Datasheet and Design View.
EDIT DATA TYPES
Changes to the data types, or other properties, can be made from the Home tab. In the
Views section click on the Design View icon.
SET THE NUMBER OF DECIMAL PLACES
The task instructed you to set the PPrice field to two decimal places. You can check this
by clicking the left mouse button in the PPrice field and viewing the number of Decimal
Places in the General tab at the bottom of the window.
Note:
8
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
SET THE DISPLAY FORMAT OF BOOLEAN FIELDS
To change the Boolean field so that it displays Yes or No (note, it does not store the
data like this), click in the Valet field. In the General tab, select the Format cell. Use
the drop-down list to select the Yes/No option.
If you need percentage values, set an integer or long integer data type and select
Percentage from the Format drop-down menu for this field.
You work for a shop selling office supplies called ‘Easy as ABC’. Using a suitable
database package, import the file stationery.csv. Use these data types for each field.
Field name Data type
Code Numeric/Integer
Type of product to be sold Text
Description of the product to be sold Text
Quantity of items in each pack Numeric/Integer
Colour Text
Sales price Numeric/Currency/2 decimal places
Purchase price Numeric/Currency/2 decimal places
Discount Boolean/Logical
Some field names are inappropriate. Create appropriate and meaningful field names
for those fields. Use the Code field as your primary key. Save the database.
Make Model Colour PPrice SPrice Year Extras Valet
Ford Focus Silver 1350 2285 2008 Alarm Central Locking Alloy Wheels Yes
Note:
Note:
9
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
ENTER DATA USING A TABLE
Data is normally entered into a database using a form but, if a form is not asked
for, it may be quicker to use the table to enter new data.
Open the database that you saved in Question 1. Add this new car to the database.
Once you open the database
saved in Question 1, First
click on Enable Content
button
To open the table in
Datasheet View, double
click the left mouse button
on the table name.
To make sure that all the columns are
fully visible, click the left mouse
button on the grey square to the left
of the ID field name to highlight the
entire datasheet.
Move the cursor between two field names
until it looks like this and then double click.
This will adjust the display widths of the
columns. Scroll down the list of cars until you
reach the entry with a star next to it, which will
allow you to add a New car at the bottom.
Do not attempt to enter any other characters, such as the currency symbol. As you
press the Enter key after adding the prices Access will set the data into currency
format.
For other data each time you press the Enter key, Access automatically saves the
changes you made to the data.
Check your data entry carefully using visual verification. This is when you compare
the original data on paper (in this case, in Question 2) with the data that you have
entered into the computer. Data entry errors in a database may cause problems
when you try to use the database to search or sort.
10
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
ADD A FIELD TO AN EXISTING TABLE
Data is normally entered into a database using a form but, if a form is not asked
for, it may be quicker to use the table to enter new data.
Open the database that you saved in Question 2. Add a new field to the database
called PDate. Add the purchase date of 20 December 2020 for the last car added to
the database. Save the database as Question 3.
Open the database
and open the table
tblCars in Design View.
Move to the empty
row below the Valet
field and enter the
Field Name PDate. In
the Data Type box use
the drop-down list to
select the Date/Time
type.
Choose the most appropriate Format for the task. In this case, the task asks for a Long
Date format. Save the database as Question 3 and select the Datasheet View. Move
the cursor into the PDate field for the new record (the Silver Ford Focus) and use the
Calendar icon to select the correct date.
You may need to double click to the right of the PDate column to widen the column.
Open the file saved in Task 1. Add these three items of stationery to the database.
Code Type Description Quantity Colour SPrice PPrice Discount
44282 Lever Arch File Laminated Lever Arch Files 1 Red 57.22 28.96 No
44283 Lever Arch File Laminated Lever Arch Files 1 Yellow 57.22 28.96 No
47478 Spine Label Eastlight Spine Labels 100 30 13.86 Yes
Field name Data type
SCode Text
FName Text
SName Text
Subject Text
Room Numeric/Integer
Select the Database Tools tab, locate the Relationships section, then click
on the Relationships icon.
Next
11
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
CREATE A RELATIONAL DATABASE
You work for Ajiro Tech British School. You will edit some data about the
Mathematics Faculty. Using a suitable database package, import the file
teachers.csv. Use these field names and data types:
Set the SCode field as a key field. Import the
file students.csv as a new table in your
database. Set the Student_ID field as a key
field. Create a one-to-many relationship as a
link between the SCode field in the Teachers’
table and the Maths field in the Students’
table.
Use the techniques you practised in Question 1 to import the two tables into the
database so that each table looks like this.
This window shows the link between the fields in
both of the tables. The bottom of the window
displays the type of relationship that you have
created.
A screenshot of this window taken with <prt
sc> key or snipping tool will copy this into the
clipboard. Paste this into the document that
you will present as evidence of your method.
When you click <create> the
window will disappear and the
Relationships tab will look like
this.
In this relationship SCode is the primary
key field in tblTeachers and Maths is the
foreign key field in tblStudents. If you wish
to view or edit the relationship again, you
can double click the mouse on the
relationship line that joins the two tables.
Field name Data type
Order_No Numeric/Integer
Customer_No Text
Product_Code Numeric/Integer
Units_Sold Numeric/Integer
Field name Data type
Customer_ID Text
Name Text
Address_1 Text
Address_2 Text
Address_3 Text
Zip_Code Text
Discount_% Numeric/2 decimal places
12
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file saved in Task 2 Import
the file orders.csv. Use these field
names and data types:
Assign a new field as a key field.
Import the file customers.csv. Use
these field names and data types:
Set the Customer_ID field as a key field. Create a
one-to-many relationship between the Code field
in the Stationery table and the Product_Code field
in the Orders table. Create a one-to-many
relationship between the Customer_ID field in the
Customers table and the Customer_No field in the
Orders table.
Take screenshot evidence showing the:
field names and data types used in these
two tables
relationships between the three tables.
CREATE A DATA ENTRY FORM
Open the file saved in Question 4. Add new data entry forms to collect data for all
fields in both of the tables.
Open the file saved in Question 4. The best way to create a data entry form is to select
the Create tab, then in the Forms section, click on the Form Wizard.
The Form Wizard window opens.
Select the table that holds the fields
that you will include in the form. If
the form needs fields from more than
one table, then select a query (you
will use these later in the chapter).
We will create the first form by
selecting tblStudents, so leave that
selected in the top selection box.
You can move each field across
into the form using the single
arrow key, but, as you want all
the data from this table on the
form, use the double arrow key.
Go to the
first record
Current
record
Next
record
Last
record
New
record
13
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Repeat this process for tblTeachers to create the second data entry form, which
should look like this.
The data entry form may need editing to make it
easier for a different target audience to use. Using
short and meaningful field names to store the
data may not be easy for other users to
understand, particularly if they do not work with
databases regularly. For example, if children were
to add their data, simple questions would be
better than encoded field names, along with
instructions on how to complete the form.
EDIT A DATA ENTRY FORM
Open the file saved in Question 5. Edit the data entry form for student data to make
it easier for students to enter their own data.
Open the database saved in Question 5. Double click the left mouse button on
frmStudents, which is in the list of database objects under forms, on the left.
Select the Home tab, then the drop-down arrow in the Views section to get the drop-
down menu for the different ways of viewing the form. Select Design View.
This will open the Property Sheet pane for the current
object. Move the cursor into the Form Header and click on
the outline of the text box so that it changes to orange.
Click on the Shutter Bar Open/Close Button to hide the
‘Navigation pane’, giving you more room to work.
The tab will change automatically to Design. From the
Tools section of this tab, select the Property Sheet icon.
Highlight the text in this label box and
change it to a more suitable heading. If
the text does not fit in the label box,
grab the drag handles and make it
larger. You may not be able to see the
lower drag handles; if you need to use
them, drag the Detail bar down slightly,
but remember to move it back up again
later.
Open the database. Remember you hid the Navigation Pane. Restore it using the Shutter Bar Open/Close Button
arrow.
Open tblStudents in Design View. In the blank row below the ‘Science’ field, enter the Field Name, Year_Group
(you cannot shorten it to Year as this is a reserved word in Access – try it and see …). The Data Type always starts
in Short Text format; click on that cell and use the drop-down menu to select Number.
14
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
If you wish to change the font, colours or
formatting of the text (or any other form
element) this can be done in the Property
Sheet. In this example, Text Align has been
changed to Center. The Fore Color and
Back Color have also been changed by
clicking on them, then by choosing colours
from the palette.
In the Detail row each field has two boxes.
The left one is the label box. This is what is
displayed to the user. The right box is a
text box and this is joined to the data
table. This box is where, when the form is
displayed in Form View, the user will enter
the data. Select each label in turn and edit
the text so it is more meaningful for the
students. You may need to resize some of
the label boxes so that all the text fits. Each
box has a large drag handle in the top left
corner that will allow you to drag the box
around the form to rearrange the form
without resizing the box. This is useful if
you are creating your form to a particular
design. From the Views section of the
toolbar, use the drop-down arrow under
the View icon to select Form View like this.
ADD A NEW FIELD TO AN EXISTING FORM
Type the field description into the Description box (copy the text
from the table in the question). This helps to document the
database. In the blank row below this, add the new Field Name,
Tutor. Leave the Data Type as Short Text. Type the Description,
again using the text from the task. To help improve the form and to
save lots of storage space, we know that the tutors’ initials are three
characters in length. In the General tab at the bottom, set the Field
Size to 3.
Open frmStudents in Design View. Pick up the top of the
Form Footer and drag it down to give enough room to add
the two new fields. The Year_Group field could appear on
the form as a text box but, as this data can only hold five
possible values (because Ajiro Tech British School only has
years 7, 8, 9, 10 and 11) it would be a suitable field for radio
buttons (Access calls these Option Buttons) within an option
group. From the Form Design tab, in the Controls section,
select the Option Group icon. You may need to use the
drop-down menu to find it.
Open the file saved in Question 6. Two new fields are to be
added to the students’ data. Use these field names, data types
and field descriptions:
Field name Data type Description
Year_Group Numeric/Integer The school year between 7 and 11 inclusive
Tutor Text The name of the student’s tutor
15
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
EDIT A DATA ENTRY FORM
Use radio buttons
Drag the frame for the Option Group
into the Detail section of the form,
clicking the left mouse button once;
this action will open the Option Group
Wizard window. Enter six Label
Names, one item on each row – in this
case Year 7, Year 8, Year 9, Year 10,
Year 11 and an additional option for
‘No year group selected’ – before
clicking on <Next>
In the next window choose the top radio button
option for Yes, the default choice is: and select
the option you typed in for No year group
selected.
Click <Next>. Each label has a value assigned to
it. Access has tried to assign values for you, but
you need to change all the settings in this
example. For Year 7 set the value to 7, Year 8
set to 8, and so on. For No year group selected
set the value to 0.
When you have changed all of the values click .
In the next window, change the radio button
from the top option to Store the value in this
field:. Using the drop-down menu to the right,
select the Year_Group field.
This will make sure that, when a radio button is selected, the value for that radio button
is stored in the correct field, Year_Group, within the table. Click <Next> to choose the
style of options selected (radio buttons (which the software calls option buttons),
tick/check boxes, or toggle buttons) and to choose how the Option box will appear on
the form. Make your choices, then click <Next> . Give the frame a meaningful caption
such as Which year group are you in? before selecting <Finish>.
The option block will look similar to this
in Design View. To add the Tutor field
to the form, select the Text Box icon
from the toolbar.
Drag the text box for the Tutor field on
to the form; you do not need much
space as this field only needs to hold
three characters.
Click the cursor on the Unbound text box and, within the Property Sheet for this
control, select the Data tab. In the Control Source box, use the drop-down menu to
select the Tutor field.
16
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
The text box changes from unbound to show the Tutor
field. The text boxes for English, Maths and Science are
also too large as they can only contain three-lettered
staff codes, so reduce these three field sizes together by
selecting all three text boxes together and dragging the
right edge in so that they match the Tutor field. Save the
database as Question 6. The finished Design view and
Form view look like this.
Resize the label box on the left and
add the text Tutor as the label.
WHAT DOES A WELL-DESIGNED FORM LOOK LIKE?
The most important feature of form design is to keep the form
simple, with clear questions, using closed questions where
possible. This will limit the different answers to be stored in
the database and will make it easier to search the database. A
well-designed form has similar fields grouped, but not
crowded, together, with white space between each data
entry box.
The form has a title that states what data is being
collected.
Each field has appropriate space for the data that will be added,
and there is space between each field. The form has been
appropriately filled by the text boxes but there is enough white
space to keep it from being overcrowded.
Radio buttons (or drop-down menus) are used where possible. There are navigation
buttons on the form (already added by Access) to allow a user to add new records and
move between records.
In Design View of the form, move and resize the controls so that your form looks like
the diagram above. Change the text to be right aligned text in each of the label boxes.
Re-save the database.
Use drop-down menus
It is often easier for the user of a database to use a drop-down menu to select data
rather than typing each data item every time. These can only be used when there are a
limited number of possible entries for a field, so fields containing data such as names
could never use drop-down menus – unless they contained every name in the world,
which would not be practical.
Combo
box
List
box
17
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file saved in Question 7 Change the Tutor field so that the user can select
their tutor from the list of staff codes in tblTeachers.
Open the file saved in Question 7 and open frmStudents
in Design View. Delete the controls for the Tutor field
(both the label and text box). You will replace the text
box with another type of control. From the Form Design
tab, in the Controls section there are two suitable
options, a combo box or a list box.
If you wish to allow the user to type new items into the drop-down list then a
combo box would be suitable, but for this task, where you do not want the user to
be able to add to the list items, select a List box.
Drag the control onto the form. The List
Box Wizard window opens. Select the
radio button for I want the list box to get
the values from another table or query,
as the data is held in the teachers table.
Click on <Enter>.
In the next window select Table: tblTeachers
then click on <Enter>.
Double click the left mouse button on the
SCode field to move it from the ‘Available
fields:’ to the ‘Selected fields:’, then click
<Enter>.
In the next window select Table:
tblTeachers then click on <Enter>.
18
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Select the SCode field in box 1 and make
sure that the ‘Ascending’ button is visible,
to show the list in alphabetical order. Click
<Enter>.
Adjust the SCode column width
using the drag handle, then click
<Enter> .
The value that you select will
need to be stored in the Tutor
field so select from the Store
that value in this field: drop
down menu the option for
Tutor.
Click on <Next>, then change the label for
the list box name from the suggested name
to Tutor, then click on <Finish>.
Resize/move the controls and change the
alignment of the text in the label to right
aligned so that it matches the other labels.
Save the database as Question 8.
MANIPULATE DATA
Open the file that you saved at the end of Question 3. A customer would like a car
made by Ford. Find the customer a list of all the cars in the garage made by Ford.
Open the database that you saved at the end of
Question 3. You do not need to open the table that
you created earlier. Select the Create tab and find the
Queries section. Click on the Query Wizard icon.
Note:
If you select a previous query rather than the table, you are likely to get incorrect results.
19
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
PERFORM SEARCHES
You can search for data in Access using a query. This allows you to select a subset
of the data stored in your table. Each query is created, saved and can be used
again later. If new data is added to the table, when you open a query again it will
select the subset from all the data, including the new data.
This is the easiest way of performing a search and opens
the New Query window. Select the Simple Query Wizard
and click on OK . In the Simple Query Wizard window,
make sure that the correct table name has been selected
in the Tables/Queries box. As this is your first query this
is the only option in this box, but each time you create a
new query it will be shown here.
For this question it would be appropriate to show the customer all the fields except the ID
field, the price that the garage bought the car for (the PPrice field) and the date the garage
purchased the car (the PDate field).
Move all of the fields into the query using the
double arrow key.
Select the ID field, the PPrice field and the
PDate field in turn and click on the single
arrow to remove them from the selection.
You need to enter a name for the query. This query may
be turned into a report at some point and the name you
give the query may become the title for the report.
Select the radio button for Modify the query
design, then click on <Finish>.
This opens the query in Design View. Datasheet
View can be seen at any time by selecting the
drop-down list under the View icon. However,
at the moment the query will still contain all of
the records as you have not yet performed the
search, so make sure you are in Design View .
Note:
Note:
You do not need to use speech
marks as Access will put these in for
you. This will extract only the cars
made by Ford.
20
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
To perform the query, move the
cursor into the Criteria: row of
the Make field and type in Ford.
Now select the Datasheet View to
see the results of the query. The
number of records can be seen at
the bottom of the window in this
view. There should be 25 Ford cars
in the query.
Open the file that you saved at the end of Question 9. The manager would like to
see all the details of all the Fords that need valeting.
Create a query in a similar way to the one for Question 9. Make sure you have
tblCars selected and not your Ford query. Select all the fields and, when in Design
View, enter Ford in the Criteria: row of the Make column and Yes in the same
Criteria: row for the Valet column. The selection will look like this and only two
cars will be found using this search.
This is called an AND Query, because the Make has to be Ford AND the Valet field has to be Yes.
Open the file that you saved at the end of Question 10. The manager would like to see
all the details of all the cars made by Ford or Vauxhall.
Create a query in a similar way to the one for Question 10. In the Simple Query Wizard window,
make sure that the correct table name has been selected in the Tables/Queries box. If you select
one of the previous queries rather than the table, you are likely to get incorrect results.
Note:
Note:
Note:
21
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Select all the fields and, when in Design View,
enter Ford or Vauxhall in the Criteria: row of
the Make column. The selection will look like
this.
Another way of doing this is to type Ford in
the Criteria: row and Vauxhall in the or: row.
Open the file that you saved at the end of Question 11. The sales manager would
like to see details of all the cars in stock not made by Ford.
37 cars will be found using this search.
Create a query in a similar way to the one for
Question 11. Select all the fields and, when in Design
View, enter Not Ford in the Criteria: row of the Make
column. The selection will look like this.
Another way of doing this is to type <> Ford in the Criteria: row
43 cars will be found using this search.
Open the file that you saved at the end of Question 12. The manager would like to see
all the details of all the cars that have alloy wheels.
By examining the data in the database, you can see that the text ‘Alloy Wheels’ could
appear in the Extras field. It may not be the only extra that a car has – there could be
other extras listed before it or after it within the field.
To find all the cars with this extra you must create a
query in a similar way as for Question 11. Select all
the selected fields and, when in Design View, in the
Criteria: row of the Extras column, enter the text
*Alloy Wheels*. The stars tell Access that you are
performing a wildcard search. This is a search which
looks for the words ‘Alloy Wheels’ (including the
space) anywhere in the Extras fields’ contents.
To search for something that is at the start of the data, use Text*; for example, Bl* in the Colour
field will find all the cars with the first colour Blue or Black, but would not find colours such as
Light Blue. Placing the star at the start of a search string will only find those things ending with
the search string.
35 cars will be found using this search.
Note:
22
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file that you saved at the end of Question 13. The sales manager would
like to see details of all the cars in stock for sale for less than or equal to £4125.
Create a query in a similar way as for Question
13. Be careful not to use symbols such as < or £
in the query name. Select all the selected
fields and, when in Design View, enter <=4125
in the Criteria: row of the SPrice column.
19 cars will be found using this search.
Similar mathematical formulae can be used, with < for less than, > for greater
than, >= for greater than or equal to, and = for equals. These mathematical
formulae cannot be used for queries involving text fields but can be used for
any numeric, date or time fields.
Open the file that you saved at the end of Question 8. Find Mr Varela a list of all
the students that he teaches for Maths; include in this extract his full name and
teaching room.
Open the database that you saved at the end of Question 8. Create a new query using
the Query Wizard. This is the easiest way of performing a search and opens the New
Query window. Select the Simple Query Wizard then, in the Tables/Queries box, select
the table tblTeachers. Move across to the right to the FName, SName and Room fields.
Move back into the Tables/ Queries box and select the table tblStudents. Select the
Student_Fname, Student_SName and Maths fields by moving them from Available
Fields: to Selected Fields:
Click on <Next>. Continue through the wizard until you get to the query in Design View.
23
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Move the cursor into the
Criteria: row of the Maths field
and type in AVA. Open the
query in Datasheet View to
check that you have done the
query as specified.
The Maths field does not need to be
shown; to hide it (do not delete it or the
selection of the data will also be lost)
move back into Design View. Move the
cursor into the Show: row of the Maths
field and remove the tick from the check
box.
This field is present in the query but will
not be shown. This query should return
31 records.
Open the file saved in Task 3.
Search the database to find the following information for your manager. For each search,
show how you performed the search and the results of the search; the results must show all
the fields in the stationery table.
Find all of the blue stationery items.
Find all of the blue or black stationery items.
Find all of the items where the colour is not blue.
Find all of the red items where the discount is ‘yes’.
Find all of the items where the type contains the word ‘file’.
Find all of the items where the description contains the word ‘file’.
Find all of the items with a quantity of less than or equal to 10.
Find all of the items where the quantity is 10.
Find all of the items with a quantity of greater than 1.
Find all of the items with a quantity of greater than or equal to 10.
Find all of the items where the sale price is less than £10.
PERFORM CALCULATIONS
Use formulae in queries
You are sometimes asked to perform calculations at run time. This could be done
in one of two ways. The first method is by creating a calculated field, so that each
record has a calculation performed on it and the results are stored in a query.
The other method is to calculate on all (or a selection of) the records, for
example to add (sum) the data from a number of records.
Then click on <Next>. In the Tables/ Queries box select the table tblCars as the
source of the data. Select all fields using the double arrow key. Click on <Next>
twice, name the query Profit calculation, select the radio button for Modify the
query design, then click on <Finish>.
In the Design View of the query,
use the bottom scroll bar to scroll
to the right and find the first blank
field
Note:
Note:
24
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file saved in Question 14.
Produce a new extract from all the data that:
contains a new field called Profit which is calculated at run time – this field will
subtract the purchase price from the sale price
contains a new field called Percent to calculate the percentage profit for each
car at run time. This field will divide the profit by the sale price.
To create a field that is calculated at run time, you must first open a query. For this
question the query will not be used to search for data but to perform the
calculation. Select the Create tab, then click in the Queries section on the Query
Wizard icon; select the Simple Query Wizard.
Move the cursor into the Field row for the first blank field. Enter the name Profit that
you wish to give this calculated field followed by a colon. The colon tells Access that
the next section is a calculation. Within the calculation, you must place square
brackets around each field name so that Access looks up the data from the relevant
field.
For this question, you need to
subtract the purchase price from the
sale price. The finished calculation
will appear like this.
You can use the builder to achieve
this
Use + for addition, - for subtraction,
* for multiply and / for divide.
In the Views section, select the
Datasheet View. Calculate the
profit for three or four cars by
hand or using a calculator and
compare with the results in the
query to check that you have
entered the formula correctly.
25
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
The question requires you to create a second calculated field, so it would be
sensible to include the new field now and complete the formatting later. To create a
new field called Percent, follow the same procedure, this time adding a formula to
divide the profit by the purchase price.
Again, check the calculations with a calculator to ensure that you have not made
an error when entering the formula. When you have calculated this field and view
the query in Datasheet View, you may see the values displayed as #####. This
means the column is too narrow to see all the data. Drag the right column handle
to the right so that the data is fully visible. Save the database and close the query.
Open the file saved in Task 4. Produce a new extract from all the data in the stationery table that:
contains a new field called Profit which is calculated at run time – this field will subtract the
purchase price from the sale price
contains a new field called Percent to calculate the percentage profit for each car at run time –
this field will divide the profit by the sale price
contains a new field called UnitProfit – this field will divide the profit by the quantity.
For each calculated field, show how you performed the calculation and the results of the
calculation.
Open the file saved in Question 16.
Select only the cars made by Audi, BMW or Mercedes. Produce a new extract from all
the data which, for the each of these makes of car, calculates:
the sum of the sale price
the average sale price
the number of cars in stock.
Sort this data into descending order of average sale price.
This question requires the use of summary data. Open the file and, from the Create
tab, select the Query Wizard, then the Simple Query Wizard followed by <Next>. In
the Tables/Queries box select tblCars and from this table select only the Make and
SPrice fields before clicking on <Next>
26
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Click the radio button for Summary
data, then select the Summary
Options… button.
This opens the Summary Options window.
To calculate the sum of the sale prices, tick
the check box for Sum. For the average
sale price, tick the check box for Avg. For
the number of cars in stock tick the check
box for Count records in tblCars.
Click on the <ok> button followed by
<Next>. Add a new title for the query,
such as your name followed by Summary
data for Audi or BMW or Mercedes
query. Select the radio button for Modify
the query design, then click on <Finish>
to enter Design View. Enter in the
Criteria: row of the Make column the
text Audi or BMW or Mercedes.
SORT DATA IN QUERIES
This data is sorted into ascending order of
Make, but the Question required you to
sort this data into descending order of
average sale price. Select the Home tab,
then click on the column heading for Avg
of SPrice.
In the Sort & Filter section, select the
descending sort icon
27
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file saved in Task 5.
Select all types of items, except for any binder. Produce a new extract from all of the
stationery data which, for each type of item, calculates:
the average purchase price
the average sale price
the number of items in stock.
Sort this data into descending order of average purchase price.
Show how you performed the summary query and the results of the calculations.
PRESENT DATA
PRODUCE A REPORT
The word ‘report’ can be quite confusing. A dictionary definition is ‘a document that
gives information about an investigation or a piece of research’. For our purposes, a
report has this generic meaning: ‘a document that gives information’. This is often
confused with a report created in Access. The report created in Access will often be
the most suitable report for questions and tasks, but sometimes it may be better to
produce a report in a word processor, copying and pasting information into a
document. For each task you will need to decide which method is the most suitable.
Open the file saved in Question 17.
Produce a report that:
shows all of the cars made by Ford
displays only the Make, Model, Colour, SPrice, Extras and Valet fields within the
width of a landscape page
has the text ‘Report by’ and your name on the left in the header of each page
has a title ‘All Ford cars in stock’ centre aligned at the top of the first page
has a subtitle ‘request for Mr David Watson’ right aligned, in red, at the top of the
first page.
Note:
Note:
28
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the database saved in Question
17. Select the Create tab and find the
Reports section. Click on the Report
Wizard icon to open the Report Wizard
window.
You must create the query first and then base the report on the query.
In the Tables/Queries box you need to
select the correct query. For this question
the report will be based on the query to
select only the Fords (you created this
query in Question 9). Use the arrow
buttons to move the fields required by the
question from Available Fields: into the
Selected Fields:
If a question asks for specified fields (as this task asks for ‘displays only the Make,
Model, Colour, SPrice, Extras and Valet fields’) make sure you do not add extra
fields. Make sure that you also place the fields in the order specified in the
question.
Click on <Next>. Grouping is not needed at
this level, so click on <Next> again. You have
not been asked to sort the report for this
question (this is covered later in the slide), so
click on <Next> again to get this Report
Wizard window.
Use the Layout section to choose how the
page will be laid out; in this case a Tabular
format has been selected.
The question asked you to select a single
landscape page. The page orientation is
chosen using the Orientation radio buttons.
Select Landscape then click on
Change the report name so that it reads ‘All Ford cars in stock’ (which is the title from
the task). As you still need to add the subtitle and ensure that the layout is correct,
select the Modify the report’s design radio button and click on <Next>. The Design
View of the report will look similar to this.
29
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
If you had selected different layout options
such as justified, or columnar, the first page
of each report would look similar to this.
justified columnar
Each section of the report is shown with a light grey bar. The top section is the Report
Header. Anything that you place in this section appears only once at the start of the
document. Anything that you place in the Page Header is shown at the top of each
page, in this case the field names. Similarly, information in the Page Footer is shown at
the bottom of each page. The Report Footer appears at the very end of a report,
although in this example the Report Footer is empty (it is not shown in white) and
therefore will not be shown in this document. The Detail section is the most important,
as this single row is where the data is shown for each car. This single row will appear as
many rows (as many as there are Ford cars in the database) and display the details of
each record.
Open the database that you saved in Task 6.
Produce a report that:
displays all the data in the stationery table within the width of a landscape page
has your name on the right in the header of each page
has a title ‘All stationery in stock’ centre aligned at the top of the first page
has a subtitle ‘request for the manager’ right aligned at the top of the first page.
30
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the database that you saved at the end of Question 18.
Produce a report that:
displays all the data for the Make, Model, Colour, SPrice, Year and Extras fields
for all the cars with alloy wheels from Question 12, within the width of a portrait
page
has your name in the report header followed by ‘Cars with alloy wheels’.
Open the file Question 18. Select the Create tab and, in the Reports section, click on the
Report Wizard icon. In the Report Wizard window, in the Tables/ Queries box, select the
query for alloy wheels (that you created in Question 12). As the question says ‘display all
the data’, and specifies the fields, use the arrow buttons to move only these fields from
Available Fields: to the Selected Fields: box. Go through the wizard as you did for the
previous question, making sure that you set the page Orientation to Portrait.
BREAKDOWN
You must show all of the required data in full
Change to Report View and check that all the data and labels fit within the width of a single
page. Other than the Extras field (which holds the most data), We can enlarge the Extras field
by making the control for that field twice as deep.
Change to Design View and click the cursor on the top edge of the Page Footer. Drag
this down about 8mm. In the Detail row, click the cursor on the lower edge of the
Extras control. Drag this down to double the height of this control.
Change to Report View and check that all the data and labels fit within the width of a single page
PRINT PREVIEW:
Open the database that you saved in Task 7.
Produce a report that:
displays the data for all the items where the quantity is greater than or equal to
10, selected in Task 4, within the width of a portrait page
has your name in the header of each page
has a title ‘Quantity > = 10’ centre aligned at the top of the first page.
31
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
EXPORT DATA
Sometimes whole reports, queries or the data within them need to be exported into
other packages to be manipulated as part of a report for someone, or to create a
graph or chart.
Export the report saved in Question 19 into rich text format so it can be included in
a word-processed document.
In the Navigation pane (on the left side of the
window), find the report that you saved in
Question 19 and right click the mouse button on
the report name to get the drop-down menu.
Select the option to Export. This will open another
drop-down menu. You need to export into .rtf
format, so select Word RTF File. This opens the
Export – RTF File window. Click on the <Browse>
button to select a folder to save the document into.
You will need to use this file for another question,
so select the tick box for Open the destination file
after the export operation is complete, then click
on <OK> . The exported file will appear in Microsoft
Word. Close the Export – RTF File window.
Note:
If you need to export a report without any formatting, select the Text File option
Note:
If you need to export the data into .csv format (comma separated values), export it first into Excel,
then save it in .csv format from Excel.
Export the report saved in Task 8 into:
rich text format
a format that can be used to produce a graph
comma separated value format.
HIDE DATA IN A REPORT
There are times when information in a report needs to be hidden in some way. In real
applications a single report would be created for more than one task and some data
would be hidden. This process is often done automatically using a created report and a
programming language. Although that is beyond the scope of this book, the ability to
hide fields within a report is useful. An example of this is when an invoice is produced
for a customer and the same document is used as a delivery note, so that it shows the
details of the items ordered but the costs are hidden. In Access this can be done in one
of two ways: the first is to make a control invisible; the second is to use a background
colour that matches the text colour.
32
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Create a new report showing all the data for all the cars in stock made by Audi,
BMW or Mercedes.
Hide all the labels and data for the ID, Valet and PDate fields from the report. Hide
the PPrice data (but not the title) by setting a black background.
Using the methods used so far in this chapter, create a new query from tblCars to
select the three makes of car. Create a new report set in landscape format to display
all fields for these cars, like this.
Go into the Design View of the report; holding down the <ctrl> key select all the
controls for the ID, Valet and PDate fields. Open the Property Sheet and, in the
Visible section, change the setting from Yes to No, which will hide these controls.
To set a black background for the
PPrice data, in the Detail row of the
report select the control for PPrice.
Move the cursor into the Property
Sheet, selecting the Format tab. Find
the Back and Fore Color section and
use the <insert> icon to select the
colour palette.
Select the black colour rather than the white background. Set the Fore Color to black in
the same way. Change from Design View into Report View to see the changes.
Save the changes to the report and close it.
Note:
Note:
33
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file you saved in Task 8. Move to All Access Objects and Reports.
Use copy and paste to make a copy of the report for the quantity is greater than or
equal to 10, before starting Task 10.
Open the report created in Task 8.
Hide the label and data for the Discount field in the report and hide only the data in
the PPrice field by setting a black background.
If you wish to change the display formats of any field, this can also be done in the Property
Sheet pane using the Format tab. However, it is better to set the formatting for the fields in
the Design View of the table as changing the display properties will not change the way that
the data is stored, and this could lead to errors if fields are used for calculations.
PRODUCE LABELS
You may be required to produce other forms of output from your database, for
example, producing labels to advertise a product or address labels for mailing letters
to customers.
Open the file that you saved at the end of Question 20.
Find all the cars with a sale price of less than £4000 and, for these cars, produce labels
that:
have a page orientation of portrait
fit two side by side on the page
have a 16-point, centre aligned heading ‘Special Offer’ at the top of each label
show only the fields Make, Model, Colour, SPrice, Year and Extras, sorted into make
and model order
have your name at the bottom right of each label.
Design a new query to extract only the cars with a sale price of less than £4000,
selecting only the Make, Model, Colour, SPrice, Year and Extras fields from the table
as you step through the Simple Query Wizard. When you have selected these cars,
close the query and click the left mouse button on the query so that it is highlighted
like this.
From the Create tab, find the
Reports section and click on the
Labels icon.
34
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
This opens the Label Wizard. Select any
label format that contains two labels
across the page; in this case, use the
Avery J8166 labels as they are slightly
larger than some of the other labels (and
it is therefore easier to fit all the data
and labels on to each label). Click on
<Next>.
The next screen asks for the font size and
colour of the text on the label. Leave this
set to a small size (it is easier to enlarge
this later, if needed, rather than to reduce
it), such as 8 points high. Click on <Next>.
Type the text ‘Special Offer’ in the grey
area as the top row of the label. Press to
move down to the second row.
In Available fields: double click on
the Make field. Press <Enter> to
move to the next line. Add each field
in the same way, entering the new
line then the field. When all of the
fields have been moved across, add
a final row with your name, then
click on <Next>.
Move the Make, then Model fields
across into the right to sort the
labels by make and model as
specified in the question, then click
on <Next>.
Give the labels an appropriate name and
select the radio button for Modify the
label design. Click on <Finish>.
35
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
The Design View looks like this. Select
all the controls except the one
containing the text ‘Special Offer’. Drag
these down about 8mm. Move the
lower control down the label about
8mm. Select the middle six controls
and move the left edge to the right
about 25mm.
Select the control containing the text
‘Special Offer’ and stretch it down to
give it more space. Open the Property
Sheet and set the Font Size to 16 and
the Text Align to Center. Stretch the
Extras field down to give it more space,
so that all the data should be visible.
This will need to be checked when the
labels are produced and edited again if
necessary. Your name at the bottom of
the label should also be right aligned
by setting the Text Align to Right.
Check the labels’ layout from the
Home tab, using Print Preview to see
all the labels set out on the sheet or
Report View to see a single label. Save
the labels
The six middle controls (those containing
the fields) need labels. Click on the Design
tab and select the label box. Drag the label
box out to the left of the Make field, enter
the text ‘Make’ and, in the Property
Sheet, set the Font Size to 8. Set the
Height of this control to the same as the
Make field control
Copy this control, paste it five times and
move the new labels to the left of each
field. Edit the text so that each label box
shows what the field is.
Check the labels’ layout from the Home
tab using Print Preview to see all the
labels set out on the sheet.
If need be, make any adjustments to the
controls.
36
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the database that you saved at the end of Task 9. Find all the stationery
items where the discount is ‘Yes’ and the sale price more than £30.
For these items produce labels that:
have a page orientation of portrait and fit two side by side on the page
have a 20-point, right-aligned heading ‘Discount Offers’ at the top of each
label
show only the fields Type, Description, Colour and SPrice, sorted into colour
order
have your name centre aligned at the bottom of each label.
FORMAT REPORTS
Open the file saved in Question 22. Using the extract that contains the
calculated fields Profit and Percent, produce a new report from all the data that:
has the PPrice, SPrice and Profit fields formatted as Euro with two decimal
places
has the Percent field formatted as a percentage value with no decimal
places.
Open the file saved in Question 22. Create a new report from all the data in the extract
using the Report Wizard. In the Tables/Queries box select the profit calculation query as
the source of the data. Select all fields using the double arrow key. Click on <Next> three
times. Set the page Orientation to Landscape then click on <Next>. Use Profit
calculation as the report title. Select the radio button for Modify the report’s design,
then click on <Finish>. Adjust all the field widths so that all the data fits on the page.
Move to the Detail row of the report. Hold down the key and select the PPrice, SPrice and
Profit field controls. In the Property Sheet select the Format tab and use the drop-down
menu in the Format section to select Euro.
Move to the Decimal Places
section and select 2. Click on the
View icon to go into Report View
and check that the formatting for
these fields is in Euro and contains
two decimal places.
Repeat this process for the Percent field. Click the left mouse button on the control for Percent in
the Detail row of the report. Select the Format tab and use the dropdown menu in the Format
section to select Percent from the drop-down list. Move to the Decimal Places section and select 0.
Go into Report View to check that the formatting for this field is now correct and contains no
decimal places. This is fine, but some field widths may need readjusting so that all data and labels
are fully visible. Adjust these before saving the completed report.
Note:
If a question asks for a currency not held in this drop-down menu, select your local Currency format
37
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file saved in Task 11.
Using the extract that contains the calculated fields Profit, Percent and UnitProfit,
produce a new report. Apply appropriate formatting to this report. All currency
values must be in Euros with two decimal places. All percentage values must be set
to one decimal place.
FORMULAE IN REPORTS
Other calculations may be needed on the data selected. These include calculating
the sum (total), average, maximum or minimum values of selected data, or
counting the number of items present in the selected data. All of these functions
can be produced within a report in Access.
Open the file saved in Question 23. Produce a new report from all the data that:
displays at the bottom of the report the total profit if all the cars were sold
displays at the bottom of the report the maximum, minimum and average
profit values
displays the number of cars in this report.
You can use the Profit calculation report
Open this report in Design View.
Click the left mouse button on the bottom edge of the Report Footer and drag this
down about 2cm, so that this footer is now visible.
Select the Design tab, move to the Controls section and select the Text Box icon.
Click the left mouse button on the bottom
edge of the Report Footer and drag this
down about 2cm, so that this footer is
now visible. Select the Report Design tab,
move to the Controls section and select
the Text Box icon
Move down into the Report Footer, click the left mouse button and drag to place a
new control, in this case a text box, directly below the Profit column.
This positioning is important as this control will be used to calculate the total profit
for the data in this report.
38
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
Open the file saved in Task 11.
Using the extract that contains the calculated fields Profit, Percent and UnitProfit,
produce a new report. Apply appropriate formatting to this report. All currency
values must be in Euros with two decimal places. All percentage values must be set
to one decimal place.
FORMULAE IN REPORTS
Other calculations may be needed on the data selected. These include calculating
the sum (total), average, maximum or minimum values of selected data, or
counting the number of items present in the selected data. All of these functions
can be produced within a report in Access.
Open the file saved in Question 23. Produce a new report from all the data that:
displays at the bottom of the report the total profit if all the cars were sold
displays at the bottom of the report the maximum, minimum and average
profit values
displays the number of cars in this report.
You can use the Profit calculation report
Open this report in Design View.
Click the left mouse button on the bottom edge of the Report Footer and drag this
down about 2cm, so that this footer is now visible.
Select the Design tab, move to the Controls section and select the Text Box icon.
Click the left mouse button on the bottom
edge of the Report Footer and drag this
down about 2cm, so that this footer is
now visible. Select the Report Design tab,
move to the Controls section and select
the Text Box icon
Move down into the Report Footer, click the left mouse button and drag to place a
new control, in this case a text box, directly below the Profit column.
This positioning is important as this control will be used to calculate the total profit
for the data in this report.
39
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
If the Properties pane is not showing,
right click the mouse button on the
text box that you have just created
then select Properties from the drop-
down menu. In the Property Sheet
select the All tab, find the Control
Source section and type the formula
=SUM([Profit]) into this row. The
Property Sheet will change to this.
The round brackets are part of the SUM
function; the square brackets tell Access
that this is a field (in this case the Profit
field calculated at run time). Format this
control as Euro and set the Decimal
Places to 2.
Move the cursor into the label for this
text box and type in the Caption ‘Total
Profit’. This can be entered in the label
or in the Property Sheet pane using the
Caption
Change to Report View and make sure that the control is in the correct place and
appears to give the right answer (it is not too large or too small).
Rather than repeating this process four more
times, it will be quicker to copy and paste these
controls and edit each one to give the required
results.
In the last four controls containing labels, change the
Captions to ‘Maximum profit’, ‘Minimum profit’,
‘Average profit’ and ‘Number of cars’. Select the
second Text Box (for the maximum profit) and change
the formula so that it becomes =MAX([Profit]). Change
the formulae for the minimum profit so that it becomes
=MIN([Profit]) and for the average profit so that it
becomes =AVG([Profit]). In the final control to count
the number of cars, change the formula so that it
becomes =COUNT([Profit]).
In the Property Sheet pane for the final Text
Box, change the Format back from Currency to
General Number. Set the Decimal Places for
this control to 0. Check the layout and
calculations in Report View. The completed
calculations look like this.
Save the report. If you need to show evidence
of the formulae that you used, use screenshot
evidence of the calculated controls.
Note: You created the query in Question 11. To produce this
report, select the Create tab and click on the Report
Wizard icon. In the Tables/Queries box select the Ford
or Vauxhall query. Select all fields using the double
arrow key and then click on Next twice to open
the Sorting window. Use the drop-down lists to select
the Make field, then the Model field and, finally, the
SPrice field. For the SPrice field, click on Ascending
to the right of this field and it will toggle (change) to
Descending.
40
AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL
Designed and Presented by Ajiro Ndi
If you are using screenshot evidence of calculated controls, make sure that each
control is wide enough to show all of the formulae in full.
Open the file saved in Task 12. Copy and edit the report which contains the
calculated fields to produce one that:
displays at the bottom of the report the maximum and minimum percentage
profit for all the stationery items in stock
displays at the bottom of the report the average profit per item
displays the number of items in stock
uses appropriate formatting for all data.
SORT DATA IN A REPORT
Although Access has the ability to sort data in both tables and queries, it is
easier to save the sorting until the data is produced in an Access report.
When the fields have been set as shown, click on . Set the Orientation to Landscape
and run through the final stages of the wizard, giving this report a suitable name.
This process is the same for other data types such as dates.
Open the file saved in Question 24. Produce a report that:
displays all the data for the cars made by Ford or Vauxhall
fits within the width of a single page
is sorted into ascending order of make and model, then into descending order
of sale price
has your name in the report header followed by ‘Ford or Vauxhall’.
Open the file saved in Task 13. Produce a new report from all the data that:
displays all the blue or black stationery items
fits within the width of a single page
is sorted into ascending order of colour and type, and then into descending order
of description
has your name in the report header followed by ‘Blue or black stationery items’.
Ajiro Tech, led by Ajiro Ndi, is a YouTube channel dedicated to IGCSE
education. With nearly a decade of experience, Ajiro Tech offers tutorials
on ICT, Chemistry, Biology, Physics, Mathematics etc, helping students
excel in their exams.
ABOUT US
OUR TEAM
AjiroNdi
ICT  IT
GideonSunday
Chemistry
KelechiOkpara
Biology
CONTACT US
youtube.com/@ajirotech ajirotech@gmail.com

More Related Content

PDF
IGCSE ICT (0417/0983) - Website Authoring - Ajiro Tech
PDF
IGCSE ICT - The Systems Life Cycle - Ajiro Tech
PDF
IGCSE ICT (0417/0983) - Spreadsheets - Ajiro Tech
PDF
IGCSE ICT - Safety and Security - Ajiro Tech
PDF
IGCSE ICT - File Management - Ajiro Tech
PDF
IGCSE ICT (0417) - Communication - Ajiro Tech
PDF
IGCSE ICT (0417/0983) - Networks and the effects of using them - Ajiro Tech
PPTX
IGCSE ICT (0417) P2 data manipulation using Access
IGCSE ICT (0417/0983) - Website Authoring - Ajiro Tech
IGCSE ICT - The Systems Life Cycle - Ajiro Tech
IGCSE ICT (0417/0983) - Spreadsheets - Ajiro Tech
IGCSE ICT - Safety and Security - Ajiro Tech
IGCSE ICT - File Management - Ajiro Tech
IGCSE ICT (0417) - Communication - Ajiro Tech
IGCSE ICT (0417/0983) - Networks and the effects of using them - Ajiro Tech
IGCSE ICT (0417) P2 data manipulation using Access

What's hot (20)

PDF
ICT IGCSE Practical Revision - Word Processing.pdf
ODP
Creating relationships with tables
PPTX
Microsoft Word 2010
PPTX
PPTX
Beginners' Guide to Powerpoint
PPT
Eye catching HTML BASICS tips: Learn easily
PDF
Functions and Charts in Microsoft Excel
PPTX
ICT-DBA-level4
PPTX
MS Access teaching powerpoint tasks
PPT
Visual basic 6.0
DOCX
Programming Java NCIII Budget of Work
PPTX
Sorting and Filtering.pptx
PPTX
Excelpresentationdatavalidation
PPTX
Microsoft excel tutorial (part i)
PPTX
PPTX
Excel Lesson 1: Excel Basics
PPTX
Formatting in MS Excel
PPTX
Grade 6 COMPUTER
PPT
Html basics
PPTX
Libre Office Impress Lesson 2: Creating a Slide Show
ICT IGCSE Practical Revision - Word Processing.pdf
Creating relationships with tables
Microsoft Word 2010
Beginners' Guide to Powerpoint
Eye catching HTML BASICS tips: Learn easily
Functions and Charts in Microsoft Excel
ICT-DBA-level4
MS Access teaching powerpoint tasks
Visual basic 6.0
Programming Java NCIII Budget of Work
Sorting and Filtering.pptx
Excelpresentationdatavalidation
Microsoft excel tutorial (part i)
Excel Lesson 1: Excel Basics
Formatting in MS Excel
Grade 6 COMPUTER
Html basics
Libre Office Impress Lesson 2: Creating a Slide Show
Ad

Similar to IGCSE ICT (0417/0983) - Databases - Ajiro Tech (20)

PPT
Data processing
PDF
Module03
PDF
course31_a_ex01_task.pdf
PPS
Database
PPTX
SESSION 1 DATABASE MANAGEMENT SYSTEM.pptx
PPTX
8.-Database Management System with MS-Access.pptx
PDF
Database use
PPTX
Database management system
PPTX
Database management system
PPTX
Database fundamentals
PPTX
Database - R.D.Sivakumar
PPTX
English database management_system
PPT
Ch # 09 database management system
PDF
toolkit13_sec9.pdf
PPTX
Architecture of dbms
PPTX
18 database features
PPTX
Chapter 9 Data Dictionaries system analysis and design.pptx
PDF
Access 2010
PPT
Chapter 2 Database Systems Architectures
PPT
Chapter 2 Database Systems Architectures
Data processing
Module03
course31_a_ex01_task.pdf
Database
SESSION 1 DATABASE MANAGEMENT SYSTEM.pptx
8.-Database Management System with MS-Access.pptx
Database use
Database management system
Database management system
Database fundamentals
Database - R.D.Sivakumar
English database management_system
Ch # 09 database management system
toolkit13_sec9.pdf
Architecture of dbms
18 database features
Chapter 9 Data Dictionaries system analysis and design.pptx
Access 2010
Chapter 2 Database Systems Architectures
Chapter 2 Database Systems Architectures
Ad

More from Ajiro Ndi (13)

PDF
IGCSE ICT (0417/0983) - Storage Devices and Media - Ajiro Tech
PDF
IGCSE ICT (0417) - Audiences - Ajiro Tech
PDF
IGCSE ICT - Input and Output Devices - Output Devices and Their Uses - Ajiro ...
PDF
IGCSE ICT - Input and Output Devices - Direct Data Entry (DDE) Devices - Ajir...
PDF
IGCSE ICT - Input and Output Devices - Input Devices and Their Uses - Ajiro T...
PDF
IGCSE ICT - Types and Components of Computer Systems - Impact of Emerging Tec...
PDF
IGCSE ICT - Types and Components of Computer Systems - Types of computer - Aj...
PDF
IGCSE ICT - Types and Components of Computer Systems - Operating Systems - Aj...
PDF
IGCSE ICT - Types and Components of Computer Systems - Main components - Ajir...
PDF
IGCSE ICT - Types and Components of Computer Systems - Hardware and Software ...
PDF
IGCSE ICT - ICT Applications - Ajiro Tech - Part 3
PDF
IGCSE ICT - ICT Applications - Ajiro Tech - Part 2
PDF
IGCSE ICT - ICT Applications - Ajiro Tech - Part 1
IGCSE ICT (0417/0983) - Storage Devices and Media - Ajiro Tech
IGCSE ICT (0417) - Audiences - Ajiro Tech
IGCSE ICT - Input and Output Devices - Output Devices and Their Uses - Ajiro ...
IGCSE ICT - Input and Output Devices - Direct Data Entry (DDE) Devices - Ajir...
IGCSE ICT - Input and Output Devices - Input Devices and Their Uses - Ajiro T...
IGCSE ICT - Types and Components of Computer Systems - Impact of Emerging Tec...
IGCSE ICT - Types and Components of Computer Systems - Types of computer - Aj...
IGCSE ICT - Types and Components of Computer Systems - Operating Systems - Aj...
IGCSE ICT - Types and Components of Computer Systems - Main components - Ajir...
IGCSE ICT - Types and Components of Computer Systems - Hardware and Software ...
IGCSE ICT - ICT Applications - Ajiro Tech - Part 3
IGCSE ICT - ICT Applications - Ajiro Tech - Part 2
IGCSE ICT - ICT Applications - Ajiro Tech - Part 1

Recently uploaded (20)

PDF
RMMM.pdf make it easy to upload and study
PPTX
Lesson notes of climatology university.
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Basic Mud Logging Guide for educational purpose
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Computing-Curriculum for Schools in Ghana
RMMM.pdf make it easy to upload and study
Lesson notes of climatology university.
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Complications of Minimal Access Surgery at WLH
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharma ospi slides which help in ospi learning
Anesthesia in Laparoscopic Surgery in India
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPH.pptx obstetrics and gynecology in nursing
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Pre independence Education in Inndia.pdf
Cell Structure & Organelles in detailed.
O5-L3 Freight Transport Ops (International) V1.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Abdominal Access Techniques with Prof. Dr. R K Mishra
Module 4: Burden of Disease Tutorial Slides S2 2025
Renaissance Architecture: A Journey from Faith to Humanism
Basic Mud Logging Guide for educational purpose
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Computing-Curriculum for Schools in Ghana

IGCSE ICT (0417/0983) - Databases - Ajiro Tech

  • 1. DATABASES Ajiro Ndi Designed by Certified Cambridge ICT Teacher and Examiner
  • 2. TABLE OF CONTENT Create a database structure Manipulate data Present data
  • 3. CREATE A DATABASE STRUCTURE Teacher ID Forename Surname Subject 001 Ajiro Ndi ICT 002 Amina Yusuf Maths 003 Farah Ahmed Physics 004 Ibrahim Khalid English 005 Hassan Ali Geography 006 Gideon Sunday Chemistry 1 WHAT IS A DATABASE? A database is an organised collection of data. A database program is software which stores and retrieves data in a structured way. This includes the data that is stored and the links between the data items. All databases store data using a system of files, records and fields: A field is a single item of data, such as a forename or date of birth. Each field has a field name that is used to identify it within the database. Each field contains one type of data, for example numbers, text or a date. A record is a collection of fields, for example, all the information about one person or one item. These may contain different data types. A file (in database terms) is an organised collection of records, usually where all the records are organised so that they can be stored together. A file can have one or more tables within it. Although all databases have these three elements in common, there are two types: flat-file databases relational databases. AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi FLAT-FILE DATABASES A flat-file database stores its data in one table, which is organised by rows and columns. For example, in the following database about teachers, each record (row) in the table contains data about one person. Each column in the table contains a field, which has been given a field name, and each cell in that column has the same, predefined data type. Field name Records Fields RELATIONAL DATABASES A relational database stores data in more than one linked table, stored in a file. Relational databases are designed so that the same data is not stored many times.
  • 4. Teacher_ID Forename Surname Subject Student_ID Student_FName Student_SName AND Ajiro Ndi ICT G12345 Jasmine Hall AND Ajiro Ndi ICT G12346 James Ling AND Ajiro Ndi ICT G12348 Addy Paredes AND Ajiro Ndi ICT G12349 Hayley Lemon AND Ajiro Ndi ICT G12351 Jennie Campbell KEO Kelechi Okpara Biology G12345 Jasmine Hall KEO Kelechi Okpara Biology G12348 Addy Paredes KEO Kelechi Okpara Biology G12349 Hayley Lemon JKW Jennie Kwong English G12345 Jasmine Hall JKW Jennie Kwong English G12349 Hayley Lemon JKW Jennie Kwong English G12351 Jennie Campbell GSD Gideon Sunday Chemistry G12346 James Ling GSD Gideon Sunday Chemistry G12351 Jennie Campbell SJR Sarah Jordan English G12346 James Ling SJR Sarah Jordan English G12348 Addy Paredes 2 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Each table within a relational database will have a key field. The relationships linking the tables use these key fields. KEY FIELDS Most tables will have a primary key field that holds unique data (no two records are the same in this field) and is the field used to identify that record. Some tables will have one or more foreign key fields. A foreign key field in one data table stores values from a primary key field in another table. PRIMARY AND FOREIGN KEY FIELDS Using the earlier example, if we wanted to add to the table the names of each student taught by each teacher using a flat-file database, the table would look like this: If the data is split into two tables – one for the teachers and one for the students – that are linked together, it can be stored and retrieved more efficiently, like this: Teachers table: Teacher_ID Forename Surname Subject AND Ajiro Ndi ICT KEO Kelechi Okpara Biology JKW Jennie Kwong English GSD Gideon Sunday Chemistry SJR Sarah Jordan English Students’ table: Student_ID Student_FName Student_SName English maths Science G12345 Jasmine Hall JKW AND KEO G12346 James Ling SJR AND GSD G12348 Addy Paredes SJR AND KEO G12349 Hayley Lemon JKW AND KEO G12351 Jennie Campbell JKW AND GSD These two tables are linked with a ‘one-to-many’ relationship, because one teacher’s record is linked to many students’ records. The primary key fields (which must contain unique data) are the Student_ID and Teacher_ID. ADVANTAGES AND DISADVANTAGES OF USING FLAT-FILE AND RELATIONAL DATABASES There are three common types of changes which can be made to the data contained in a database. Records/data can be added, edited or deleted. Because data is not repeated in a relational database, each change to an item of data or to a record has to be made only once. It is also much easier for users to produce reports from a relational database, where data is held in two or more tables, than from two or more flat-file databases. Although people often think that it is quicker to search using relational rather than flat-file databases, it is not always the case. In some cases, where indexed values are used, it can be true. It depends on the structure of both databases and the quantity of the data being searched. You will need to create both flat-file and relational databases, but the data for these will be provided. You will be using Microsoft Access, which is part of the Microsoft Office suite. When used with a single table Access is a flat-file database, but it can also be a relational database when used with more than one linked table.
  • 5. 3 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi When you create a new database you will set a data type for each field. The data type tells Access how to store and manipulate the data for each field. You will usually decide what data type should be used for each field. in Access an alphanumeric field is called a text field. The three main types of field are alphanumeric, numeric and Boolean. DATA TYPES AND SUB-TYPES Note: While it is listed in the syllabus, in Access ‘percentage’ is not a numeric data sub- type, it is just a formatting option. There are other data types, such as autonumber (which generates unique numbers). Some packages, such as Access, have long and short versions of their data types (for example, long text and short text) but these are still versions of alphanumeric data types. Alphanumeric data can store alpha characters (text) or numeric data (numbers) that will not be used for calculations. In Access this is called a text field. A Boolean (or logical) data type stores data as -1/0 but can display it as Yes/ No (or True/False, -1/0). A numeric data type (as the name suggests) is used to store numeric values that may be used for calculations. This does not include numeric data such as telephone numbers, which should be stored in an alphanumeric data type. In Access this is called a number field. There are different types of numeric field including: integer sub-type, which stores whole numbers. In Access you can select an integer field or a long integer field. It is wise to use a long integer field if it is going to contain three or more digits Note: Microsoft Excel is not suitable for database tasks as you cannot define data types. Note: The data types that you select when creating your database will restrict what data can be stored in your database. If you set a numeric field to be an integer (with 0 decimal places), then import data with 2 decimal places, like 45.87, Access will only store 45. The rest of the data will be lost and cannot be recovered. It is important that you chose your data types very carefully. decimal sub-type, which will allow a large number of decimal places, or a specified restricted number if this is set in the field properties when the database is created currency sub-type, which will allow currency formatting to be added to the display. This includes currency symbols and regional symbols. The database does not store these symbols as this would use up valuable storage space date and time sub-type, which stores a date and/or time as a number.
  • 6. Field name Data type Who manufactured the car? Text Model Text Colour Text Price that we bought the car for Numeric/Currency/2 decimal places Price that we will sell the car for Numeric/Currency/2 decimal places Year Numeric/Integer Extras Text Does the car need cleaning? Boolean/Logical Note: 4 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi You work for a small garage called ‘Dodgy Dave’s Motors’. This garage sells used cars. Using a suitable database package, import the file cars.csv. Assign the following data types to the fields. Some field names are inappropriate. Create appropriate and meaningful field names for those fields. You may add another field as a primary key field if your software requires this. Save the database. It is important to make sure that you use the field names exactly as given in a question, unless you are asked to provide appropriate and meaningful field names. In this question you are asked for appropriate and meaningful field names, so start by looking at the detailed descriptions given instead of the field names, or even examine the data to work out what information each field contains For this question, the descriptions help you to work out meaningful field names. These should always be short enough to allow printouts to fit easily on to as few pages as possible. The first example is Who manufactured the car?; this could be shortened to Manufacturer or even Make. Make is short, meaningful and appropriate, so use that. Price that we bought the car for could be changed to Purchase Price, Purchase, P Price, P_Price or just PPrice. Although Access will allow any of these, do not use field names with spaces in them, as they may cause problems if you try to do more complex operations with the database. You could use any of the other three options, as all would be acceptable. For this question, use PPrice. Similarly, the next field can be called SPrice. Consider the final field, Does the car need cleaning?. Simply using the fieldname Clean could give the wrong idea, as it could mean ‘Does the car need cleaning?’ or ‘Is the car clean?’. It is sensible to plan this and make the changes in the .csv file before importing the data into Access. so lets use Valet
  • 7. 5 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi CREATE A FLAT-FILE DATABASE FROM AN EXISTING FILE IMPORT DATA FROM EXISTING FILES To import the file cars1.csv (remember, we saved it with a new filename in an earlier section) for the task, select the External Data tab. In the Import & Link section, click on the New Data Source icon, then from the drop-down menu select From File. From the sub-menu select the option for Text File as files saved in .csv format are text files with each data item separated from the next by a comma.
  • 8. 6 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi The Import Text Wizard window will open. As comma separated value (.csv) files are delimited files (the comma is the delimiter), select the Delimited radio button For the next part of the wizard, make sure that Comma is selected using the radio buttons (unless you have changed the .csv file so that it uses semicolons as delimiters). Examine the first row of the data and decide whether this row contains the field names that you need or if it contains the first row of data. If the first row contains the field names click on the First Row Contains Field Names tick box. As you tick this box, the first row changes from 9 to 10 SET APPROPRIATE DATA TYPES Check that all the field names and data types match those specified in the task. In this case the PPrice, SPrice and Valet fields do not have correct data types. The PPrice and SPrice fields need to be changed to numeric (currency) fields and the Valet field needs to be changed to a Boolean (Yes/No) field. Ensure the Code Page is set to Western European Windows and the Date order is in DMY
  • 9. Note: 7 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi In the next screen, ensure that the radio button for Let Access add primary key is selected – this adds a new field called ID to the table; Access will use this as the primary key field. in the Import to Table: box, enter tblCars. This is a meaningful table name as ‘tbl’ shows you that it is a table and ‘Cars’ gives relevance to the data. The icon in the Views section of the Home tab will let you change between Datasheet and Design View. EDIT DATA TYPES Changes to the data types, or other properties, can be made from the Home tab. In the Views section click on the Design View icon. SET THE NUMBER OF DECIMAL PLACES The task instructed you to set the PPrice field to two decimal places. You can check this by clicking the left mouse button in the PPrice field and viewing the number of Decimal Places in the General tab at the bottom of the window.
  • 10. Note: 8 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi SET THE DISPLAY FORMAT OF BOOLEAN FIELDS To change the Boolean field so that it displays Yes or No (note, it does not store the data like this), click in the Valet field. In the General tab, select the Format cell. Use the drop-down list to select the Yes/No option. If you need percentage values, set an integer or long integer data type and select Percentage from the Format drop-down menu for this field. You work for a shop selling office supplies called ‘Easy as ABC’. Using a suitable database package, import the file stationery.csv. Use these data types for each field. Field name Data type Code Numeric/Integer Type of product to be sold Text Description of the product to be sold Text Quantity of items in each pack Numeric/Integer Colour Text Sales price Numeric/Currency/2 decimal places Purchase price Numeric/Currency/2 decimal places Discount Boolean/Logical Some field names are inappropriate. Create appropriate and meaningful field names for those fields. Use the Code field as your primary key. Save the database.
  • 11. Make Model Colour PPrice SPrice Year Extras Valet Ford Focus Silver 1350 2285 2008 Alarm Central Locking Alloy Wheels Yes Note: Note: 9 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi ENTER DATA USING A TABLE Data is normally entered into a database using a form but, if a form is not asked for, it may be quicker to use the table to enter new data. Open the database that you saved in Question 1. Add this new car to the database. Once you open the database saved in Question 1, First click on Enable Content button To open the table in Datasheet View, double click the left mouse button on the table name. To make sure that all the columns are fully visible, click the left mouse button on the grey square to the left of the ID field name to highlight the entire datasheet. Move the cursor between two field names until it looks like this and then double click. This will adjust the display widths of the columns. Scroll down the list of cars until you reach the entry with a star next to it, which will allow you to add a New car at the bottom. Do not attempt to enter any other characters, such as the currency symbol. As you press the Enter key after adding the prices Access will set the data into currency format. For other data each time you press the Enter key, Access automatically saves the changes you made to the data. Check your data entry carefully using visual verification. This is when you compare the original data on paper (in this case, in Question 2) with the data that you have entered into the computer. Data entry errors in a database may cause problems when you try to use the database to search or sort.
  • 12. 10 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi ADD A FIELD TO AN EXISTING TABLE Data is normally entered into a database using a form but, if a form is not asked for, it may be quicker to use the table to enter new data. Open the database that you saved in Question 2. Add a new field to the database called PDate. Add the purchase date of 20 December 2020 for the last car added to the database. Save the database as Question 3. Open the database and open the table tblCars in Design View. Move to the empty row below the Valet field and enter the Field Name PDate. In the Data Type box use the drop-down list to select the Date/Time type. Choose the most appropriate Format for the task. In this case, the task asks for a Long Date format. Save the database as Question 3 and select the Datasheet View. Move the cursor into the PDate field for the new record (the Silver Ford Focus) and use the Calendar icon to select the correct date. You may need to double click to the right of the PDate column to widen the column. Open the file saved in Task 1. Add these three items of stationery to the database. Code Type Description Quantity Colour SPrice PPrice Discount 44282 Lever Arch File Laminated Lever Arch Files 1 Red 57.22 28.96 No 44283 Lever Arch File Laminated Lever Arch Files 1 Yellow 57.22 28.96 No 47478 Spine Label Eastlight Spine Labels 100 30 13.86 Yes
  • 13. Field name Data type SCode Text FName Text SName Text Subject Text Room Numeric/Integer Select the Database Tools tab, locate the Relationships section, then click on the Relationships icon. Next 11 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi CREATE A RELATIONAL DATABASE You work for Ajiro Tech British School. You will edit some data about the Mathematics Faculty. Using a suitable database package, import the file teachers.csv. Use these field names and data types: Set the SCode field as a key field. Import the file students.csv as a new table in your database. Set the Student_ID field as a key field. Create a one-to-many relationship as a link between the SCode field in the Teachers’ table and the Maths field in the Students’ table. Use the techniques you practised in Question 1 to import the two tables into the database so that each table looks like this. This window shows the link between the fields in both of the tables. The bottom of the window displays the type of relationship that you have created. A screenshot of this window taken with <prt sc> key or snipping tool will copy this into the clipboard. Paste this into the document that you will present as evidence of your method. When you click <create> the window will disappear and the Relationships tab will look like this.
  • 14. In this relationship SCode is the primary key field in tblTeachers and Maths is the foreign key field in tblStudents. If you wish to view or edit the relationship again, you can double click the mouse on the relationship line that joins the two tables. Field name Data type Order_No Numeric/Integer Customer_No Text Product_Code Numeric/Integer Units_Sold Numeric/Integer Field name Data type Customer_ID Text Name Text Address_1 Text Address_2 Text Address_3 Text Zip_Code Text Discount_% Numeric/2 decimal places 12 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file saved in Task 2 Import the file orders.csv. Use these field names and data types: Assign a new field as a key field. Import the file customers.csv. Use these field names and data types: Set the Customer_ID field as a key field. Create a one-to-many relationship between the Code field in the Stationery table and the Product_Code field in the Orders table. Create a one-to-many relationship between the Customer_ID field in the Customers table and the Customer_No field in the Orders table. Take screenshot evidence showing the: field names and data types used in these two tables relationships between the three tables. CREATE A DATA ENTRY FORM Open the file saved in Question 4. Add new data entry forms to collect data for all fields in both of the tables. Open the file saved in Question 4. The best way to create a data entry form is to select the Create tab, then in the Forms section, click on the Form Wizard. The Form Wizard window opens. Select the table that holds the fields that you will include in the form. If the form needs fields from more than one table, then select a query (you will use these later in the chapter). We will create the first form by selecting tblStudents, so leave that selected in the top selection box. You can move each field across into the form using the single arrow key, but, as you want all the data from this table on the form, use the double arrow key. Go to the first record Current record Next record Last record New record
  • 15. 13 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Repeat this process for tblTeachers to create the second data entry form, which should look like this. The data entry form may need editing to make it easier for a different target audience to use. Using short and meaningful field names to store the data may not be easy for other users to understand, particularly if they do not work with databases regularly. For example, if children were to add their data, simple questions would be better than encoded field names, along with instructions on how to complete the form. EDIT A DATA ENTRY FORM Open the file saved in Question 5. Edit the data entry form for student data to make it easier for students to enter their own data. Open the database saved in Question 5. Double click the left mouse button on frmStudents, which is in the list of database objects under forms, on the left. Select the Home tab, then the drop-down arrow in the Views section to get the drop- down menu for the different ways of viewing the form. Select Design View. This will open the Property Sheet pane for the current object. Move the cursor into the Form Header and click on the outline of the text box so that it changes to orange. Click on the Shutter Bar Open/Close Button to hide the ‘Navigation pane’, giving you more room to work. The tab will change automatically to Design. From the Tools section of this tab, select the Property Sheet icon. Highlight the text in this label box and change it to a more suitable heading. If the text does not fit in the label box, grab the drag handles and make it larger. You may not be able to see the lower drag handles; if you need to use them, drag the Detail bar down slightly, but remember to move it back up again later.
  • 16. Open the database. Remember you hid the Navigation Pane. Restore it using the Shutter Bar Open/Close Button arrow. Open tblStudents in Design View. In the blank row below the ‘Science’ field, enter the Field Name, Year_Group (you cannot shorten it to Year as this is a reserved word in Access – try it and see …). The Data Type always starts in Short Text format; click on that cell and use the drop-down menu to select Number. 14 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi If you wish to change the font, colours or formatting of the text (or any other form element) this can be done in the Property Sheet. In this example, Text Align has been changed to Center. The Fore Color and Back Color have also been changed by clicking on them, then by choosing colours from the palette. In the Detail row each field has two boxes. The left one is the label box. This is what is displayed to the user. The right box is a text box and this is joined to the data table. This box is where, when the form is displayed in Form View, the user will enter the data. Select each label in turn and edit the text so it is more meaningful for the students. You may need to resize some of the label boxes so that all the text fits. Each box has a large drag handle in the top left corner that will allow you to drag the box around the form to rearrange the form without resizing the box. This is useful if you are creating your form to a particular design. From the Views section of the toolbar, use the drop-down arrow under the View icon to select Form View like this. ADD A NEW FIELD TO AN EXISTING FORM Type the field description into the Description box (copy the text from the table in the question). This helps to document the database. In the blank row below this, add the new Field Name, Tutor. Leave the Data Type as Short Text. Type the Description, again using the text from the task. To help improve the form and to save lots of storage space, we know that the tutors’ initials are three characters in length. In the General tab at the bottom, set the Field Size to 3. Open frmStudents in Design View. Pick up the top of the Form Footer and drag it down to give enough room to add the two new fields. The Year_Group field could appear on the form as a text box but, as this data can only hold five possible values (because Ajiro Tech British School only has years 7, 8, 9, 10 and 11) it would be a suitable field for radio buttons (Access calls these Option Buttons) within an option group. From the Form Design tab, in the Controls section, select the Option Group icon. You may need to use the drop-down menu to find it. Open the file saved in Question 6. Two new fields are to be added to the students’ data. Use these field names, data types and field descriptions: Field name Data type Description Year_Group Numeric/Integer The school year between 7 and 11 inclusive Tutor Text The name of the student’s tutor
  • 17. 15 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi EDIT A DATA ENTRY FORM Use radio buttons Drag the frame for the Option Group into the Detail section of the form, clicking the left mouse button once; this action will open the Option Group Wizard window. Enter six Label Names, one item on each row – in this case Year 7, Year 8, Year 9, Year 10, Year 11 and an additional option for ‘No year group selected’ – before clicking on <Next> In the next window choose the top radio button option for Yes, the default choice is: and select the option you typed in for No year group selected. Click <Next>. Each label has a value assigned to it. Access has tried to assign values for you, but you need to change all the settings in this example. For Year 7 set the value to 7, Year 8 set to 8, and so on. For No year group selected set the value to 0. When you have changed all of the values click . In the next window, change the radio button from the top option to Store the value in this field:. Using the drop-down menu to the right, select the Year_Group field. This will make sure that, when a radio button is selected, the value for that radio button is stored in the correct field, Year_Group, within the table. Click <Next> to choose the style of options selected (radio buttons (which the software calls option buttons), tick/check boxes, or toggle buttons) and to choose how the Option box will appear on the form. Make your choices, then click <Next> . Give the frame a meaningful caption such as Which year group are you in? before selecting <Finish>. The option block will look similar to this in Design View. To add the Tutor field to the form, select the Text Box icon from the toolbar. Drag the text box for the Tutor field on to the form; you do not need much space as this field only needs to hold three characters. Click the cursor on the Unbound text box and, within the Property Sheet for this control, select the Data tab. In the Control Source box, use the drop-down menu to select the Tutor field.
  • 18. 16 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi The text box changes from unbound to show the Tutor field. The text boxes for English, Maths and Science are also too large as they can only contain three-lettered staff codes, so reduce these three field sizes together by selecting all three text boxes together and dragging the right edge in so that they match the Tutor field. Save the database as Question 6. The finished Design view and Form view look like this. Resize the label box on the left and add the text Tutor as the label. WHAT DOES A WELL-DESIGNED FORM LOOK LIKE? The most important feature of form design is to keep the form simple, with clear questions, using closed questions where possible. This will limit the different answers to be stored in the database and will make it easier to search the database. A well-designed form has similar fields grouped, but not crowded, together, with white space between each data entry box. The form has a title that states what data is being collected. Each field has appropriate space for the data that will be added, and there is space between each field. The form has been appropriately filled by the text boxes but there is enough white space to keep it from being overcrowded. Radio buttons (or drop-down menus) are used where possible. There are navigation buttons on the form (already added by Access) to allow a user to add new records and move between records. In Design View of the form, move and resize the controls so that your form looks like the diagram above. Change the text to be right aligned text in each of the label boxes. Re-save the database. Use drop-down menus It is often easier for the user of a database to use a drop-down menu to select data rather than typing each data item every time. These can only be used when there are a limited number of possible entries for a field, so fields containing data such as names could never use drop-down menus – unless they contained every name in the world, which would not be practical.
  • 19. Combo box List box 17 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file saved in Question 7 Change the Tutor field so that the user can select their tutor from the list of staff codes in tblTeachers. Open the file saved in Question 7 and open frmStudents in Design View. Delete the controls for the Tutor field (both the label and text box). You will replace the text box with another type of control. From the Form Design tab, in the Controls section there are two suitable options, a combo box or a list box. If you wish to allow the user to type new items into the drop-down list then a combo box would be suitable, but for this task, where you do not want the user to be able to add to the list items, select a List box. Drag the control onto the form. The List Box Wizard window opens. Select the radio button for I want the list box to get the values from another table or query, as the data is held in the teachers table. Click on <Enter>. In the next window select Table: tblTeachers then click on <Enter>. Double click the left mouse button on the SCode field to move it from the ‘Available fields:’ to the ‘Selected fields:’, then click <Enter>. In the next window select Table: tblTeachers then click on <Enter>.
  • 20. 18 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Select the SCode field in box 1 and make sure that the ‘Ascending’ button is visible, to show the list in alphabetical order. Click <Enter>. Adjust the SCode column width using the drag handle, then click <Enter> . The value that you select will need to be stored in the Tutor field so select from the Store that value in this field: drop down menu the option for Tutor. Click on <Next>, then change the label for the list box name from the suggested name to Tutor, then click on <Finish>. Resize/move the controls and change the alignment of the text in the label to right aligned so that it matches the other labels. Save the database as Question 8.
  • 21. MANIPULATE DATA Open the file that you saved at the end of Question 3. A customer would like a car made by Ford. Find the customer a list of all the cars in the garage made by Ford. Open the database that you saved at the end of Question 3. You do not need to open the table that you created earlier. Select the Create tab and find the Queries section. Click on the Query Wizard icon. Note: If you select a previous query rather than the table, you are likely to get incorrect results. 19 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi PERFORM SEARCHES You can search for data in Access using a query. This allows you to select a subset of the data stored in your table. Each query is created, saved and can be used again later. If new data is added to the table, when you open a query again it will select the subset from all the data, including the new data. This is the easiest way of performing a search and opens the New Query window. Select the Simple Query Wizard and click on OK . In the Simple Query Wizard window, make sure that the correct table name has been selected in the Tables/Queries box. As this is your first query this is the only option in this box, but each time you create a new query it will be shown here. For this question it would be appropriate to show the customer all the fields except the ID field, the price that the garage bought the car for (the PPrice field) and the date the garage purchased the car (the PDate field). Move all of the fields into the query using the double arrow key. Select the ID field, the PPrice field and the PDate field in turn and click on the single arrow to remove them from the selection. You need to enter a name for the query. This query may be turned into a report at some point and the name you give the query may become the title for the report. Select the radio button for Modify the query design, then click on <Finish>. This opens the query in Design View. Datasheet View can be seen at any time by selecting the drop-down list under the View icon. However, at the moment the query will still contain all of the records as you have not yet performed the search, so make sure you are in Design View .
  • 22. Note: Note: You do not need to use speech marks as Access will put these in for you. This will extract only the cars made by Ford. 20 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi To perform the query, move the cursor into the Criteria: row of the Make field and type in Ford. Now select the Datasheet View to see the results of the query. The number of records can be seen at the bottom of the window in this view. There should be 25 Ford cars in the query. Open the file that you saved at the end of Question 9. The manager would like to see all the details of all the Fords that need valeting. Create a query in a similar way to the one for Question 9. Make sure you have tblCars selected and not your Ford query. Select all the fields and, when in Design View, enter Ford in the Criteria: row of the Make column and Yes in the same Criteria: row for the Valet column. The selection will look like this and only two cars will be found using this search. This is called an AND Query, because the Make has to be Ford AND the Valet field has to be Yes. Open the file that you saved at the end of Question 10. The manager would like to see all the details of all the cars made by Ford or Vauxhall. Create a query in a similar way to the one for Question 10. In the Simple Query Wizard window, make sure that the correct table name has been selected in the Tables/Queries box. If you select one of the previous queries rather than the table, you are likely to get incorrect results.
  • 23. Note: Note: Note: 21 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Select all the fields and, when in Design View, enter Ford or Vauxhall in the Criteria: row of the Make column. The selection will look like this. Another way of doing this is to type Ford in the Criteria: row and Vauxhall in the or: row. Open the file that you saved at the end of Question 11. The sales manager would like to see details of all the cars in stock not made by Ford. 37 cars will be found using this search. Create a query in a similar way to the one for Question 11. Select all the fields and, when in Design View, enter Not Ford in the Criteria: row of the Make column. The selection will look like this. Another way of doing this is to type <> Ford in the Criteria: row 43 cars will be found using this search. Open the file that you saved at the end of Question 12. The manager would like to see all the details of all the cars that have alloy wheels. By examining the data in the database, you can see that the text ‘Alloy Wheels’ could appear in the Extras field. It may not be the only extra that a car has – there could be other extras listed before it or after it within the field. To find all the cars with this extra you must create a query in a similar way as for Question 11. Select all the selected fields and, when in Design View, in the Criteria: row of the Extras column, enter the text *Alloy Wheels*. The stars tell Access that you are performing a wildcard search. This is a search which looks for the words ‘Alloy Wheels’ (including the space) anywhere in the Extras fields’ contents. To search for something that is at the start of the data, use Text*; for example, Bl* in the Colour field will find all the cars with the first colour Blue or Black, but would not find colours such as Light Blue. Placing the star at the start of a search string will only find those things ending with the search string. 35 cars will be found using this search.
  • 24. Note: 22 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file that you saved at the end of Question 13. The sales manager would like to see details of all the cars in stock for sale for less than or equal to £4125. Create a query in a similar way as for Question 13. Be careful not to use symbols such as < or £ in the query name. Select all the selected fields and, when in Design View, enter <=4125 in the Criteria: row of the SPrice column. 19 cars will be found using this search. Similar mathematical formulae can be used, with < for less than, > for greater than, >= for greater than or equal to, and = for equals. These mathematical formulae cannot be used for queries involving text fields but can be used for any numeric, date or time fields. Open the file that you saved at the end of Question 8. Find Mr Varela a list of all the students that he teaches for Maths; include in this extract his full name and teaching room. Open the database that you saved at the end of Question 8. Create a new query using the Query Wizard. This is the easiest way of performing a search and opens the New Query window. Select the Simple Query Wizard then, in the Tables/Queries box, select the table tblTeachers. Move across to the right to the FName, SName and Room fields. Move back into the Tables/ Queries box and select the table tblStudents. Select the Student_Fname, Student_SName and Maths fields by moving them from Available Fields: to Selected Fields: Click on <Next>. Continue through the wizard until you get to the query in Design View.
  • 25. 23 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Move the cursor into the Criteria: row of the Maths field and type in AVA. Open the query in Datasheet View to check that you have done the query as specified. The Maths field does not need to be shown; to hide it (do not delete it or the selection of the data will also be lost) move back into Design View. Move the cursor into the Show: row of the Maths field and remove the tick from the check box. This field is present in the query but will not be shown. This query should return 31 records. Open the file saved in Task 3. Search the database to find the following information for your manager. For each search, show how you performed the search and the results of the search; the results must show all the fields in the stationery table. Find all of the blue stationery items. Find all of the blue or black stationery items. Find all of the items where the colour is not blue. Find all of the red items where the discount is ‘yes’. Find all of the items where the type contains the word ‘file’. Find all of the items where the description contains the word ‘file’. Find all of the items with a quantity of less than or equal to 10. Find all of the items where the quantity is 10. Find all of the items with a quantity of greater than 1. Find all of the items with a quantity of greater than or equal to 10. Find all of the items where the sale price is less than £10. PERFORM CALCULATIONS Use formulae in queries You are sometimes asked to perform calculations at run time. This could be done in one of two ways. The first method is by creating a calculated field, so that each record has a calculation performed on it and the results are stored in a query. The other method is to calculate on all (or a selection of) the records, for example to add (sum) the data from a number of records.
  • 26. Then click on <Next>. In the Tables/ Queries box select the table tblCars as the source of the data. Select all fields using the double arrow key. Click on <Next> twice, name the query Profit calculation, select the radio button for Modify the query design, then click on <Finish>. In the Design View of the query, use the bottom scroll bar to scroll to the right and find the first blank field Note: Note: 24 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file saved in Question 14. Produce a new extract from all the data that: contains a new field called Profit which is calculated at run time – this field will subtract the purchase price from the sale price contains a new field called Percent to calculate the percentage profit for each car at run time. This field will divide the profit by the sale price. To create a field that is calculated at run time, you must first open a query. For this question the query will not be used to search for data but to perform the calculation. Select the Create tab, then click in the Queries section on the Query Wizard icon; select the Simple Query Wizard. Move the cursor into the Field row for the first blank field. Enter the name Profit that you wish to give this calculated field followed by a colon. The colon tells Access that the next section is a calculation. Within the calculation, you must place square brackets around each field name so that Access looks up the data from the relevant field. For this question, you need to subtract the purchase price from the sale price. The finished calculation will appear like this. You can use the builder to achieve this Use + for addition, - for subtraction, * for multiply and / for divide. In the Views section, select the Datasheet View. Calculate the profit for three or four cars by hand or using a calculator and compare with the results in the query to check that you have entered the formula correctly.
  • 27. 25 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi The question requires you to create a second calculated field, so it would be sensible to include the new field now and complete the formatting later. To create a new field called Percent, follow the same procedure, this time adding a formula to divide the profit by the purchase price. Again, check the calculations with a calculator to ensure that you have not made an error when entering the formula. When you have calculated this field and view the query in Datasheet View, you may see the values displayed as #####. This means the column is too narrow to see all the data. Drag the right column handle to the right so that the data is fully visible. Save the database and close the query. Open the file saved in Task 4. Produce a new extract from all the data in the stationery table that: contains a new field called Profit which is calculated at run time – this field will subtract the purchase price from the sale price contains a new field called Percent to calculate the percentage profit for each car at run time – this field will divide the profit by the sale price contains a new field called UnitProfit – this field will divide the profit by the quantity. For each calculated field, show how you performed the calculation and the results of the calculation. Open the file saved in Question 16. Select only the cars made by Audi, BMW or Mercedes. Produce a new extract from all the data which, for the each of these makes of car, calculates: the sum of the sale price the average sale price the number of cars in stock. Sort this data into descending order of average sale price. This question requires the use of summary data. Open the file and, from the Create tab, select the Query Wizard, then the Simple Query Wizard followed by <Next>. In the Tables/Queries box select tblCars and from this table select only the Make and SPrice fields before clicking on <Next>
  • 28. 26 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Click the radio button for Summary data, then select the Summary Options… button. This opens the Summary Options window. To calculate the sum of the sale prices, tick the check box for Sum. For the average sale price, tick the check box for Avg. For the number of cars in stock tick the check box for Count records in tblCars. Click on the <ok> button followed by <Next>. Add a new title for the query, such as your name followed by Summary data for Audi or BMW or Mercedes query. Select the radio button for Modify the query design, then click on <Finish> to enter Design View. Enter in the Criteria: row of the Make column the text Audi or BMW or Mercedes. SORT DATA IN QUERIES This data is sorted into ascending order of Make, but the Question required you to sort this data into descending order of average sale price. Select the Home tab, then click on the column heading for Avg of SPrice. In the Sort & Filter section, select the descending sort icon
  • 29. 27 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file saved in Task 5. Select all types of items, except for any binder. Produce a new extract from all of the stationery data which, for each type of item, calculates: the average purchase price the average sale price the number of items in stock. Sort this data into descending order of average purchase price. Show how you performed the summary query and the results of the calculations. PRESENT DATA PRODUCE A REPORT The word ‘report’ can be quite confusing. A dictionary definition is ‘a document that gives information about an investigation or a piece of research’. For our purposes, a report has this generic meaning: ‘a document that gives information’. This is often confused with a report created in Access. The report created in Access will often be the most suitable report for questions and tasks, but sometimes it may be better to produce a report in a word processor, copying and pasting information into a document. For each task you will need to decide which method is the most suitable. Open the file saved in Question 17. Produce a report that: shows all of the cars made by Ford displays only the Make, Model, Colour, SPrice, Extras and Valet fields within the width of a landscape page has the text ‘Report by’ and your name on the left in the header of each page has a title ‘All Ford cars in stock’ centre aligned at the top of the first page has a subtitle ‘request for Mr David Watson’ right aligned, in red, at the top of the first page.
  • 30. Note: Note: 28 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the database saved in Question 17. Select the Create tab and find the Reports section. Click on the Report Wizard icon to open the Report Wizard window. You must create the query first and then base the report on the query. In the Tables/Queries box you need to select the correct query. For this question the report will be based on the query to select only the Fords (you created this query in Question 9). Use the arrow buttons to move the fields required by the question from Available Fields: into the Selected Fields: If a question asks for specified fields (as this task asks for ‘displays only the Make, Model, Colour, SPrice, Extras and Valet fields’) make sure you do not add extra fields. Make sure that you also place the fields in the order specified in the question. Click on <Next>. Grouping is not needed at this level, so click on <Next> again. You have not been asked to sort the report for this question (this is covered later in the slide), so click on <Next> again to get this Report Wizard window. Use the Layout section to choose how the page will be laid out; in this case a Tabular format has been selected. The question asked you to select a single landscape page. The page orientation is chosen using the Orientation radio buttons. Select Landscape then click on Change the report name so that it reads ‘All Ford cars in stock’ (which is the title from the task). As you still need to add the subtitle and ensure that the layout is correct, select the Modify the report’s design radio button and click on <Next>. The Design View of the report will look similar to this.
  • 31. 29 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi If you had selected different layout options such as justified, or columnar, the first page of each report would look similar to this. justified columnar Each section of the report is shown with a light grey bar. The top section is the Report Header. Anything that you place in this section appears only once at the start of the document. Anything that you place in the Page Header is shown at the top of each page, in this case the field names. Similarly, information in the Page Footer is shown at the bottom of each page. The Report Footer appears at the very end of a report, although in this example the Report Footer is empty (it is not shown in white) and therefore will not be shown in this document. The Detail section is the most important, as this single row is where the data is shown for each car. This single row will appear as many rows (as many as there are Ford cars in the database) and display the details of each record. Open the database that you saved in Task 6. Produce a report that: displays all the data in the stationery table within the width of a landscape page has your name on the right in the header of each page has a title ‘All stationery in stock’ centre aligned at the top of the first page has a subtitle ‘request for the manager’ right aligned at the top of the first page.
  • 32. 30 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the database that you saved at the end of Question 18. Produce a report that: displays all the data for the Make, Model, Colour, SPrice, Year and Extras fields for all the cars with alloy wheels from Question 12, within the width of a portrait page has your name in the report header followed by ‘Cars with alloy wheels’. Open the file Question 18. Select the Create tab and, in the Reports section, click on the Report Wizard icon. In the Report Wizard window, in the Tables/ Queries box, select the query for alloy wheels (that you created in Question 12). As the question says ‘display all the data’, and specifies the fields, use the arrow buttons to move only these fields from Available Fields: to the Selected Fields: box. Go through the wizard as you did for the previous question, making sure that you set the page Orientation to Portrait. BREAKDOWN You must show all of the required data in full Change to Report View and check that all the data and labels fit within the width of a single page. Other than the Extras field (which holds the most data), We can enlarge the Extras field by making the control for that field twice as deep. Change to Design View and click the cursor on the top edge of the Page Footer. Drag this down about 8mm. In the Detail row, click the cursor on the lower edge of the Extras control. Drag this down to double the height of this control. Change to Report View and check that all the data and labels fit within the width of a single page PRINT PREVIEW: Open the database that you saved in Task 7. Produce a report that: displays the data for all the items where the quantity is greater than or equal to 10, selected in Task 4, within the width of a portrait page has your name in the header of each page has a title ‘Quantity > = 10’ centre aligned at the top of the first page.
  • 33. 31 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi EXPORT DATA Sometimes whole reports, queries or the data within them need to be exported into other packages to be manipulated as part of a report for someone, or to create a graph or chart. Export the report saved in Question 19 into rich text format so it can be included in a word-processed document. In the Navigation pane (on the left side of the window), find the report that you saved in Question 19 and right click the mouse button on the report name to get the drop-down menu. Select the option to Export. This will open another drop-down menu. You need to export into .rtf format, so select Word RTF File. This opens the Export – RTF File window. Click on the <Browse> button to select a folder to save the document into. You will need to use this file for another question, so select the tick box for Open the destination file after the export operation is complete, then click on <OK> . The exported file will appear in Microsoft Word. Close the Export – RTF File window. Note: If you need to export a report without any formatting, select the Text File option Note: If you need to export the data into .csv format (comma separated values), export it first into Excel, then save it in .csv format from Excel. Export the report saved in Task 8 into: rich text format a format that can be used to produce a graph comma separated value format. HIDE DATA IN A REPORT There are times when information in a report needs to be hidden in some way. In real applications a single report would be created for more than one task and some data would be hidden. This process is often done automatically using a created report and a programming language. Although that is beyond the scope of this book, the ability to hide fields within a report is useful. An example of this is when an invoice is produced for a customer and the same document is used as a delivery note, so that it shows the details of the items ordered but the costs are hidden. In Access this can be done in one of two ways: the first is to make a control invisible; the second is to use a background colour that matches the text colour.
  • 34. 32 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Create a new report showing all the data for all the cars in stock made by Audi, BMW or Mercedes. Hide all the labels and data for the ID, Valet and PDate fields from the report. Hide the PPrice data (but not the title) by setting a black background. Using the methods used so far in this chapter, create a new query from tblCars to select the three makes of car. Create a new report set in landscape format to display all fields for these cars, like this. Go into the Design View of the report; holding down the <ctrl> key select all the controls for the ID, Valet and PDate fields. Open the Property Sheet and, in the Visible section, change the setting from Yes to No, which will hide these controls. To set a black background for the PPrice data, in the Detail row of the report select the control for PPrice. Move the cursor into the Property Sheet, selecting the Format tab. Find the Back and Fore Color section and use the <insert> icon to select the colour palette. Select the black colour rather than the white background. Set the Fore Color to black in the same way. Change from Design View into Report View to see the changes. Save the changes to the report and close it.
  • 35. Note: Note: 33 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file you saved in Task 8. Move to All Access Objects and Reports. Use copy and paste to make a copy of the report for the quantity is greater than or equal to 10, before starting Task 10. Open the report created in Task 8. Hide the label and data for the Discount field in the report and hide only the data in the PPrice field by setting a black background. If you wish to change the display formats of any field, this can also be done in the Property Sheet pane using the Format tab. However, it is better to set the formatting for the fields in the Design View of the table as changing the display properties will not change the way that the data is stored, and this could lead to errors if fields are used for calculations. PRODUCE LABELS You may be required to produce other forms of output from your database, for example, producing labels to advertise a product or address labels for mailing letters to customers. Open the file that you saved at the end of Question 20. Find all the cars with a sale price of less than £4000 and, for these cars, produce labels that: have a page orientation of portrait fit two side by side on the page have a 16-point, centre aligned heading ‘Special Offer’ at the top of each label show only the fields Make, Model, Colour, SPrice, Year and Extras, sorted into make and model order have your name at the bottom right of each label. Design a new query to extract only the cars with a sale price of less than £4000, selecting only the Make, Model, Colour, SPrice, Year and Extras fields from the table as you step through the Simple Query Wizard. When you have selected these cars, close the query and click the left mouse button on the query so that it is highlighted like this. From the Create tab, find the Reports section and click on the Labels icon.
  • 36. 34 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi This opens the Label Wizard. Select any label format that contains two labels across the page; in this case, use the Avery J8166 labels as they are slightly larger than some of the other labels (and it is therefore easier to fit all the data and labels on to each label). Click on <Next>. The next screen asks for the font size and colour of the text on the label. Leave this set to a small size (it is easier to enlarge this later, if needed, rather than to reduce it), such as 8 points high. Click on <Next>. Type the text ‘Special Offer’ in the grey area as the top row of the label. Press to move down to the second row. In Available fields: double click on the Make field. Press <Enter> to move to the next line. Add each field in the same way, entering the new line then the field. When all of the fields have been moved across, add a final row with your name, then click on <Next>. Move the Make, then Model fields across into the right to sort the labels by make and model as specified in the question, then click on <Next>. Give the labels an appropriate name and select the radio button for Modify the label design. Click on <Finish>.
  • 37. 35 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi The Design View looks like this. Select all the controls except the one containing the text ‘Special Offer’. Drag these down about 8mm. Move the lower control down the label about 8mm. Select the middle six controls and move the left edge to the right about 25mm. Select the control containing the text ‘Special Offer’ and stretch it down to give it more space. Open the Property Sheet and set the Font Size to 16 and the Text Align to Center. Stretch the Extras field down to give it more space, so that all the data should be visible. This will need to be checked when the labels are produced and edited again if necessary. Your name at the bottom of the label should also be right aligned by setting the Text Align to Right. Check the labels’ layout from the Home tab, using Print Preview to see all the labels set out on the sheet or Report View to see a single label. Save the labels The six middle controls (those containing the fields) need labels. Click on the Design tab and select the label box. Drag the label box out to the left of the Make field, enter the text ‘Make’ and, in the Property Sheet, set the Font Size to 8. Set the Height of this control to the same as the Make field control Copy this control, paste it five times and move the new labels to the left of each field. Edit the text so that each label box shows what the field is. Check the labels’ layout from the Home tab using Print Preview to see all the labels set out on the sheet. If need be, make any adjustments to the controls.
  • 38. 36 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the database that you saved at the end of Task 9. Find all the stationery items where the discount is ‘Yes’ and the sale price more than £30. For these items produce labels that: have a page orientation of portrait and fit two side by side on the page have a 20-point, right-aligned heading ‘Discount Offers’ at the top of each label show only the fields Type, Description, Colour and SPrice, sorted into colour order have your name centre aligned at the bottom of each label. FORMAT REPORTS Open the file saved in Question 22. Using the extract that contains the calculated fields Profit and Percent, produce a new report from all the data that: has the PPrice, SPrice and Profit fields formatted as Euro with two decimal places has the Percent field formatted as a percentage value with no decimal places. Open the file saved in Question 22. Create a new report from all the data in the extract using the Report Wizard. In the Tables/Queries box select the profit calculation query as the source of the data. Select all fields using the double arrow key. Click on <Next> three times. Set the page Orientation to Landscape then click on <Next>. Use Profit calculation as the report title. Select the radio button for Modify the report’s design, then click on <Finish>. Adjust all the field widths so that all the data fits on the page. Move to the Detail row of the report. Hold down the key and select the PPrice, SPrice and Profit field controls. In the Property Sheet select the Format tab and use the drop-down menu in the Format section to select Euro. Move to the Decimal Places section and select 2. Click on the View icon to go into Report View and check that the formatting for these fields is in Euro and contains two decimal places. Repeat this process for the Percent field. Click the left mouse button on the control for Percent in the Detail row of the report. Select the Format tab and use the dropdown menu in the Format section to select Percent from the drop-down list. Move to the Decimal Places section and select 0. Go into Report View to check that the formatting for this field is now correct and contains no decimal places. This is fine, but some field widths may need readjusting so that all data and labels are fully visible. Adjust these before saving the completed report. Note: If a question asks for a currency not held in this drop-down menu, select your local Currency format
  • 39. 37 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file saved in Task 11. Using the extract that contains the calculated fields Profit, Percent and UnitProfit, produce a new report. Apply appropriate formatting to this report. All currency values must be in Euros with two decimal places. All percentage values must be set to one decimal place. FORMULAE IN REPORTS Other calculations may be needed on the data selected. These include calculating the sum (total), average, maximum or minimum values of selected data, or counting the number of items present in the selected data. All of these functions can be produced within a report in Access. Open the file saved in Question 23. Produce a new report from all the data that: displays at the bottom of the report the total profit if all the cars were sold displays at the bottom of the report the maximum, minimum and average profit values displays the number of cars in this report. You can use the Profit calculation report Open this report in Design View. Click the left mouse button on the bottom edge of the Report Footer and drag this down about 2cm, so that this footer is now visible. Select the Design tab, move to the Controls section and select the Text Box icon. Click the left mouse button on the bottom edge of the Report Footer and drag this down about 2cm, so that this footer is now visible. Select the Report Design tab, move to the Controls section and select the Text Box icon Move down into the Report Footer, click the left mouse button and drag to place a new control, in this case a text box, directly below the Profit column. This positioning is important as this control will be used to calculate the total profit for the data in this report.
  • 40. 38 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi Open the file saved in Task 11. Using the extract that contains the calculated fields Profit, Percent and UnitProfit, produce a new report. Apply appropriate formatting to this report. All currency values must be in Euros with two decimal places. All percentage values must be set to one decimal place. FORMULAE IN REPORTS Other calculations may be needed on the data selected. These include calculating the sum (total), average, maximum or minimum values of selected data, or counting the number of items present in the selected data. All of these functions can be produced within a report in Access. Open the file saved in Question 23. Produce a new report from all the data that: displays at the bottom of the report the total profit if all the cars were sold displays at the bottom of the report the maximum, minimum and average profit values displays the number of cars in this report. You can use the Profit calculation report Open this report in Design View. Click the left mouse button on the bottom edge of the Report Footer and drag this down about 2cm, so that this footer is now visible. Select the Design tab, move to the Controls section and select the Text Box icon. Click the left mouse button on the bottom edge of the Report Footer and drag this down about 2cm, so that this footer is now visible. Select the Report Design tab, move to the Controls section and select the Text Box icon Move down into the Report Footer, click the left mouse button and drag to place a new control, in this case a text box, directly below the Profit column. This positioning is important as this control will be used to calculate the total profit for the data in this report.
  • 41. 39 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi If the Properties pane is not showing, right click the mouse button on the text box that you have just created then select Properties from the drop- down menu. In the Property Sheet select the All tab, find the Control Source section and type the formula =SUM([Profit]) into this row. The Property Sheet will change to this. The round brackets are part of the SUM function; the square brackets tell Access that this is a field (in this case the Profit field calculated at run time). Format this control as Euro and set the Decimal Places to 2. Move the cursor into the label for this text box and type in the Caption ‘Total Profit’. This can be entered in the label or in the Property Sheet pane using the Caption Change to Report View and make sure that the control is in the correct place and appears to give the right answer (it is not too large or too small). Rather than repeating this process four more times, it will be quicker to copy and paste these controls and edit each one to give the required results. In the last four controls containing labels, change the Captions to ‘Maximum profit’, ‘Minimum profit’, ‘Average profit’ and ‘Number of cars’. Select the second Text Box (for the maximum profit) and change the formula so that it becomes =MAX([Profit]). Change the formulae for the minimum profit so that it becomes =MIN([Profit]) and for the average profit so that it becomes =AVG([Profit]). In the final control to count the number of cars, change the formula so that it becomes =COUNT([Profit]). In the Property Sheet pane for the final Text Box, change the Format back from Currency to General Number. Set the Decimal Places for this control to 0. Check the layout and calculations in Report View. The completed calculations look like this. Save the report. If you need to show evidence of the formulae that you used, use screenshot evidence of the calculated controls.
  • 42. Note: You created the query in Question 11. To produce this report, select the Create tab and click on the Report Wizard icon. In the Tables/Queries box select the Ford or Vauxhall query. Select all fields using the double arrow key and then click on Next twice to open the Sorting window. Use the drop-down lists to select the Make field, then the Model field and, finally, the SPrice field. For the SPrice field, click on Ascending to the right of this field and it will toggle (change) to Descending. 40 AJIRO TECH - BEST IGCSE YOUTUBE CHANNEL Designed and Presented by Ajiro Ndi If you are using screenshot evidence of calculated controls, make sure that each control is wide enough to show all of the formulae in full. Open the file saved in Task 12. Copy and edit the report which contains the calculated fields to produce one that: displays at the bottom of the report the maximum and minimum percentage profit for all the stationery items in stock displays at the bottom of the report the average profit per item displays the number of items in stock uses appropriate formatting for all data. SORT DATA IN A REPORT Although Access has the ability to sort data in both tables and queries, it is easier to save the sorting until the data is produced in an Access report. When the fields have been set as shown, click on . Set the Orientation to Landscape and run through the final stages of the wizard, giving this report a suitable name. This process is the same for other data types such as dates. Open the file saved in Question 24. Produce a report that: displays all the data for the cars made by Ford or Vauxhall fits within the width of a single page is sorted into ascending order of make and model, then into descending order of sale price has your name in the report header followed by ‘Ford or Vauxhall’. Open the file saved in Task 13. Produce a new report from all the data that: displays all the blue or black stationery items fits within the width of a single page is sorted into ascending order of colour and type, and then into descending order of description has your name in the report header followed by ‘Blue or black stationery items’.
  • 43. Ajiro Tech, led by Ajiro Ndi, is a YouTube channel dedicated to IGCSE education. With nearly a decade of experience, Ajiro Tech offers tutorials on ICT, Chemistry, Biology, Physics, Mathematics etc, helping students excel in their exams. ABOUT US
  • 44. OUR TEAM AjiroNdi ICT IT GideonSunday Chemistry KelechiOkpara Biology