3. Using Databases ENotes
3. Using Databases ENotes
DATABASES
Syllabus 6.0
Learning Material (MS Access 2013)
Provided by:
ECDL Malta
This courseware may be used to assist candidates to prepare for the ECDL Foundation Certification Programme as titled on the
courseware. ICDL Foundation does not warrant that the use of this courseware publication will ensure passing of the tests for that ICDL
Foundation Certification Programme.
The material contained in this courseware does not guarantee that candidates will pass the test for the ICDL Foundation Certification
Programme. Any and all assessment items and / or performance-based exercises contained in this courseware relate solely to this
publication and do not constitute or imply certification by ICDL Foundation in respect of the ECDL Foundation Certification Programme or
any other ICDL Foundation test. This material does not constitute certification and does not lead to certification through any other process
than official ICDL Foundation certification testing.
Candidates using this courseware must be registered with ECDL Malta before undertaking a test for an ICDL Foundation Certification
Programme. Without a valid registration, the test(s) cannot be undertaken and no certificate, nor any other form of recognition, can be
given to a candidate. Registration should be undertaken at an Approved Test Centre.
Databases are crucial tools for storing, managing, and manipulating data. ECDL Using
Databases will help you understand what a database is and what it is used for. This module
will also allow you to demonstrate a range of key skills relating to building and using a
database.
For details of the specific areas of the ECDL Using Databases syllabus covered in each
section of this book, refer to the ECDL Using Databases syllabus map at the end of the
book.
Page vi © 2017
6.6 Applying/Removing a Filter ............................................................................................... 75
6.7 Using Filter Excluding Selection ........................................................................................ 76
6.8 Using the Search Box ....................................................................................................... 77
6.9 Using Quick Filter.............................................................................................................. 77
6.10 Using AutoFilter .............................................................................................................. 79
6.11 Review Exercise ............................................................................................................. 81
© 2017 Page ix
LESSON 1 –
EXPLORING ACCESS
Data is raw, unorganised facts and details. Examples of data that could be stored
in a database are:
Information is the processed output of data. It provides context for data. Examples
are:
Social networks:
Social networks utilise large databases to keep record of user profiles and
corresponding contact and privacy details. They can be used to track the
posts made by users, what they interact with and how long they spend
online.
Page 2 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Government records:
Governments all over the world rely on multiple large databases in order to
function. Tax records, criminal records and social security all require
sophisticated database systems.
Access is a database application that you can use to quickly and easily develop
relational database applications that help you manage information. You can create
a database to help you keep track of just about any kind of information, such as
inventory, professional contacts, or business processes. In fact, Access comes
with templates that you can use right away to track a variety of information,
making things easy even for a beginner.
For example, a database specialist could analyse the data processing and
information needs of a computer training centre and designs a database that
allows the storing of students, trainers and course details.
There are various roles that are assigned to maintain the database, such as:
1) Database administrator:
a) Controls the access to different data for specific users.
b) Implements security measures to safeguard the organisation’s
database.
c) Has overall responsibility for the maintenance and repair of an
organisation’s database.
d) Recovers the database after a crash or major errors.
2) Database user:
a) Enters, updates and retrieves data/information.
b) Granted access rights as needed for basic data entry and search.
© 2017 Page 3
Lesson 1 - Exploring Access ECDL Using Databases
records but cannot access trainers or courses details. The database administrator
may incorporate password protection to sensitive data in the database.
A database user in a computer training centre can access the database based on
the access level granted. Data entry personnel can only enter/edit/search/print
records of students but cannot access trainer details. Managers may have a
higher level of access such as being able to view/edit/search/print records and
reports of students, trainers, and courses.
Steps
To start Microsoft Access 2013:
1. Select Start.
The Start menu appears.
Click
Page 4 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Steps
To open an existing database from a specific drive and folder location:
4. Navigate to the folder that contains the Open the Student Folder
database.
The Student Folder will open.
5. Select the name of the database you Scroll as necessary and click on the file
want to open. LibrarySystem.accdb
The file name is selected.
6. Select Open.
Click
The Open dialog box and Getting
Started task pane close, and the
Security Warning message box
appears below the Ribbon, if
applicable.
© 2017 Page 5
Lesson 1 - Exploring Access ECDL Using Databases
Tip: You can use the keyboard shortcut Ctrl+O to open a database project.
However, the FILE tab still exists, as does a single toolbar called the Quick
Access Toolbar. All the other commands are now found in the various tabs of the
Ribbon within the interface.
The Ribbon is designed to respond to your current task; however, you can
choose to minimise the Ribbon if you find that it takes up too much screen space.
Click the arrow in the lower-right corner of the Ribbon to minimise it. Click a tab to
make the Ribbon reappear. It will disappear again when not in use. To maximise
the Ribbon, click a tab, then click the pin icon in the lower-right corner. The
Ribbon will appear at all times.
Page 6 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Contextual tabs
Steps
To use a contextual command tab:
1. Open the desired table from the Double-click Assets Table in the
Navigation Pane. LibrarySystem Database.
© 2017 Page 7
Lesson 1 - Exploring Access ECDL Using Databases
Clicking the Customize Quick Access Toolbar button at the right end of the
Quick Access Toolbar displays a menu that lists commonly used commands.
Check marks appear to the left of commands currently available on the Quick
Access Toolbar. You can click these commands to remove them, and click other
commands to add them.
Page 8 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Tables: The basic building block of any database is a table. A database table
is similar in appearance to a list or spreadsheet, in that the data is
stored in rows and columns.
Queries: Queries allow users to locate data from one or more tables
according to specific search criteria. The data you want to retrieve
may be stored in several tables, and a query allows you to view data
from several tables in a single datasheet. In addition, because you
generally do not want to see all the information at once, queries
allow you select certain fields and add criteria to retrieve only
specific records.
The result of a query is called a record set or result set. You can
view the result set on the screen, print it, copy it to the clipboard, or
use the output of the query as the record source for a form or report.
Forms: Forms are commonly used as data entry screens. They are user-
friendly interfaces for working with data, and they often contain
elements and command buttons that make entering data and
performing various other tasks quick and easy.
Reports: You use reports to print and summarise data. Each report is
formatted to present the information in the most readable way
possible. You can format any report to fit your requirements and you
can create custom reports as well.
© 2017 Page 9
Lesson 1 - Exploring Access ECDL Using Databases
You can change the width of the Navigation Pane by positioning the pointer over
the right edge of the Navigation Pane. You can also hide or open the Navigation
Pane by clicking the Shutter Bar Open/Close button.
Page 10 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Steps
To use the Navigation Pane to select an object type:
Practice the Concept: Click the Forms object type and the Reports object type
to display their object lists. Then, click the All Access Objects in the program to
redisplay all Access objects.
© 2017 Page 11
Lesson 1 - Exploring Access ECDL Using Databases
Steps
To open a database object:
1. Select the name of the object you want Double-click Contacts, if necessary.
to open.
Click the Close button on the Contacts table window title bar to close the
Contacts table.
When you delete a table, you delete all the data in the table. You cannot undo the
delete operation.
Practice the Concept: Display the Forms object list. Select the Asset Details
form object, if necessary, and then double-click it to display the form in Form
view. Close the Asset Details form window. Delete the Asset Details form.
Display the Reports object list. Double-click the All Assets object to display it in
print preview mode. Close the All Assets report window without saving changes,
if prompted.
Page 12 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Steps
To view tabbed documents:
Steps
To close a tabbed document:
© 2017 Page 13
Lesson 1 - Exploring Access ECDL Using Databases
Steps
To close all tabbed documents:
Click No, if prompted to save the changes. Notice that all tabbed objects are
closed.
Page 14 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
Click the View button on the HOME tab to switch to the Design view of a table,
query, form or report.
Click the View icon to return to Datasheet view (in tables and queries).
Steps
To switch between views:
You can also use the status bar to switch between different views.
© 2017 Page 15
Lesson 1 - Exploring Access ECDL Using Databases
These settings can be set using the Access Options dialog box.
Steps
To use the Access Options dialog box:
Page 16 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
3. Select the option corresponding to the Click the Current Database option
features you want to change.
The appropriate page appears.
5. Select OK.
Click
The Access Options dialog box closes,
and the options are enabled or disabled
accordingly.
Steps
To close a database:
© 2017 Page 17
Lesson 1 - Exploring Access ECDL Using Databases
Steps
To create a new, blank database:
Click
4. Select the drive to store the file. Choose the drive with the Student Folder.
5. Open the folder where you want to store Double-click to open the Student Folder, if
the file. necessary.
A list of available folders and files
appears.
6. Select OK.
Click
The folder list closes.
Page 18 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
7. Select Create.
The Getting Started task pane closes,
and the database opens.
Click
Click No, if prompted to save the changes. Notice that all tabbed objects are closed.
Steps
To access Help:
© 2017 Page 19
Lesson 1 - Exploring Access ECDL Using Databases
Steps
To exit Access:
Page 20 © 2017
ECDL Using Databases Lesson 1 - Exploring Access
© 2017 Page 21
LESSON 2 –
CREATING TABLES
Concepts
Access provides various templates that can be used to speed up your database
creation process. A template is a ready to use database that contains all of the
tables, queries, forms, and reports needed for performing certain task.
For example, there are templates that include databases for asset tracking, issue
tracking, asset management, and project management. Some databases contain
sample records to help demonstrate their use. Templates can be used as is, or
you can customise them to suit your needs better.
Backstage view displaying the Suggested search for New Database Templates
Steps
Use a template to create a new database.
2. Select the desired template from the Scroll and select Desktop Product
displayed templates. Inventory.
The database template is selected.
© 2017 Page 23
Lesson 2 - Creating Tables ECDL Using Databases
Click
9. Open the Navigation Pane. Open the Navigation Pane, if necessary.
The Navigation Pane opens.
When you open the Navigation Pane, it is a good idea to select Show All, in
order to display all the objects in the database. You can double-click any object in
the Navigation Pane to open it. You can now enter data directly into the new
database, or modify it to meet your needs.
Concepts
The field data type tells Access what kind of values you plan to store in a field
and how much storage space to set aside for the field. Although you can change a
data type after a field contains data, doing so may erase some or all of the
information in the field. The tblInventory table below in the Design view shows
Field Name, Data Type and Properties:
Page 24 © 2017
ECDL Using Databases Lesson 2 - Creating Tables
The field data type tells Access what kind of values you plan to store in a field and
how much storage space to set aside for the field. Although you can change a
data type after a field contains data, doing so may erase some or all of the
information in the field.
Steps
Assign data types to database fields.
© 2017 Page 25
Lesson 2 - Creating Tables ECDL Using Databases
1. Select the Data Type column in the Click in the Data Type column for the
field for which you want to change the Description field.
data type.
The insertion point and a drop-down
arrow appear in the corresponding
Data Type column.
2. Select the arrow.
Click
A list of available data types appears.
3. Select the desired data type. Click Long Text.
The data type is selected and the field
properties change in the lower pane.
Practice the Concept: Assign the following data types to the respective fields:
ID AutoNumber
Supplier Number
Origin Country Short Text
Reorder Level Number
Target Stock Level Number
Unit Price Currency
Discontinued Yes/No
Discontinued Date Date/Time
Concepts
Tables are critical objects in a database because they hold all the information or
data. For example, a database for a business can have a Contacts table that
stores the names of their suppliers, their e-mail addresses, and telephone
numbers.
In Design view, you first create the structure of the new table. Then, you can
either switch to Datasheet view to enter data or you can also use a form to enter
data.
Design view also allows you to specify the field name, data type and additional
information for each field in the Description column.
Steps
Create a new table in Design view. Open a blank database.
1. Select the CREATE tab on the Ribbon. Click on the CREATE tab.
The CREATE tab appears.
Page 26 © 2017
ECDL Using Databases Lesson 2 - Creating Tables
Click
Concepts
A data table consists of fields and records. Fields are categories of information.
For example, in an address table, you may maintain names, addresses, cities,
states, and zip codes. Each of these categories is a field in the address database.
For each field in your table, you must give a meaningful name in the Field Name
column.
Each field in a table should contain only one element of data. For instance, if you
are storing a person’s name, use one field for the first name and another field for
the second name. This means that at a later date you could manipulate the data
to sort by the second name. For the same reason split the details of an address
into as many smaller parts as possible so that later you could search by
state/region, by post code/zip code or even by country if you are maintaining an
international list.
Steps
Add field names in Design view.
If necessary, create a new table in Design view and select the first blank cell in
the Field Name column.
© 2017 Page 27
Lesson 2 - Creating Tables ECDL Using Databases
Concepts
You can use the Description column to provide information about individual table
fields. The field Description is optional. It helps you describe the field and is also
displayed in the status bar when you select the field on a form.
Page 28 © 2017
ECDL Using Databases Lesson 2 - Creating Tables
Steps
Add a description to a field. Open the tblInventory table in Design view.
1. Select the Description column in the Click in the Description column for the ID
field to which you want to add a field.
description.
The insertion point appears in the
corresponding Description column.
2. Type the desired description. Type Inventory ID gets generated
The text appears in the Description automatically.
column.
3. Select the Description column in the Click in the Description column for the
field to which you want to add a Item field.
description.
The insertion point appears in the
corresponding Description column.
4. Type the desired description. Type Enter Item Name.
The text appears in the Description
column.
Practice the Concept: Type the following description for the respective fields:
Concepts
The primary key is a field in the table that uniquely identifies each record in the
table. Examples of primary key include Order ID, Product ID, or Customer ID.
There are several advantages to setting a primary key. First, the primary key is
automatically indexed, which makes information retrieval faster. Second, when
you open a table, the records are automatically sorted in order by the primary key.
© 2017 Page 29
Lesson 2 - Creating Tables ECDL Using Databases
Finally, a primary key prevents the entry of duplicate data because Access does
not allow duplicates in the primary key field.
Steps
Set a field as the primary key.
1. Select the field you want to designate Click ID in the Field Name column.
as the primary key.
The insertion point appears in the field.
2. Click the Primary Key button in the
Tools group on the DESIGN tab on the
ribbon.
A key appears in the row selector for Click .
the designated field and the field is set
as the primary key.
You can use an AutoNumber field to provide a unique value that’s only purpose
is to make each value unique.
Concepts
When you create a new table and save it, Access prompts you for a table name. If
you make any changes to the table after assigning a name, simply click the FILE
Page 30 © 2017
ECDL Using Databases Lesson 2 - Creating Tables
tab and choose Save to save the changes made. You can also click on the Save
button in the Quick Access Toolbar.
Steps
Do not apply these steps to the open table, they are an instructional reference
only.
Note: If you want to save the changes made as another table, click the FILE tab
and choose Save As. Select Save Object As and click Save As. Enter a new
table name and click OK.
Concepts
When you create a new table and save it, Access can automatically create a
primary key and assign it the AutoNumber data type.
Steps
Set a primary key field automatically.
1. Create a new table in Design view. Click CREATE tab and select Table
The table Design View appears. Design in the Tables group.
2. Add the required fields and set the Add the following fields and set the data
data types. type:
The fields are added.
© 2017 Page 31
Lesson 2 - Creating Tables ECDL Using Databases
5. Select an option for setting the primary Click Yes to set a primary key
key automatically.
The primary is set accordingly.
Access creates a new field named as ID with the data type set to AutoNumber.
Close and then delete the table. Having closed the table, right-click the table in the
navigation pane and click Delete. Click Yes when prompted.
Page 32 © 2017
ECDL Using Databases Lesson 2 - Creating Tables
1. Use the Desktop Task Management sample template to create a database. Name
the database Task Management and save it to the Student Folder.
2. Use the Navigation Pane to display objects by type, then select All Access Objects.
4. After you have viewed the table, close it. Then, close the Task Management
database as well.
5. Create a blank database named Training and save it to the Student Folder.
7. Add the following fields and their corresponding data types to the table:
StartDate Date/Time
EndDate Date/Time
TrainerInitials Text
Cost Number
8. Enter the following description for the ProjectID field: Enter the ProjectID assigned
by Marketing.
© 2017 Page 33
LESSON 3 –
SETTING FIELD PROPERTIES
Concepts
Each field has a set of properties that control the way it stores, handles, and
displays data. Since the forms and reports you create use the fields in your tables,
setting field properties in the early stages of building a database can save you
time later on; you will have less design work to do in later stages if you set the
desired field properties before you create any forms and reports.
You normally set or change field properties when you create a table in Design
view. If you have created and saved a table using default field properties, you can
open the table in Design view to change its property settings.
The properties available in the Field Properties pane depend on the data type
assigned to the selected field. Some of the property types you can set or change
are listed in the following table:
© 2017 Page 35
Lesson 3 - Setting Field Properties ECDL Using Databases
Concepts
Setting a field size limits the number of characters or the type of characters you
can enter into a field. After typing the maximum number of characters allowed,
further keystrokes are not permitted. The Field Size property is available only for
Text, Number, and AutoNumber data types; all other data types have default
sizes that are set automatically.
For a Text field, the field size is the maximum number of characters you want to
allow in the field, up to the maximum of 255 characters allowed by Access. For a
Number field, you can select one of the following Field Size options:
For an AutoNumber field, only the Long Integer and Replication ID options are
available.
Steps
From the Student Folder, open Design.accdb. Open the tblEmployee table in
Design view.
1. Select the field for which you want to Scroll as necessary and click in the Basic
set the field size property. Salary field.
The field is selected.
2. Select the General tab in the Field Click the General tab, if necessary.
Properties pane, if necessary.
The General tab is displayed.
3. Select the Field Size property. Click in the Field Size box.
A drop-down arrow appears in the
Field Size box.
Page 36 © 2017
ECDL Using Databases Lesson 3 - Setting Field Properties
Concepts
The Format property affects how data appears in Datasheet view, not how it is
stored in the table nor how it is used in calculations. If a Number data type field is
formatted with 0 decimal places, for example, a value of 1.5 would appear as 2 in
the datasheet; if the value is multiplied by 2 in a calculation, however, the answer
would be 3, not 4.
The available formats for fields with Number data types are listed in the following
table:
Format Description
General Number Displays a number exactly as it is entered; this is the default
format.
Currency Displays a dollar sign, thousands separator, and two decimal
places; the defaults for this format are determined by the system
settings.
Euro Displays a euro sign, thousands separator, and two decimal
places; the defaults for this format are determined by the system
settings.
Fixed Displays at least one digit and is rounded to the default number
of decimal places; the defaults for this format are determined by
the system settings.
Standard Displays thousands separator and is rounded to the default
number of decimal places; the defaults for this format are
determined by the system settings.
Percent Multiplies the number by 100, displays a percent sign (%), and is
rounded to the default number of decimal places; the defaults for
this format are determined by the system settings.
Scientific Expresses numbers in standard scientific notation (as multiples
of exponents of 10).
© 2017 Page 37
Lesson 3 - Setting Field Properties ECDL Using Databases
Steps
Set a number format.
1. Select the field for which you want to Scroll as necessary and click in the Basic
set a number format. Salary field.
The field is selected.
2. Select the General tab in the Field Click the General tab, if necessary.
Properties pane, if necessary.
The General tab is displayed.
3. Select the Format property. Click in the Format box.
A drop-down arrow appears in the
Format box.
4. Select the Format list.
Click Format
A list of available formats is displayed.
5. Select the desired format. Click Currency.
The format appears in the Format box.
Switch to the Datasheet view. Scroll to the Basic Salary column of the first
record and enter the value 3500 and press [Enter]. Notice that the value is now
formatted as currency. Proceed to the next section without closing the
tblEmployee table.
Page 38 © 2017
ECDL Using Databases Lesson 3 - Setting Field Properties
Concepts
A Date/Time field can have various date formats as shown in the picture below.
You can use the formats as per your requirement.
Steps
Set a date/time format.
1. Select the field for which you want to Scroll as necessary and click in the
set a date/time format. Joining Date field.
The field is selected.
2. Select the General tab in the Field Click the General tab, if necessary.
Properties pane, if necessary.
The General tab is displayed.
3. Select the Format property. Click in the Format box.
A drop-down arrow appears in the
Format box.
© 2017 Page 39
Lesson 3 - Setting Field Properties ECDL Using Databases
Switch to Datasheet view. Scroll as necessary to the Joining Date field; notice its
format.
Concepts
A Yes/No field is limited to either a positive or a negative response and can be
displayed as a text box, a check box, or a combo box. You select the display of the
field on the Lookup page in the Field Properties pane.
If the Yes/No field displays its values in a text box, you can select one of three
Yes/No data type formats: True/False, Yes/No, and On/Off. Regardless of the
format selected, the positive responses of True, Yes, and On are equivalent, just
as the negative responses of False, No, and Off are equivalent. Consequently, if
the Yes/No field is set to the True/False format and a user enters Yes, Access
automatically converts it to True.
When a Yes/No field displays a check box, a selected check box indicates a positive
response and a deselected check box indicates a negative response. The check
box is the default setting for a Yes/No field.
Steps
Set a yes/no format.
1. Select the field for which you want to Scroll as necessary and click in the
set a yes/no format. Attended Orientation field.
The field is selected.
2. Select the General tab in the Field Click the General tab, if necessary.
Properties pane, if necessary.
The General tab is displayed.
Page 40 © 2017
ECDL Using Databases Lesson 3 - Setting Field Properties
Concepts
Access uses indexes much like a Table of Contents to help locate and sort
information quickly. An index is a copy of a field which is sorted and stored
separately to speed up access to the data in a table. For example, to access a
particular record in an employee details table based on surname, it would be
necessary to search the entire table looking for the surname. If Surname was
defined as an Index however, the name could be quickly found from the sorted list
of surnames and this would link to the appropriate record in the table.
If a field is set as indexed, the table will be automatically sorted by that field
whenever the table is opened. Indexing can be set on more than one field and the
fields are sorted in turn. By default, Access set the Primary key as the Index within
a table.
The following lists the possible settings for the Indexed property:
No
Do not create an index on this field (or delete the existing index).
By setting the Index property to No Duplicates, Access prevents any new value
which matches an existing value from being entered into the field. For example,
indexing the ID field in a table and setting it to Yes (No Duplicates) prevents
duplicate numbers being entered and therefore the values in the field remain
unique.
© 2017 Page 41
Lesson 3 - Setting Field Properties ECDL Using Databases
Steps
Create an indexed field.
1. Select the field for which you want to Click in the Fax Number field.
apply an index.
The field is selected.
2. Select the General tab in the Field Click the General tab, if necessary.
Properties pane, if necessary.
The General tab is displayed.
Concepts
When you set a default value for a field that value automatically appears in the field
for all new records. You can, however, modify the default field value as needed
when entering a new record.
A default value can save you time when entering data. For example, if a table stores
the names and addresses of clients and most of the clients have addresses in New
York, you can set the default value of the State field to NY. If you then enter a new
record for a client in Connecticut, or if a client moves out of New York, you can
change the value in the State field just for that individual record. Setting a default
value for an established table, however, does not modify existing records.
Page 42 © 2017
ECDL Using Databases Lesson 3 - Setting Field Properties
You can set a default value by entering the desired value or expression in the
Default Value box. An expression consists of operators (i.e., =, +, -, *, /) and/or
values.
If you create a default value for a Text field, the default text must be enclosed in
quotation marks (" "); for example, "Net 30". Values for Date fields must be
enclosed in number signs (#); for example, #1/15/98#. If you do not enter the
number signs, however, Access will automatically enter them.
Steps
Set a default value.
1. Select the field for which you want to set Scroll as necessary and click in the
a default value. Attended Orientation field.
The field is selected.
2. Select the General tab in the Field Click the General tab.
Properties pane.
The General tab is displayed.
3. Select the Default Value property. Click in the Default Value box.
The insertion point appears in the
Default Value box, and the Build
button appears.
4. Type the desired default value. Type yes.
The text appears in the Default Value
box.
5. Press [Enter]. Press [Enter].
The default value is saved.
Practice the Concept: Assign the default value of Asia Pacific for the
Country/Region field. Save the table and switch to Datasheet view. Scroll to
display the Attended Orientation column in the new record row; notice that the
Attended Orientation field for the new record is checked.
© 2017 Page 43
Lesson 3 - Setting Field Properties ECDL Using Databases
Concepts
A validation rule ensures that only valid data is stored in the field. You can set
validation rules for a field in the design view. When you enter data using the
datasheet view or a form, the validation rules are applied before the data is saved
in the table. If the data follows the rule, then it is saved in the table, otherwise it is
not. If this occurs Access will display the validation text to notify the user that the
entered data is not following the validation rule.
Steps
Set a validation rule.
1. Select the field for which you want to set Scroll as necessary and click in the Basic
a validation rule. Salary field.
The field is selected.
2. Select the General tab in the Field Click the General tab, if necessary.
Properties pane, if necessary.
The General tab is displayed.
3. Select the Validation Rule property. Click in the Validation Rule box.
The insertion point appears in the
Validation Rule box, and the Build
button appears.
4. Enter the desired validation rule. Type <=5000.
The text appears in the Validation Rule
box.
5. Select the Validation Text property. Click in the Validation Text box.
The insertion point appears in the
Validation Text box.
6. Enter the desired validation text. Type Basic salary may not exceed
The text appears in the Validation Text $5,000.
box.
Save the table; a Microsoft Office Access warning box informs you that data
integrity rules have been changed. Select Yes.
Switch back to Datasheet view. Create a new record; scroll as necessary, enter
15000 in the Basic Salary field, and press [Enter]. Select OK.
Page 44 © 2017
ECDL Using Databases Lesson 3 - Setting Field Properties
Press the [Delete] key and Yes to delete the new record and switch back to Design
view.
© 2017 Page 45
Lesson 3 - Setting Field Properties ECDL Using Databases
1. Open FieldsEX.accdb.
2. Open the tblOrders table in Design view.
3. Set the Format property for the Pickup Date field to Short Date.
4. Set the Default property for the Paid field to No.
5. Open the tblMenu Items table in Design view.
6. Set the Format property for the Price field to Currency.
7. Set a validation rule for the Price field, so that it can only contain values greater than
1 dollar. (Hint: Type >1.) Then, enter the following validation text: The amount paid
must be greater than one dollar.
8. Switch to Datasheet view, saving the changes. Select Yes to any Microsoft Access
warning boxes. Notice the formats of the Price field.
9. Close the database file.
Page 46 © 2017
LESSON 4 –
WORKING WITH TABLES
Concepts
Tables are the building blocks of a database. They are made of records (also
called rows) and fields (also called columns). You can sometimes save time by
choosing fields from a field template. A field template definition includes field
name, a data type, a setting for the field’s Format property.
Page 48 © 2017
ECDL Using Databases Lesson 4 - Working with Tables
Steps
To use the Field Template task pane:
Concepts
New fields can be added even after a table has been created.
Steps
Add a new field to an existing table:
From the Student Folder, open Tables1.accdb database. Open the tblEmployee
table in Design view.
© 2017 Page 49
Lesson 4 - Working with Tables ECDL Using Databases
3. Type a name for the field and set the Type the field name as Insurance and set
data type. the data type to Yes/No.
The new field is created.
Concepts
You can add records to a table by opening the table in the Datasheet view. A
table opened in Datasheet view resembles an Excel worksheet. To move to the
next field in the same row, press [Tab], use the RIGHT or LEFT arrows, or
click the cell in the next field.
Note: You do not need to explicitly save your data. Access commits the changes
made to the table when you move the cursor to the new field in the same row, or
when you move to the next row.
You must enter the type of data that the field is set to accept. If you do not follow,
Access displays an error message.
Steps
Add a record to a table.
1. Select the first field in the new record Click in the Company field of the first row,
row, if necessary. if necessary.
The insertion point appears in the
field.
2. Type the desired data. Type CarySales.
The data appears in the field.
3. Press [Enter]. Press [Enter].
The insertion point moves to the next
field.
4. Enter the desired record data into the Follow the instructions shown below the
remaining fields, pressing [Enter] after table to complete this step.
each entry.
The data appears in the fields.
Add the following records to the table, pressing [Enter] after each field:
Page 50 © 2017
ECDL Using Databases Lesson 4 - Working with Tables
Concepts
Navigating Access records is same as navigating an Excel worksheet. You can
use arrow keys or tab keys to move from one field to another. You can also use
the Record selectors just above the status bar to move to the next record,
previous record, first record, and the last record. You can also type in the record
number you want to move to in the textbox located in between the record
selectors.
© 2017 Page 51
Lesson 4 - Working with Tables ECDL Using Databases
First record Moves the cursor to the first record in the table and keeps
the cursor in the same field.
Previous record Moves the cursor to the previous record in the table and
keeps the cursor in the same field.
Next record Moves the cursor to the next record in the table and
keeps the cursor in the same field.
Last record Moves the cursor to the last record in the table and keeps
the cursor in the same field.
New (blank) record Creates a new record at the end of the table and moves
the cursor to the first field of the new record.
Steps
Move through records in a table.
Page 52 © 2017
ECDL Using Databases Lesson 4 - Working with Tables
Concepts
You can also select one record or multiple records using a keyboard or a mouse.
If you are using the keyboard then you need to go to that record and holding down
the [Shift] key and the right arrow key you can select the entire record.
If you are using the Mouse, then you need to go to that record and point and click
to the left of the current record, the entire record is selected.
Selected Record
Steps
Select a record in a table.
1. Click anywhere in the record you want Click in the ID field for record number 6.
to make active.
The field is selected and the record
selector changes colour.
2. Point to the record selector of a record Point to the left of the ID field for record
you want to select. number 6.
A solid, black, right-pointing arrow
appears.
3. Click in the record selector of the Click to the left of the ID field for record
record you want to select. number 6.
The entire record is selected.
© 2017 Page 53
Lesson 4 - Working with Tables ECDL Using Databases
Concepts
The records in the table can be edited either by opening the table in the datasheet
view or using a form.
Steps
Edit a table record in edit mode.
1. Click in the field you want to edit. Click in the E-mail address field in the
The insertion point appears in the field. record number 6.
2. Select the text you want to edit. Click after the word Tom.
The characters are selected.
3. Type the desired text. Type Teck (to read as
[email protected]).
The characters are replaced.
4. Press [Enter]. Press [Enter].
The changes to the record are saved.
Concepts
You can print pages, selected records and tables from Microsoft Access. You can
also view pages in this view by navigating the Next Page and Previous Page
buttons in the Print Preview section.
Steps
1. Select the FILE tab. Click FILE
The backstage view
will open.
2. Select the Print option Click Print
and then select Print.
The Print dialogue
box will appear.
Page 54 © 2017
ECDL Using Databases Lesson 4 - Working with Tables
1. Select the records to print. Select the last name row in the tblEmployee.
The records will be
selected.
Tip: You can use the keyboard shortcut Ctrl+P to quickly open the print dialogue
box.
© 2017 Page 55
Lesson 4 - Working with Tables ECDL Using Databases
Concepts
You can delete the data in a record in a table by navigating to the desired record,
selecting the data in the desired field and pressing the [Delete] key.
Steps
Delete data in a record from a table.
1. Select the record that has data that you Scroll as necessary and click any field in
want to delete. record 5.
The record is selected.
2. Select the data you want to delete. Select the job title for record 5.
The data is selected.
3. Press [Delete]. Press [Delete].
The data is removed.
Save the tblEmployee table. As an alternative, you can also select the Delete
command in the Add & Delete group of the TABLE TOOLS FIELD tab.
Concepts
You can delete the records in a table by navigating to the desired record and
pressing the Delete button present in the Records group in the HOME tab.
Alternatively, you can also delete the record by right clicking on the desired record
and then selecting Delete Record from the shortcut menu.
Page 56 © 2017
ECDL Using Databases Lesson 4 - Working with Tables
Steps
Delete a record from a table.
1. Select the record you want to delete. Scroll as necessary and click the record
The record is selected. selector of the last record.
© 2017 Page 57
Lesson 4 - Working with Tables ECDL Using Databases
1. Open TableEX.accdb.
2. Open the tblProducts table in Datasheet view.
3. Add the following records to the table:
Page 58 © 2017
LESSON 5 –
EDITING TABLES
Concepts
After you have created the database, you may find that the data seems a bit
unorganised. You can change the order of the columns or you can even make
each row of data easier to read. You can make the text easier to read by
increasing the row height in your datasheets.
Page 60 © 2017
ECDL Using Databases Lesson 5 - Editing Tables
Steps
From the Student Folder, open TABLES2.ACCDB.
Change the height of the rows in a table.
1. Point to any horizontal line between Point to the horizontal line below the
records in the record selector. Brush record selector.
The mouse pointer changes into a
black cross with vertical arrowheads.
2. Drag the line to the desired row height. Drag the line down to the top of the next
The height of all the rows changes row.
accordingly.
Notice that the longer text entries in the Description field now wrap to the next
line.
Practice the Concept: Select any record, right-click and select Row Height.
Select the Standard Height option and OK.
Concepts
If some of the fields in your datasheet contain lots of text, some of that text may
be cut off so that you can’t see them at all. In that case, you can resize the column
to make it more readable. You can also resize one or more columns manually or
automatically.
To resize single column, position the mouse pointer at the right edge of the
column header until the pointer changes to a double- headed arrow.
© 2017 Page 61
Lesson 5 - Editing Tables ECDL Using Databases
Steps
Change the width of a column in a table.
1. Point to the vertical line to the right of Point to the vertical line to the right of the
the header of the column you want to Description header.
adjust.
The mouse pointer changes into a black
cross with horizontal arrowheads.
2. Drag the line to the desired width. Drag the line to the right of the Model
The column width changes accordingly. header.
To resize a column to a specific width, right-click on the field name and select
Field Width. Type the required width and click OK.
Page 62 © 2017
ECDL Using Databases Lesson 5 - Editing Tables
Concepts
Access allows you to format the fonts in your tables. You can change the font
face, font size, and font colour using the commands present in the Text
Formatting group on the HOME Tab.
Steps
Change a font attribute.
1. Select the HOME Tab on the Ribbon. Click on the HOME tab.
The Format menu appears.
2. Select the desired options from the Text
Formatting group on the HOME Tab. Click on .
The font attributes changes.
Click the Bold button again to return the font back to its original state.
Concepts
© 2017 Page 63
Lesson 5 - Editing Tables ECDL Using Databases
Steps
Select a column in a table.
1. Click the header of the column you want Click the Location header.
to select.
The column is selected.
Concepts
You can change the sequence of the columns by selecting the column and then
dragging using the column border and releasing the mouse at the desired column
position.
Inventory table showing Location column (located between Category and Supplier) selected
Inventory table showing Location column moved to a new location (between Supplier and Manufacturer)
Steps
Move a column in a table.
Page 64 © 2017
ECDL Using Databases Lesson 5 - Editing Tables
1. Select the column you want to move. Click the Location header.
The column is selected.
2. Drag the column to the new location. Drag the Location column to the right of the
The column appears in the new location. Supplier column, until a vertical divider bar
appears between the columns.
Close the Inventory table without saving the changes. Close TABLES2.ACCDB.
© 2017 Page 65
Lesson 5 - Editing Tables ECDL Using Databases
Edit Tables
1. Open EditTableEX.accdb.
2. Open the tblCustomers table in Datasheet view.
3. Increase the row height by approximately 25.
4. Change the font to Arial Narrow and the font size to 12.
5. Widen the Job Title and Address columns so that all the data in them appears.
6. Move the Email Address column to the right of the Job Title column.
7. If necessary, resize the Datasheet window so that the columns at the far right do not
appear.
8. Close the table without saving the changes.
9. Close the database.
Page 66 © 2017
LESSON 6 –
FINDING AND FILTERING DATA
Sort records
Find specific records
Find records using wildcards
Use Replace
Use Filter By Selection
Apply/remove a filter
Use Filter Excluding Selection
Use the Search Box
Use Quick Filter
Use AutoFilter
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Concepts
You can sort the records in a table, query, form, or a report on one or more fields.
When sorting on multiple fields, it is important to identify the sort order.
When you are done sorting the records, it can be important to reset the table
before continuing unless you want to keep the list sorted. This can be achieved by
clicking Remove Sort button.
Steps
From the Student Folder, open FILTER1.ACCDB.
Sort records in a table.
1. Select the field by which you want to Click in the Last Name column.
sort.
The insertion point appears in the
column.
2. Select the Ascending or Descending
button in the Sort & Filter group on Click
the HOME Tab.
The records are sorted accordingly.
3. To remove the sort, select the
Remove Sort button. Click
All sorts are removed.
Page 68 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
Practice the Concept: Scroll as necessary to view the Basic Salary column and
sort the records by the Basic Salary field in descending order. Then, remove the
sort by selecting the Remove Sort button.
Concepts
As the volume of data in the table grows, it becomes increasingly difficult to find
data in a table manually. You can use Access Find tool to quickly find data The
Find command can be used to search for a specific text, number and date in a
field.
Steps
Find specific records in a table.
1. Select the field you want to search. Scroll as necessary and click in the Job
The insertion point appears in the Title column.
column.
2. Click the Find button on the HOME Tab
on the Ribbon.
The Find and Replace dialog box Click
opens with the insertion point in the Find
What box.
3. Type the text you want to find in the Type Production Support.
Find What box.
The text appears in the Find What box.
4. Select the Match list.
Click Match
A list of available options appears.
5. Select the desired option. Click Whole Field.
The option is selected.
© 2017 Page 69
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Practice the Concept: Search for a basic salary value of 5000 using the Find
command. Note, ensure the Search Fields As Formatted checkbox is
deselected.
Search for an employee that was hired on the 3rd March 2007 using the Find
command.
Page 70 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
Concepts
A wildcard is a special character that can represent one or more characters in a
text value. You can use them to find a number of records with similar information,
although they are not exactly the same. You can also use them to find a specific
record when you can't remember enough information to retrieve that record.
The most flexible wildcard character is the asterisk (*). It matches any block of
characters in a specific position. For example: Like “*Access*” would return
Microsoft Access, Access 97, accessed, and accessing.
Steps
Find records in a table using wildcards.
1. Select the field you want to search. Scroll as necessary and click in the
The insertion point appears in the Description column.
column.
2. Click the Find button on the HOME
Tab on the Ribbon.
The Find and Replace dialog box
opens with the text in the Find What
box selected.
© 2017 Page 71
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Concepts
The Find and Replace dialog box allows you to locate and replace small amounts
of data. The dialog box resembles the Find tools that you see in other programs,
but it contains specific features applicable to working with databases.
Page 72 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
Steps
Use the Replace feature to replace record data in a table.
1. Select the field you want to search. Scroll as necessary and click in the
The insertion point appears in the Model column.
column.
2. Select the Replace button in the Find
group on the HOME Tab on the Click
Ribbon.
The Find and Replace dialog box
opens.
3. Type the text you want to find in the Type CB-6754.
Find What box.
The text appears in the Find What
box.
4. Select the Replace With box. Press [Tab].
The insertion point moves to the
Replace With box.
5. Type the desired replacement text. Type CB-6755.
The text appears in the Replace With
box.
© 2017 Page 73
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Concepts
Filter by Selection is one of the fastest ways to filter your list. With this option, all
you need to do is highlight the filter criteria in your table or form and then choose
Filter by Selection. Your list will quickly filter based on the data that is selected.
Steps
Use the Filter by Selection feature.
Page 74 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
1. Select any field that contains the data Scroll as necessary to the Manufacturer
by which you want to filter. column and click in any North face field.
The insertion point appears in the
field.
2. Click the Selection button on the Sort
& Filter group on the HOME Tab. Click
The Filter by Selection sub-menu
appears.
3. Select the desired filter options. Click Equals “North face”.
The selected filter is applied.
To remove the filter, go to the HOME tab and click the Advanced button in the
Sort & Filter group. Click Clear All Filters.
Concepts
To switch to the unfiltered view of data, remove the filters using one of these 2
methods:
On the HOME tab, in the Sort & Filter group, click the Advanced button.
Click Clear All Filters.
Click Filtered on the record navigator bar to revert to the full view.
Steps
Apply and remove a filter.
If necessary, open the tblInventory table in Datasheet view and filter the table by
the Traders Assembly manufacturer.
© 2017 Page 75
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Concepts
You can use a filter in Access to exclude results that do not match certain criteria for
more accurate results.
Sort & Filter group showing the Selection drop down list options
Steps
Use the Filter Excluding Selection feature.
If necessary, open the tblInventory table in Datasheet view and display all
records.
1. Select the field that contains the data Scroll as necessary to the Manufacturer
you want to exclude. column and click in any Straw Mawks
The insertion point appears in the text.
field.
2. Select the HOME tab. Click HOME.
The HOME tab appears.
3. Select the Selection button in the
Sort & Filter group. Click
The Filter submenu appears.
4. Select the desired filter option. Click Does Not Equal “Straw Mawks”.
The records are filtered to exclude the
selected data.
Page 76 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
Concepts
You can also search the records in the database using the Search textbox. You
need to specify the search criteria and then press the [Enter] key. You will notice
that the cells containing the matching text are highlighted one by one.
Steps
Use the Search Box to search for a specific record.
Notice if you continue to hit the [Enter] key, Access continues to highlight further
instances of the specified text in the Datasheet.
Concepts
Quick filter lets you choose which values that you want to hide that are listed in a
particular field. It’s easy to use, but potentially time consuming. To show the list of
quick filter values, move to the field you want to filter, and then click HOME tab
and select Filter button present under the Sort & Filter group.
© 2017 Page 77
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Steps
Use Quick Filters.
Page 78 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
Concepts
AutoFilter feature in Access helps you to hide everything in a table except the
records you want to view.
Steps
Use AutoFilter.
© 2017 Page 79
Lesson 6 - Finding and Filtering Data ECDL Using Databases
Close FILTER1.ACCDB.
Page 80 © 2017
ECDL Using Databases Lesson 6 - Finding and Filtering Data
© 2017 Page 81
LESSON 7 –
USING SIMPLE QUERIES
Concepts
A query is a means of extracting information from tables. You can use queries to
analyse the data in a table or to extract data for a form or report. Queries are
commonly used to display data in related tables and enable you to control not only
which records to display, but also which fields. For example, you may want to give
a sales representative a list of the contacts and telephone numbers for a particular
region; you can create a query to extract just the contact names and telephone
numbers within the specified region.
A query does not contain data; rather, it is a set of instructions. Access uses these
instructions to select and display the desired records in a table. As a result,
whenever new data is added to the queried table, the query is automatically
updated; if the new records meet the conditions of the query, they will be included
when the query runs.
When you open or run a query, a recordset appears. A recordset contains all the
fields and records that meet the conditions of the query. Although the recordset is
not a table, it can be used to edit or add new records in the queried tables.
Concepts
When you want to select specific data from one or more sources, you can use a
select query. A select query helps you retrieve only the data that you want, and
also helps you combine data from several data sources. You can use tables and
other select queries as data sources for a select query.
You can use the Query Wizard to automatically create a select query. When you
use the wizard, you have less control over the details of the query design, but the
query is usually created faster than if you did not use the wizard.
© 2017 Page 83
Lesson 7 - Using Simple Queries ECDL Using Databases
Steps
From the Student Folder, open QUERY1.ACCDB.
Use the Simple Query Wizard to display selected fields in a table.
Page 84 © 2017
ECDL Using Databases Lesson 7 - Using Simple Queries
Add the First Name, E-mail Address and Business Phone fields to the query.
Return to the table and continue on to the next step (step 10).
Close the query. Notice that the qryContacts and Phone Numbers query now
appears in the Queries object list.
Steps
© 2017 Page 85
Lesson 7 - Using Simple Queries ECDL Using Databases
Close the query. Notice that the qryEmployee Query now appears in the
Queries object list. Criteria can now be added to the query.
Page 86 © 2017
ECDL Using Databases Lesson 7 - Using Simple Queries
Concepts
A query criterion is an expression that Access compares to query field values to
determine whether to include the record that contains each value. For example, =
"Singapore" is an expression that Access compares to values in a text field in a
query. If the value for that field in a given record is "Singapore ", Access includes
the record in the query results.
Steps
Add criteria to a query to select specific records.
1. Select the Criteria row for the field you Click in the Criteria row under Job Title.
want to match.
The insertion point appears in the
Criteria field.
2. Type the value you want to match. Type Production Support.
The text appears in the Criteria row in
the design grid.
© 2017 Page 87
Lesson 7 - Using Simple Queries ECDL Using Databases
Run the query by clicking the Run button in the Results group in the Design tab.
Notice that only records in the Production Support region appear in the
recordset.
Practice the Concept: Switch to Design view. Delete the “Production Support”
criteria under the Job Title field and select the Criteria row under the Joining
Date field. Enter the criteria 5/4/2013. Press [Enter]. Notice that Access inserts
number symbols around the date value. Run the query and scroll as necessary to
view the Joining Date column. Notice that only records with a 5/4/2013 date
appear in the recordset.
Concepts
When you create a new query and save it, Access prompts you for a query name.
If you make any changes to the query after assigning a name, simply click the
FILE tab and choose Save to save the changes made. You can also click on the
Save button in the Quick Access Toolbar.
Steps
Ensure the qryEmployee Query is still open from the previous exercise in
Design view.
Note: If you want to save the changes made as another query, click the FILE tab
and choose Save As. Select Save Object As and click Save As. Enter a new
query name and click OK.
Page 88 © 2017
ECDL Using Databases Lesson 7 - Using Simple Queries
Concepts
To open a query, you need to run the query by double clicking the desired query
object from the Navigation Pane. It returns the recordset.
Steps
Open a query in Datasheet view.
1. Select the name of the query you want Double-click qryEmployee Details.
to run.
The query runs, and its recordset
appears in Datasheet view.
Concepts
Creating queries involves selecting one or more tables and fields, sorting data,
and choosing data by entering criteria. A query often requires related data from
more than one table, so you can add a number of tables to the design of the
query.
When you are initially creating a query, you can select more than one table.
Steps
Add multiple tables to a query.
You need to create a query containing all the supplier names with their
corresponding item name with a high reorder level (50 or more). Supplier names
are in the tblSuppliers table and the item names with the reorder level values are
found in the tblInventory table.
1. Create a new query in Design view. Click the CREATE tab and click Query
The Show Table dialog box opens. Design in the Queries group.
© 2017 Page 89
Lesson 7 - Using Simple Queries ECDL Using Databases
2. Select the tables to add from the Show Press [Shift] and click on tblInventory
Table dialog box, click Add and then and tblSuppliers.
click Close.
The tables are added to the design
view.
3. Click and drag the fields required into Drag and drop the following fields:
the Field row in the window below.
The fields are added.
4. Add the required criteria. Click in the Criteria box for ReorderLevel
The criteria is added. and type >=50
Note: When selecting tables from the Show Table dialog box, use the [Shift] key
to select adjacent tables and use the [Ctrl] key to select non-adjacent tables.
Tables selected by pressing the [Shift] key and clicking on tblEmployee and tblInventory (adjacent tables)
and press the [Ctrl] key and clicking on tblSuppliers (non-adjacent table)
Page 90 © 2017
ECDL Using Databases Lesson 7 - Using Simple Queries
Concepts
When you open or run a query, a recordset appears. A recordset contains all the
fields and records that meet the conditions of the query. Although the recordset is
not a table, it can be used to edit or add new records in the queried tables.
Steps
Run a query to test its design:
Click the VIEW button on the Ribbon to switch back to Design view.
© 2017 Page 91
Lesson 7 - Using Simple Queries ECDL Using Databases
1. Open Query1EX.accdb.
2. Use the Query Wizard to create a query.
3. Select the tblCustomers table and add the Company, Last Name. First Name,
Address, City, State, and Postal Code fields.
4. Name the query qryCustomerNames and view its recordset. Then, close the
qryCustomerNames query.
5. Create a query in Design view.
6. Add the tblEmployees table to the query. Then add the ID and Full Name fields to the
design grid.
7. Close the database file.
Page 92 © 2017
LESSON 8 –
MODIFYING QUERY RESULTS
Concepts
Access allows you to apply sorts while you're designing your query. This allows
you to view your data exactly the way you want, to view it every single time you
run the query.
A sort that includes more than one sorted field is called a multi-level sort. A
multi-level sort allows you to apply an initial sort, and then further organise that
data with additional sorts. For example, if you had a table full of customers and
their addresses, you might choose to first sort the records by city, and then further
sort them alphabetically by last name.
Steps
From the Student Folder, open QUERY2.ACCDB.
Sort a query.
Display All Access Objects in the Navigation Pane and open the qryEmployee
Details query in Datasheet view.
1. Select the field by which you want to Click the Last Name field.
sort.
The column in selected.
Page 94 © 2017
ECDL Using Databases Lesson 8 - Modifying Query Results
Notice that the recordset is sorted in ascending order by the Last Name field.
Close the recordset.
Practice the Concept: Open the tblEmployee table in Datasheet view. Click the
New Record button on the Table Datasheet toolbar and create a new record by
adding data only in the following fields:
Field Data
Company Morris Magnum Ltd.
Last Name Gomez
First Name Sandra
E-mail Address [email protected]
Job Title Sales Manager
Business Phone (065)7896-3456
Mobile Phone 6789-9876
Fax Number 5678-9876
Address 10, Macadamia Drive
State Singapore
Postal Code 678992
Country / Region Asia
Joining Date 2/1/2007
Attended Orientation No
Basic Salary 4000
Close the tblEmployee table and run the qryEmployee Details Query. Notice
that the new record appears in the recordset and is sorted in the correct order.
© 2017 Page 95
Lesson 8 - Modifying Query Results ECDL Using Databases
Concepts
You can add to the query design grid, a field that you use for setting criteria or a
sort order, yet not show the data from that particular field in the query’s results.
Steps
Hide a query field.
1. Deselect the Show option in the field Scroll as necessary and click in the
you want to hide. Show row under Country / Region to
The Show option is deselected. deselect it.
Run the query. Notice that the Country / Region field does not appear in the
recordset.
Practice the Concept: Switch to Design view. Click the checkbox in the Show
row under Country / Region to select it. Run the query. Notice that the Country /
Region field now appears in the recordset.
Alternatively, you can hide and unhide a field in Datasheet View by right-clicking
the field title and selecting Hide Fields. To unhide the field, select Unhide Fields.
Page 96 © 2017
ECDL Using Databases Lesson 8 - Modifying Query Results
Concepts
You can add or delete field in the query design grid to modify the recordset
display.
Steps
Add or remove query field.
1. Drag and drop the field to a required Drag the field Last Name and drop it on E-
location in the grid. mail Address field in the design grid.
The field is added to the grid.
2. Click in the Field row of the field to Click on the Job Title field in the grid.
delete.
The insertion point appears on the field
name.
3. Click the Delete Column command in
the Query Setup group. Click
The field is removed from the grid.
Concepts
It is easy to print query results. Although not as elegant as a printed report, printed
query results are often sufficient to meet desired needs.
© 2017 Page 97
Lesson 8 - Modifying Query Results ECDL Using Databases
Steps
Print a query from the Navigation pane.
Close QUERY2.ACCDB.
Tip: You can quickly access the Print pane by using the keyboard shortcut
Ctrl+P.
Page 98 © 2017
ECDL Using Databases Lesson 8 - Modifying Query Results
1. Open Query2EX.accdb.
2. Open the query qryCustomerNames in Design view.
3. Sort the query in ascending order by the First Name field. Then, run the query.
4. Open the query qryCustomerNames in Design view.
5. Add criteria to display only the customer staying in Seattle city.
6. Run the query. Notice that only customers staying in Seattle city are displayed.
7. Open the query again in Design view.
8. Hide the City field and run the query.
9. Close the query.
10. Close the database file.
© 2017 Page 99
LESSON 9 –
USING OPERATORS IN QUERIES
Concepts
An operator is a sign or symbol that specifies the type of calculation to perform
within an expression. There are mathematical, comparison, logical, and reference
operators.
Comparison operators are used for comparing values and return true or false
depending upon the data in the table. The following table displays examples of
various criteria and the query result:
Steps
From the Student Folder, open OPERATE.ACCDB.
Use comparison operators in a query.
Display All Access Objects on the Navigation Pane, if necessary. Open the
qrySupplierInventory in Design view.
1. Select the Criteria row in the field to Scroll as necessary and click in the
which you want to add criteria. Criteria row of the Target Stock Level
The insertion point appears in the field.
Criteria row of the corresponding field.
2. Type the desired comparison operator Type <=300.
and value.
The criterion appears in the Criteria
row.
3. Enter the action. Press [Enter].
The criterion is entered into the design
grid.
Run the query. Notice that only records with a target stock level of $300 or less
appear in the recordset.
Practice the Concept: Open the qryEmployee Details query in Design view.
Delete any previous criterion. Find all records of employees with contract dates on
or after January 1, 2010, by adding >=1/1/2010 to the Criteria row of the Joining
Date field and pressing [Enter]. Notice that Access inserts number symbols (#)
around the value to indicate a date value.
Run the query. Notice that only those records that match the criterion appear in
the recordset.
Find all records of employees earning $5000 by adding =5000 to the Criteria row
of the Basic Salary field and pressing [Enter]. Run the query. Notice that only
those records that match the criterion appear in the recordset.
Find all records of employees not earning $5000 by adding <>5000 to the Criteria
row of the Basic Salary field and pressing [Enter]. Run the query. Notice that
only those records that match the criterion appear in the recordset.
Concepts
Logical operators (AND, OR, NOT) are used to combine two expressions and
return a true, false, or null result. Logical operators are also referred to as Boolean
operators.
The And operator returns True when both the expressions are true.
Example: Joining Date >= 1/1/2011 AND <= 31/12/2011. This query criteria will
display all the details of those employees who joined in the year 2011.
Query Design View showing expression using And Condition in the criteria
Steps
Use an And condition in a query.
If necessary, open the qryEmployee Query 2 in Design view and delete any
previous criteria.
© 2017 Page 103
Lesson 9 - Using Operators in Queries ECDL Using Databases
1. Select the Criteria row of the desired Click in the Criteria row of the Joining
field. Date field.
The insertion point appears in the
Criteria row of the corresponding field.
2. Type the desired criterion. Type >=1/1/2011.
The criterion appears in the design grid.
3. Type the And operator and an Type and <=31/12/2011.
additional criterion in the same Criteria
row and field, or type additional criteria
in the same Criteria row of one or more
other fields.
The additional criterion appears in the
design grid.
4. Press [Enter]. Press [Enter].
The And condition is entered into the
design grid.
Run the query. Notice that only records that match the And condition appear in the
recordset.
Concepts
The logical operators are used to combine more than one expression. The “Or”
operator returns True when any one of the expressions returns true. The “Or”
operator returns false when both the expressions returns false.
Example: Country=”USA” OR “UK”. This query criterion will display all the records
where the country is either USA or UK.
Steps
Use an OR condition in a query.
If necessary, open the qrySupplier Details query in Design view and delete any
previous criteria.
1. Select the Criteria row of the desired Click in the Criteria row of the Job Title
field. field.
The insertion point appears in the
corresponding Criteria row.
2. Type the desired criterion. Type Supplier Manager.
The criterion appears in the Criteria
row.
3. Select the Or row of the desired field. Click in the Or row of the Job Title field.
The insertion point appears in the or
row.
4. Type the second criterion. Type Account Manager.
The second criterion appears in the or
row.
5. Press [Enter]. Press [Enter].
The Or condition is entered into the
design grid.
Run the query. Notice that records matching either Or condition appear in the
recordset.
Concepts
The logical operators are used to combine more than one expression. The “Not”
operator is used to exclude records in the query.
Example: Country<>”USA”. This query criterion will display all the records where
the country is not USA.
Steps
Use a NOT condition in a query.
If necessary, open the qrySupplier Details query in Design view and delete any
previous criteria.
1. Select the Criteria row of the desired Click in the Criteria row of the City field.
field.
The insertion point appears in the
corresponding Criteria row.
Run the query. Notice that records not matching the City KL appears in the
recordset.
Concepts
The Between … And operator determines whether the value of an expression falls
within a specified range of values or not.
For example: You can use Between 1000 And 2000 criteria in the Basic Salary
field to display those records that falls within the range or not.
Steps
Use the Between And operator in a query.
If necessary, open the qryEmployee Query 2 in Design view and delete any
previous criteria.
1. Select the Criteria row of the desired Click in the Criteria row of the Basic
field. Salary field.
The insertion point appears in the
corresponding Criteria row.
2. Type Between, the first value in the Type Between 1000 And 2000
range, And, and the last value in the
range.
The operator and the criteria appear in
the Criteria row.
3. Press [Enter]. Press [Enter].
The Between And operator and the
criteria are entered into the design grid.
Run the query. Notice that only records matching the criteria appear in the
recordset.
Concepts
A wildcard is a special character that can represent any character that may
appear in the same position in the field. Common wildcards include asterisk (*),
the question mark (?), and the number sign (#). You may be familiar with using a
wildcard along with the Like operator to help you locate records with similar data
in your database.
Note: The % and _ characters are only available when using the Microsoft Access
database engine and the Microsoft Office Access 2007 OLE DB Provider.
For example:
Like "m*" would return all values that start with m
Like "m%" examples: Mary, Mia, Michelle, Molly, Martin, Moe
Like "*m*"
would return all values that contain m
Like examples: Adam, Mariam, Samantha
"%m%"
Like "*m" would return all values that end with m
Like "%m" examples: Adam, Mariam
Like "m??" would return all values that start with m and are 3 characters in
length
Like "m__" examples: Mia, Moe
would return all values that start with m and are 2 characters in
Like "m#" length where the second character is a number
examples: m7, m3
Steps
Use a wildcard character in a query.
If necessary, open the qrySupplierDetails query in Design view and delete any
previous criteria.
1. Select the Criteria row of the desired Click in the Criteria row of the Last Name
field. field.
The insertion point appears in the
corresponding Criteria row.
2. Type the desired criteria, using Type M*
wildcards as appropriate.
The text appears in the Criteria row.
3. Press [Enter]. Press [Enter]
The criteria is entered into the design
grid.
Run the query. Notice that only records matching the criteria appear in the
recordset.
Concepts
Query criteria can be edited at any time to get the required recordset.
Steps
Editing a query by adding, removing and editing criteria.
1. Select the Criteria row of the desired Click in the Criteria row of the ID field.
field.
The insertion point appears in the
corresponding Criteria row.
2. Type the desired criteria. Type 2.
The text appears in the Criteria row.
3. Press [Enter]. Press [Enter].
The criteria is entered into the design
grid.
4. Select the criteria to remove. Click and drag to highlight the criteria T-
The criteria is selected. Shirt.
6. Select the Criteria row of the desired Click in the Criteria row of the Target
field to edit. Stock Level field.
The insertion point appears in the
corresponding Criteria row.
7. Edit the criteria as required. Change the comparison operator > to < so
The criteria is modified. that the criteria is <300.
Run the query. Notice that only records matching the criteria appear in the
recordset. Return to Design view and delete all criteria.
Then, close the query without saving the changes. Close OPERATE.ACCDB.
1. Open OperatorEx.accdb.
2. Open the qryCustomerOrderDetails query in Design view.
3. Set criteria to find only orders with extended price of more than $200.
(Hint: Try using the > operator.)
4. Run the query; the criteria should find 6 records. Then, return to Design view and
delete the criterion.
5. Use an Or condition to find only records with the text Lee or Li occurring anywhere in
the Last Name.
6. Run the query; the criteria should find 5 records. Then, return to Design view and
delete the criteria from the query.
7. Run the query; the criteria should find 12 records. Then, switch back to Design view
and delete the criteria.
8. Close the query.
9. Close the database file.
Concepts
A relationship helps you combine data from two or more different tables. Each
relationship consists of fields in two tables, with data that corresponds. Tables can
be joined, or related, in order to access and coordinate information in all the fields
of the related tables. Joining tables is a useful way to avoid entering duplicate
information in various, related tables.
For example, you might have a ProductID field in a Products table and in an
OrderDetails table. Each record in the OrderDetails table has a ProductID that
corresponds to a record in the Products table with the same ProductID.
A relationship is built by matching a unique field within one table with a field within
another table. The fields must have the same data types and field size.
For example, the following table consists of customer names and address fields,
along with a unique identification number for each customer, which serves as the
primary key in the table. You can create this number or allow Access to create it
for you.
You could then create a separate table consisting only of orders placed by
customers. This table would also contain the field for the unique customer
identification number, but not the customers’ names and addresses.
ID # Order
1 Office Work Center
2 All-In-One Corner Desk and Hutch
3 Open-Front Steel Bookcase
4 2-Drawer Letter File
5 Executive Leather Chair, Black
By relating the two tables through the common customer identification number
field, the customers’ name and address does not have to be entered for every
order. All that has to be entered is the customer identification number, along with
the orders.
A one-to-many relationship occurs when one record from the primary table
matches many records from the related table (e.g., one customer record matches
many order records).
A one-to-one relationship occurs when one record from the primary table
matches one record from the related table. Access determines the relationship
type automatically when you create the relationship.
Concepts
Referential integrity ensures that your primary and foreign key fields stay in synch
whenever you add, change, or remove data. In turn, that keeps your data
accurate. Integrity ensures that relationships are valid. Integrity avoids records
being accidentally deleted or altered.
For example: if you delete a supplier from your database and if you enforce
referential integrity, then any data related to that supplier is also deleted. In other
words, the deletion cascades through your data. However, if you don't enforce
referential integrity, then the data related to that supplier references a parent
value that no longer exists. Those records become "orphans," and using that data
becomes much more difficult.
Use Forms
Use the Form button
Save a form
View records in a form
Add a record using a form
Delete a record using a form
Add, edit and delete record data using a form
Use the Calendar for Date Picking
Use the Form Wizard
Print records in a form
Base a form on a query
Lesson 11 - Creating Basic Forms ECDL Using Databases
Concepts
Forms, like datasheets, can be used for viewing and editing data. However, they
can also be used to present data in a more attractive format. Forms are usually
designed to display all the fields for a single record within the form window,
eliminating the need to scroll. You can also display data from related tables in one
form. Since forms are objects through which you or other users can add, edit, or
display the data stored in your Access database, the design of your form is an
important aspect. If your database is going to be used by multiple users, well-
designed forms are essential for efficiency and data entry accuracy.
Access provides four basic types of forms: columnar, tabular, datasheet and
justified. In a columnar form, the field names are listed on the left side of the form
and the field values appear in a column on the right. If space permits, there can be
more than one column.
In a tabular form, the field names are listed across the top of the form and the
values appear in the corresponding columns beneath them. A datasheet form
appears similar to Datasheet view. Both the tabular and datasheet forms display
data in a table layout.
In a justified form, the field names and values appear in alternate rows, evenly
spaced across the page. Field values appear under the corresponding field
names.
Concepts
The fastest way to create a form is to use the Form button on the CREATE tab.
The Form button automatically creates a simple form from the selected table or
query, without needing any input. However, you must select a table or query
before AutoForm can create the form. All fields in the table or query will appear on
the form, and the title of the form is the name of the table or query.
The form is not saved automatically. When you close the form for the first time,
Access prompts you to save it.
Employee Form created using the Form button present in the CREATE tab
Steps
From the Student Folder, open FORMS1.ACCDB.
Use the Form button to create a form.
Concepts
You can save a form having created one in Access.
Steps
Save a form.
Note: The prefix frm denotes that the database object is a form.
Concepts
Navigating records in a form is similar to navigating records in Datasheet view.
You can use the navigation buttons at the bottom of the window to display records
in a form.
Steps
View records in a form.
Concepts
Forms are frequently used to add records to one or more tables. It can be easier
to work in a well-designed form than in the underlying table because forms are
usually designed to display all the fields for a single record within the form
window, eliminating the need to scroll.
Steps
Add a record using a form.
Open the frmEmployee form in Form view. If the frmEmployee form does not
exist, use the frmEmployee 2 form.
Close the form. To confirm that the information was entered into the form’s
corresponding table, open the frmEmployee 2 form in Datasheet view and scroll
to the last record to view the new entry. Then, close the tblEmployee table.
Concepts
You can delete records in a form. This eliminates the need to open the table to
delete records.
Steps
Delete a record using a form.
Open the frmEmployee form in Form view. If the frmEmployee form does not
exist, use the frmEmployee 2 form.
Concepts
You can add, edit and delete record data directly in the form.
Steps
Add a record data using a form.
Practice the Concept: Edit the email address data to read from
[email protected] to [email protected]. Delete the entry in the Home
Phone field.
Concepts
You can use the Form Wizard to quickly and easily create a form. The Form
Wizard guides you through the process. First, you must choose the table or query
on which you want to base the form, and then you can select the fields you want
to include. Next, you select the desired type of form layout: columnar, tabular,
datasheet, justified, PivotTable, or PivotChart. You can then select a style from a
variety of predefined styles provided by Access. Finally, you must name the form.
Steps
Create a Form with the Form Wizard.
Select the following fields in the Available Fields list: Company, Last Name,
First Name, E-mail Address, Job Title, Business Phone, Phone Number, Fax
Number, Address, City, and Postal Code.
Return to the table and continue on to the next step (step 7).
Notice the new form is now listed under the Forms section on the Navigation
Pane.
Concepts
You can print an open form. When you use the Print dialog box, you can print all
records, only specified pages, or all selected records, thereby saving time and
paper.
Steps
Print specific pages in a form.
If necessary, open the Supplier Data Entry form in Form view. If the Customer
Data Entry form does not exist, use the frmSupplier 2 form.
The Print dialog box with specific pages selected for printing
The Print Range section allows you to specific which records to print:
Concepts
Forms can extract information from a query as well as from a table. If the query
recordset cannot be updated, you will not be able to edit the form or add records
to it. Nevertheless, a form can be used to present query data in a more attractive
manner.
Steps
Base a form on a query.
View the form. Notice that the rightmost field (Target Stock Level) is not
displayed properly as the field width is narrow. To change the field width, you
need to display the form in design view.
Close FORMS1.ACCDB.
1. Open Forms1EX.accdb.
2. Use the Form Wizard to create a new form using the tblCustomers table.
3. Add all the fields to the form.
4. Select the Columnar layout.
5. Name the form frmCustomer Data Entry and have the Form Wizard open the form to
view or enter information.
6. Print record number 10.
7. Add a new record, with the following data:
Field Data
Company Company K
Last Name Nelson
First Name Mathew
Job Title Owner
Business Phone (555)565-1000
Address 490 S. Maple St.
City Boston
State MA
Zip 02188
8. Close the form and open the tblCustomers table in Datasheet view to view the new
record. Then, close the tblCustomer table.
9. Use the Form Wizard to create a new form based on the qryCustomerOrderDetails
query.
10. Add all the fields to the form.
11. Select the Tabular layout.
12. Name the form as frmCustomerOrderDetails and have the Form Wizard open the
form to view or enter information.
13. Close the form.
14. Create form based on the tblSuppliers table using the Form button.
15. Close the form.
16. Close the database file.
Understand controls
Add a form header and footer text using the label control
Save changes to a form
Edit an unbound control
Use multiple Undo/Redo in Design view
Lesson 12 - Using Design View ECDL Using Databases
Concepts
Controls are the parts of a form or report that you use to enter, edit, or display
data. For example, a text box is a popular control for displaying data on reports, or
for entering and displaying data on forms. Other popular controls include
command buttons, check boxes, and combo boxes (drop-down lists). The most
frequently used control is the text box, but other controls include command
buttons, labels, check boxes, and subform/subreport controls.
Unbound control: A control that doesn't have a source of data (such as a field or
expression) is called an unbound control. You use unbound controls to display
information, pictures, lines or rectangles. For example, a label that displays the
title of a form is an unbound control.
Steps
The Form Header and Form Footer sections let you add titles, instructions,
command buttons, and other controls to the top and bottom of your form,
respectively. Controls placed in the Form Header and Form Footer sections
remain on the screen whenever the form is displayed in Form view or Layout
view; they do not change when the contents of the Detail section change as you
navigate from one record to another record.
You use unbound controls to display information, pictures, lines or rectangles. For
example, a label that displays the title of a form is an unbound control.
3. Click in the form or report where you Click and drag the mouse in the desired
want the top left corner of the label to location of the label on the form.
appear.
The insertion point appears
surrounded by a label box.
4. Type the text for the label. Type Cary Sales Pvt Ltd
The label box expands and the text
appears.
5. Enter the text. Press [Enter]
The label box is entered onto the form
or report as an unbound control.
You can edit the text in the header or footer area by simply clicking in the label
box and edit as required.
Centre align the label. If necessary, Bold, Underline and change the font size to
18. Click in a blank area of the form to deselect the label.
Concepts
When you create a new form and save it, Access prompts you for a form name. If
you make any changes to the form after assigning a name, simply click the FILE
tab and choose Save to save the changes made. You can also click on the Save
button in the Quick Access Toolbar.
Steps
Note: If you want to save the changes made as another form, click the FILE tab
and choose Save As. Select Save Object As and click Save As. Enter a new
form name and click OK.
Practice the Concept: Open the frmInventory 5 form in Design view. Using the
DESIGN tab, add a label to the left side of the form header. Enter the text Order
Entry Form. Resize the text to 14 pt. You will probably need to reposition the
Concepts
The quick way to edit an unbound control is by clicking the control and making the
necessary changes. For a label, you need to click the control and edit the text.
Steps
Edit an unbound control.
If you have not been using the frmInventory form, open the frmInventory 5 form
in Design view.
1. Select the unbound control you want to Click the Cary Sales Pvt Ltd label
edit.
Sizing handles appear around the
control.
2. Type the desired changes. Change the title to Cary Sales Pte Ltd
The text in the unbound control is edited.
3. Press [Enter]. Press [Enter]
The edited text is entered into the
unbound control on the form or report.
Move the Cary Sales Pte Ltd. label box so that it is centred within the rectangle.
Click in a blank area of the form to deselect the control. Switch to Form view to
view the changes. Switch back to Design view.
Concepts
You can undo the changes made to the unbound controls by using the Undo and
the Redo commands present in the Quick Access Toolbar.
Steps
Use the Undo and Redo features to undo and redo a command.
If you have not been using the frmInventory form, open the frmInventory 5 form
in Design view.
Delete the line below the tennis graphic, the tennis graphic, and the rectangle.
Notice that Access returns the line, company logo, and rectangle.
1. Open Forms2EX.ACCDB.
2. Open the frmSupplier form in Design view.
3. Edit the label in the form header. Enter the text Worldwide SupplyGoods Corp.
4. Add an image under the Worldwide SupplyGoods Corp. label. Add the
WorldWideLogo.jpg image from the Student Folder. Centre the image under the
label.
5. Add a rectangle around the Worldwide SupplyGoods Corp. label and the logo.
6. Draw a horizontal line across the bottom of the form. (Hint: Hold the [Shift] key to
draw a straight line.)
7. Use the Undo feature to reverse the previous action.
8. Use the Redo feature to redo the reversed action.
9. Switch to Form view to view the completed form.
10. Close the form, without saving the changes.
11. Close the database file.
Concepts
Reports allow users to create a printed copy of all or selected data for greater
ease of reference and understanding. Although you can print records from a table
or form, a report provides more precise control over the final output. Reports can
include page headers and footers, calculated totals and subtotals, and even
graphics. In addition, reports can be used for invoices, orders, presentations, and
mailing labels.
There are two basic types of reports: columnar and tabular. In a columnar report,
the field names are listed on the left side of the page, and the field values are
listed on the right. If space on the page permits, there can be more than one
column. In a tabular report, the field names are listed across the top of the report,
and the field values appear in the corresponding columns.
Reports can include data from a single table or related tables. Reports can also be
based on queries.
Concepts
You can use the Report button to create a report quickly. AutoReport
automatically creates a simple columnar or tabular report from the selected table
or the query without displaying any dialog boxes or needing any input. You must,
however, first select the table or query. All fields in the table or query will appear in
the report, and the report title will be the same as the table or query name.
Steps
From the Student Folder, open REPORT1.ACCDB.
Concepts
When you open a report, it appears in print preview. Print preview allows you to
see how the printed report will look before you print it.
Print preview provides options for viewing the report. You can zoom out to see
more of the report or zoom in to see a portion of the report in more detail. The
Zoom button on the Print Preview tab allows you to choose from several
magnification options, from as small as 10% to as large as 500% or 1000%.
You can display a report in One Page, Two Pages, or More Pages view. The
buttons at the bottom of the window allow you to navigate pages, and the scroll
bars allow you to view different areas of a page.
REPORT LAYOUT TOOLS Contextual tab showing the View group list options
Steps
Use print preview to view a report.
If necessary, display the Reports object list. Use the rptAprilTransaction report.
Click
4. Select the Print Preview button.
Click
The preview of the document is
displayed.
5. Click the area of the report page you Click the transaction item
want to magnify to 100%.
The report area is magnified to 100%.
6. Click anywhere in the report page to Click anywhere in the page
change the magnification back to fit the
window.
The entire page appears in print preview.
7. Click the Two Pages button in the Zoom
group to display two pages of the report.
Two pages appear in print preview.
Click
8. Click the Next Page button at the Click
bottom of the report window to display
the next page of the report.
The next page of the report appears.
9. Click the Last Page button at the bottom Click
of the report window to display the last
page of the report.
The last page of the report appears.
10. Click the Previous Page button at the Click
bottom of the report window to display
the previous page of the report.
The previous page of the report appears.
11. Click the First Page button at the Click
bottom of the report window to display
the first page of the report.
The first page of the report appears.
Concepts
You can print specific pages of a report. This option is useful if the report contains
numerous pages, and you only need information from one or more particular
pages. The Print dialog box allows you to specify the pages or print all the pages if
required.
Steps
Print specific pages of a report.
If necessary, display the All Access Objects in the Navigation Pane, use the
rptApril Transaction report.
1. Select the report you want to print. Click Order Information, if necessary
The report name is selected.
2. Select the FILE tab. Click FILE
The Backstage view appears.
Concepts
You can use the Report Wizard to quickly and easily create a report. The basic
steps needed to create a report using the Report Wizard are as follows:
When you have finished creating a report, the Report Wizard displays it in print
preview. Print preview allows you to view the report before you print it.
Steps
Use the Report Wizard to create a report.
From the tblSuppliers table, add the Company, Store Name, First Name, Last
Name, Email Address and Phone fields.
Close print preview. Notice that the new report appears in the Navigation Pane.
Concepts
After you create a report, you can view it in a selection of different views: Report
View, Print Preview, Layout View, or Design View. When a report is open, you
can switch between these views by clicking the View button in the Views section
of the HOME Tab on the Ribbon. The following table explains the different views:
View Description
Report View This view displays the report as you (or the Report Wizard) designed it.
Print Preview This view allows you to view the print layout of your report.
Layout View This view looks like Print Preview, but allows you to make changes to
your report.
Design View Displays the report in the Design View window, where you can change
form elements, move them around and add or delete them, if necessary.
Steps
Change the report view.
Practice the concept: Follow the above steps and select the Layout View button
on the Status Bar.
Concepts
You can customise the arrangement of the data fields in the report by simply
clicking and dragging it to a new location. A data field has two components, the
Label and the Control. The Label appears on the left of the field and Control to
the right.
In some cases, the data fields may need to be cut to be later pasted back, or other
data fields may need to be resized to make room for this move.
To move label or field individually, click and drag the top left handle of the
data field.
To move them together as one, click and drag the edge of any part of the
data field.
Steps
Change arrangement of data fields and headings within a report layout.
1. Select the data field label to rearrange. Click on First Name label
The label is selected.
2. Click the top left handle and drag the Click and drag the First Name label and
selected control to the new location. place it next to Last Name text box
The control is moved.
3. Select the data field text box to Click on First Name text box
rearrange.
The text box label is selected.
4. Click the top left handle and drag the Click and drag the First Name text box and
selected control to the new location. place it below First Name label
The control is moved.
Practice the Concept: Move the Last Name text box and place it below the Last
Name label. Select both the First Name label and text box controls and move it
close the Last Name controls.
Selecting the top left handle of a control and moving to a new position
Concepts
When you create a new report and save it, Access prompts you for a report name.
If you make any changes to the report after assigning a name, simply click the
FILE tab and choose Save to save the changes made. You can also click on the
Save button in the Quick Access Toolbar.
Concepts
After you create a database object (table, query, form or report), you can change
the orientation and paper size before printing them out. You can choose from a
portrait (tall) or landscape (wide) orientation for your report.
Steps
Change the report orientation and paper size.
Concepts
The Report Wizard provides options for grouping and summarising report data.
You can organise your report by selecting the fields into which you want to group
data. If you create more than one group, you can prioritise the groups into levels.
You can see how grouping works by comparing the List of Products by
Category report (shown below) to the datasheet for its underlying query, Product
List. Both the report and the query sort products by category, but the report also
prints the name of each category on a separate line at the beginning of each
group (in the group header) and the number of products for each category on a
separate line at the end of each group (in the group footer).
In addition to grouping data by a field, you can add grouping intervals. Grouping
intervals vary, depending upon the selected field. For instance, a date field can be
grouped by month, quarter, year, etc.; a numeric field can be grouped by numeric
intervals of 10s, 50s, 100s, etc.; and a text field can be grouped by its first letter,
second letter, etc.
If you have included a field with numeric data in your report, you can add
summary calculations. Summary calculations include Sum, Avg (average), Min
(minimum), and Max (maximum). If you select the Sum calculation, you can
include a calculated percentage of the total for each group. You can also display
just the summary calculations in the report or both the field data (details) and the
summary calculations.
For example, the Sales by Date Shipped report below is grouped by the
Shipping Date and Sum summary calculation is added to the Sale Amount.
© 2017 Page 149
Lesson 13 - Creating Basic Reports ECDL Using Databases
Group field
Summary calculation
Steps
Group and summarise report data.
Add the ID, First Name and Last Name fields. Select the
tblInventoryTransaction table from the Tables/Queries list, and add the
Transaction Item, Quantity, and PO number field below the Last Name field.
Close print preview. Notice that the new Transaction report appears in the
Navigation Pane.
You can also add total to a field in an existing report. Simply select the required
field in the Layout view, click the Totals button in the Grouping & Totals group
on the Design tab and select the required function.
Concepts
You can use a query as the basis for a report. The query recordset appears as the
report data. The report is updated each time it is opened or printed to reflect
changes made to queried data.
Steps
Base a report on a query using the Report Wizard. The following report will use
qryInventoryTransactionCurrentMonth. This will generate all the inventory
transactions for the current month.
Close print preview. Notice that the new report appears in the Navigation Pane.
Close REPORT1.ACCDB.
1. Open Report1EX.accdb.
2. Use the Report Wizard to create a new report.
3. Select the tblOrders table and add the ID, Order Date, and ShippedDate,
ShipAddress, ShipCity, and ShipZipPostal fields to the report.
4. Select the tblOrderDetails table and add the ExtendedPrice field to the report.
5. Group the data by tblOrders and then add the ID grouping level.
6. Calculate ExtendedPrice using the Sum function. Show both detail and summary
calculations.
7. Select the Outline layout and the landscape orientation.
8. Name the report Orders by Customers and display it in print preview.
9. Zoom to 100% to display the report in more detail.
10. Print page 1. Then, close print preview.
11. Use Report Wizard to create a report from the qryProductsAvgPrice query.
12. Add all the fields to the report, group the report by Product Code.
13. Select the Stepped layout, the Landscape orientation.
14. Change the name to Product Price and preview the report. Then, close print preview.
15. Use the Report button to create report based on the tblSupplier table.
16. Preview the report. Then, close print preview, saving the report as rptSupplier.
17. Close the database file.
Concepts
You can create or customise a report in Design view. A report has three basic
sections: Detail, Report Header/Footer, and Page Header/Footer.
The Detail section contains the information from the table or query. You create
controls in the Detail section that display information. You can display either one
record per page or multiple records per page.
The Report Header and Report Footer sections display at the top and bottom of
the report in Design view. When you print the report, these sections appear at the
beginning and the end of the report only. The header can be used for report titles,
while the footer can be used for report totals or other summaries.
The Page Header and Page Footer sections display at the top and bottom of the
report in Design view. When the report is printed, these sections appear at the top
and bottom of every page. Page headers and footers can contain images, lines,
text, or any other controls you want printed on every page.
When you enable the display of either header and footer section, both the header
and the footer appear. You can drag the header and footer sections to size them.
Steps
From the Student Folder, open AdvanceReport.accdb.
Add report sections in Design view.
If necessary, select the Design tab and add a label to the left side of the report
header. Enter the text Inventory Report. Preview the report. Notice the report
header at the top of the page. Switch back to Design view.
Practice the Concept: Add a page header and footer to the report. Add a label to
the centre of the page header. Enter the text Cary Sales Pte Ltd.
Preview the report and change to a 2-page view. Notice that the report header
only appears on the first page, but the page header appears at the top of each
page. Switch to Design view.
You can export a table, query, form, or report. You can also export selected
records in a multiple-record view, such as a datasheet. You cannot export macros
or modules to Excel. When you export a form, report, or datasheet that contains
subforms, subreports, or subdatasheets, only the main form, report, or datasheet
is exported. You must repeat the export operation for each subform, subreport,
and subdatasheet that you want to export to Excel.
If the source object is a table or a query, decide whether you want to export the
data with or without its formatting. This decision affects two aspects of the
resulting workbook — the amount of data that is exported and the display format
of the data. The following table describes the outcome of exporting formatted and
unformatted data:
Steps
To export Access data to an Excel workbook:
1. Select the table or query containing data Click on the query qryPhoneList
to be exported.
5. Select the location and specify the file Select the Student Folder and enter the file
name to save the data to be exported. name Staff Phone List
7. Select the File format list and choose Click Excel Workbook (*.xlsx), if
an Excel file format. necessary
The option is selected.
8. Specify the export options. Click Export data with formatting and
layout
The options are selected.
Practice the Concept: Export the qryPhoneList query to a PDF file with the
default settings. Delete both the spreadsheet and PDF after saving.
At the end of the operation, Access creates a text file (*.txt or *.csv). If you choose
to ignore formatting, you have the option of creating a delimited text file or fixed-
width text file. If you choose to export formatted data, Access tries to approximate
the layout of the source object.
Steps
To export Access data to a Text file:
1. Select the table or query containing data Click on the table tblEmployee
to be exported.
The table or query is selected.
5. Select the location and specify the file Select the Student Folder and enter the file
name to save the data to be exported. name Staff List
The location and file name is specified.
7. Specify the export options. Click Export data with formatting and
The options are selected. layout
Practice the Concept: Export the qrySupplierInventory query to a Text file with
the default settings. Delete both files after saving.
Steps
To export Access data to a XML file:
1. Select the table or query containing data Click on the table tblSupplier
to be exported.
The table or query is selected.
2. Select the EXTERNAL DATA tab. Click on the EXTERNAL DATA tab
The EXTERNAL DATA tab is displayed.
5. Select the location and specify the file Select the Student Folder and enter the file
name to save the data to be exported. name Vendor List
The location and file name is specified.
9. Select Close.
Click
The wizard closes and the data is
exported.
1. Open ADVREPEX.ACCDB.
2. Create a new report in Design view based on the tblCustomers table.
3. Add the ID field to the 1" mark on the horizontal ruler in the Detail section. Below the
ID field, add the Company, Last Name, First Name, Address, City and State fields
to the report at the 3" mark on the horizontal ruler in the Detail section.
4. Display the report header and footer. Using the toolbox, add a label to the left side of
the report header. Enter the text Customer Information.
5. Preview the report. Then, close the report.
6. Close the database file.
Ref ECDL Task Item Location Ref ECDL Task Item Location
1.1.1 Understand what a 1.3.2 Understand that a
1.1 Working with 10.1 Using Related
database is. relationship is built by
Access matching a unique field in Tables
one table with a field in
1.1.2 Understand that 1.1 Working with
information is the another table.
processed output of data. Access 1.3.3 Understand the
10.2 Setting
importance of maintaining
1.1.3 Understand how a 1.1 Working with the integrity of Referential Integrity
database is organised in
terms of tables, records Access relationships between
and fields. tables.
1.1.4 Understand that all 2.1.1 Open, close a database 1.2 Starting Access
1.1 Working with application.
database data is stored in
tables. Understand that Access
2.1.2 Open, close a database.
changes are automatically 1.3 Open an
saved. Existing Database
1.1.5 Know some of the 1.16 Closing a
1.1 Working with
common uses of Database
databases like: social Access
networks, booking 2.1.3 Create a new database
1.17 Creating a
systems, government and save to a location on
a drive. New Database
records, bank account
records, hospital patient 2.1.4 Display, hide built-in
details. 1.4 Familiarising
toolbars. Restore,
1.2.1 Understand that each minimise the ribbon. with the Ribbon
1.7 Understanding
table in a database should 1.6 Using the Quick
contain data related to a Database Objects
Access Toolbar
single subject type.
1.2.2 Understand that each 2.1.5 Use available help
1.7 Understanding 1.18 Using Help
record in a database resources.
should contain data Database Objects
2.2.1 Open, save, close a table,
related to a single subject. 1.8 Using the
2.4 Adding Field query, form, report.
Navigation Pane
Names
1.9 Opening a
1.2.3 Understand that each field
2.4 Adding Field Database Project
in a table should contain
only one element of data. Names
1.11 Using Tabbed
1.2.4 Understand that field Documents
2.2 Assigning Data
content is associated with
Types 1.12 Closing a
an appropriate data type
like: text, number, Tabbed Document
date/time, yes/no. 1.13 Closing All
1.2.5 Understand that fields Tabbed Documents
3.1 Using Field
have associated field
properties like: field size, Properties 2.2.2 Switch between view
1.14 Switch
format, default value. 3.7 Setting Default modes in a table, query,
form, report. between the View
Values Modes
1.2.6 Understand what a 2.2.3 Delete a table, query,
2.7 Setting a 1.10 Deleting a
primary key is. form, report.
Primary Key Database Object
1.2.7 Understand that the main 2.2.4 Navigate between records
3.6 Indexing a Field 1.8 Using the
purpose of an index is to in a table, query, form.
speed up search queries. Navigate between pages Navigation Pane
1.3.1 Understand that the main in a report.
10.1 Using Related 4.4 Moving through
purpose of relating tables
Tables Records
in a database is to
minimise duplication of 4.7 Printing from a
data. Table
3.2.1 Create and name a table 4.1.1 Use the search command
2.3 Creating a 6.8 Using the
and specify fields with for a specific word,
Table number, date in a field. Search Box
their data types like: text,
number, date/time, 4.1.2 Apply a filter to a table,
6.9 Using Quick
yes/no. form.
3.2.2 Apply field property Filter
3.2 Limiting Field
settings: field size, 4.1.3 Remove filter from a
number format, date/time Size 6.10 Using
table, form.
format, default value. AutoFilter
3.3 Setting Number
Formats 4.2.1 Understand that a query
7.1 Using Queries
is used to extract and
3.4 Setting and Recordsets
analyse data.
Date/Time Formats
4.2.2 Create a named single-
7.2 Using the
3.7 Setting Default table query using specific
search criteria. Simple Query
Values
Wizard
4.2.3 Create a named two-table
7.8 Adding a Table
3.2.3 Understand query using specific
2.2 Assigning Data to a Query
consequences of search criteria.
changing data types, field Types
4.2.4 Add criteria to a query
properties in a table. 7.5 Adding Criteria
using one or more
3.2.4 Create a simple validation operators: = (Equal), <> to a Query
3.8 Setting
rule for numbers. Validation Rules (Not equal to), < (Less
than), <= (Less than or
3.2.5 Set a field as a primary equal to), > (Greater
2.7 Setting a
key. than), >= (Greater than or
Primary Key
equal to).
2.9 Setting a 4.2.5 Add criteria to a query to 8.1 Sorting a Query
Primary Key sort records in ascending, Output
Automatically descending numeric,
3.2.6 Index a field with, without alphabetic order.
3.6 Indexing a Field 4.2.6 Add criteria to a query
duplicates allowed. 9.2 Using an AND
3.2.7 Add a field to an existing using one or more logical
4.2 Adding Field to operators: AND, OR, Condition
table.
Existing Table NOT.
3.2.8 Adjust the width of 4.2.7 Use a wildcard in a query
5.2 Changing the 9.6 Using a
column(s) in a table. like: * or %, ? or _.
Column Width Wildcard Character