Course Book Access TDAC Creating Qu Fo Re10

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 102

Access:

Creating queries,
forms and reports
Access: Creating queries, forms and reports TDAC
IT Learning Programme ii
How to Use This Course Book
This handbook accompanies the taught sessions for the course. Each section
contains a brief overview of a topic for your reference and then one or more
exercises.
The Exercises
Exercises are arranged as follows:
A title and brief overview of the tasks to be carried out
A numbered set of tasks, together with a brief description of each
A numbered set of detailed steps that will achieve each task
Some exercises, particularly those within the same section, assume that you have
completed earlier exercises. Your lecturer will direct you to the location of files
that are needed for the exercises. If you have any problems with the text or the
exercises, please ask the lecturer or one of the demonstrators for help.
This book includes plenty of exercise activities more than can usually be
completed during the hands-on sessions of the course. You should select some to
try during the course, while the teacher and demonstrator(s) are around to guide
you. Later, you may attend follow-up sessions called Computer8, where you can
continue work on the exercises, with some support from IT teachers. Other
exercises are for you to try on your own, as a reminder or an extension of the
work done during the course.
Writing Conventions
A number of conventions are used to help you to be clear about what you need to
do in each step of a task.
In general, the word press indicates you need to press a key on the keyboard.
Click, choose or select refer to using the mouse and clicking on items on the
screen (unless you have your own favourite way of operating screen features).
Names of keys on the keyboard, for example the Enter (or Return) key, are shown
like this ENTER.
Multiple key names linked by a + (for example, CTRL+Z) indicate that the first key
should be held down while the remaining keys are pressed; all keys can then be
released together.
Words and commands typed in by the user are shown like this.
Labels and titles on the screen are shown l i ke t hi s.
A button to be clicked will look l i ke t hi s .
The names of software packages are identified like this, and the names of files to
be used l i ke t hi s.
TDAC Access: Creating queries, forms and reports
iii IT Learning Programme
Software Used
Access 2010
Windows
Files Used
Depar t ment Asset s. accdb
Event Pl anner . accdb
I nvent ory Toy Li br ary. accdb
Pendl et on Pr oduct s. accdb
Revision I nformation
Version Date Author Changes made
1.0 July 2004 Pamela Stanworth Created
1.1 November 2004 Pamela Stanworth Corrections
1.2 November 2005 Pamela Stanworth Updated for new H:/
1.3 November 2006 Pamela Stanworth Portfolio link etc.
1.5 September 2009 Pamela Stanworth &
Michael Vanden Boom
Revised for Access 2007
2.0 February 2012 Pamela Stanworth Revised for Access 2010
2.1 January 2013 Pamela Stanworth Updated for IT Services

Copyright

Pamela Stanworth makes this document and the accompanying PowerPoint
presentation available under a Creative Commons licence: Attribution-
NonCommercial-ShareAlike CC BY-NC-SA. pamela.stanworth@it.ox.ac.uk
Screenshots in this document are copyright of Microsoft.
The Oxford University logo and IT Services logo are copyright of Oxford
University and may only be used by Oxford University members in accordance
with the Universitys branding guidelines.
Access: Creating queries, forms and reports TDAC
IT Learning Programme iv
Contents
1 Introduction ............................................................................... 1
1.1. What You Should Already Know ......................................................... 1
1.2. What You Will Learn ........................................................................... 1
1.3. What is Access? ................................................................................... 1
1.4. Where Can I Get A Copy? ................................................................... 2
1.5. Using Office 2010 ............................................................................... 2
2 Getting Started .......................................................................... 4
2.1. Some Database Vocabulary ................................................................ 4
2.2. Using the Database Files for ITLP Exercises Access 2010 ............ 4
Exercise 1: Opening a database file .......................................................... 4
3 Queries ...................................................................................... 5
3.1. Using Queries ..................................................................................... 5
3.2. Creating A Select Query ..................................................................... 5
Exercise 2: Creating select queries ........................................................... 9
3.3. Creating a Query in Design View ....................................................... 9
Exercise 3: Creating a query in Design View ........................................... 13
3.4. Setting Query Criteria ....................................................................... 13
Exercise 4: Setting criteria in a query ..................................................... 15
3.5. Editing a Query Design ..................................................................... 15
3.6. Finishing ........................................................................................... 17
Exercise 5: Rearranging a query .............................................................. 17
4 Creating Forms ....................................................................... 18
4.1. Creating a Form Instantly ................................................................ 18
Exercise 6: Using a form and creating an instant form ......................... 18
4.2. Using the Wizard to Create a Form Based on a Table .................... 18
4.3. Using the Wizard to Create a Form Based on a Query .................... 19
4.4. Using the Form ................................................................................. 21
4.5. Managing Forms ............................................................................... 21
Exercise 7: Creating a form using the wizard .......................................... 21
5 Design Changes on a Form ..................................................... 22
5.1. Switching Between Views of a Form ................................................ 22
5.2. Themes on a Form ........................................................................... 22
5.3. Editing Labels .................................................................................. 23
5.4. Moving and Resizing Form Objects ................................................ 23
TDAC Access: Creating queries, forms and reports
v IT Learning Programme
Exercise 8: Design changes on a form .................................................... 24
5.5. Selecting Multiple Objects ............................................................... 24
5.6. Arranging and Aligning Form Objects in a Layout ......................... 24
Exercise 9: Using a layout on a form ...................................................... 25
6 Formats and Properties of Form Objects ............................... 26
6.1. Using Buttons for Formatting Controls and Labels ........................ 26
6.2. Data Formats in a Form Control ..................................................... 26
6.3. Conditional Formatting ................................................................... 27
Exercise 10: Formatting controls and labels on a form ......................... 27
6.4. Property Sheet ................................................................................. 27
6.5. Form Properties ............................................................................... 28
6.6. Changing the Record Source of a Form Including Queries ......... 29
Exercise 11: Using the Property Sheet .................................................... 29
7 Creating Reports ..................................................................... 30
7.1. Creating a Report Instantly .............................................................. 30
Exercise 12: Creating a report instantly ................................................. 30
7.2. Using the Wizard to Create a Report Based on a Table .................. 30
7.3. Using the Wizard to Create a Report Based on a Query ................. 33
7.4. Using the Report .............................................................................. 34
7.5. The Mailing Label Wizard (Optional) ............................................. 34
7.6. Managing Reports ............................................................................ 36
Exercise 13: Creating a report using the wizard ..................................... 36
8 Design Changes on a Report ................................................... 37
8.1. Switching Between Report Views .................................................... 37
8.2. Themes on a Report ......................................................................... 37
8.3. Page Layout ...................................................................................... 37
Exercise 14: Design changes on a report ................................................ 38
9 Working With Controls and Labels on a Report .................... 39
9.1. Control or Label? .............................................................................. 39
9.2. Editing a Label ................................................................................. 39
9.3. Moving and Resizing Controls in a Layout ..................................... 39
9.4. Gridlines Around a Layout .............................................................. 40
Exercise 15: Working with controls and labels on a report ................... 40
10 Formats and Properties in a Report ..................................... 41
10.1. Formatting a Label or Control Using Buttons ................................ 41
Access: Creating queries, forms and reports TDAC
IT Learning Programme vi
10.2. The Report Background ................................................................. 42
10.3. Property Sheet for Individual Controls ......................................... 42
10.4. Properties of a Section or Whole Report ....................................... 43
10.5. Changing the Record Source of a Report Including Queries
(Optional) ............................................................................................... 43
Exercise 16: Formats and properties in a report .................................... 44
11 Ordering Data in a Report ..................................................... 45
11.1. Grouping Records Using the Report Wizard .................................. 45
11.2. Sorting in a Report ......................................................................... 45
Exercise 17: Sorting and grouping records in a report ........................... 46
11.3. Summarising Data in a Report, Using the Report Wizard ............ 46
Exercise 18: A report with summary calculations .................................. 49
12 What Next? ............................................................................ 50
12.1. Downloadable Course Materials and More the ITLP Portfolio .. 50
12.2. Databases: Concepts of database design ....................................... 50
12.3. Access Courses Which Precede This .............................................. 50
12.4. Access Courses Which May Follow This ........................................ 50
12.5. Computer8 ...................................................................................... 50
12.6. IT Services Help Centre ................................................................. 50
Appendix 1: Viruses and Security Levels in Access .................... 51
Why Worry About Viruses? ..................................................................... 51
Scanning for Viruses ................................................................................ 51
Access 2010 and Virus Security ............................................................... 51
Access 2003 and Virus Security ............................................................. 55
Further Help with Security and Trust Center Settings .......................... 56
13 Appendix 2: Student Exercises ............................................. 57

Access: Creating queries, forms and reports
1 IT Learning Programme
1 Introduction
Welcome to the course Access: Cr eat i ng Quer i es, For ms and Repor t s.
This handbook accompanies the course delivered by Oxford University IT
Services, IT Learning Programme. Although the exercises are clearly explained so
that you can work through them yourselves, you will find that it will help if you
also attend the taught session where you can get advice from the teachers,
demonstrators and even each other!
If at any time you are not clear about any aspect of the course, please make sure
you ask your teacher or demonstrator for some help. If you are away from the
class, you can get help by email from your teacher or from help@it.ox.ac.uk
1.1. What You Should Already Know
This session is one of a series that cover the important aspects of using Microsoft
Access to build and manage a database.
We will assume that you have already attended the course Access: Bui l di ng a
dat abase (or equivalent), and that you are familiar with creating tables with
suitable fields, and using objects in an Access database to add or edit data,
running forms, queries and reports that have already been created.
You do not need to know anything about creating a query, form or report.
The computer network in the ITLP teaching rooms may differ slightly from that
which you are used to in your College or Department; if you are confused by the
differences, ask for help from the teacher or demonstrators.
1.2. What You Will Learn
In this session we will cover the following topics:
Designing and running a query to select data from a database table
Editing a query and setting criteria
Instant forms and reports
Creating forms and reports using a wizard
Simple design changes on forms and reports in Layout View
Working with individual controls on forms and reports
Grouping and summarising data on a report

Related Access sessions, should you be interested, are described in Part 12.4
below.
1.3. What is Access?
Access is database management software. It enables you to build and maintain a
database.
Access 2010 is part of Microsoft Office 2010 (only in the Professional, Ultimate,
and Enterprise editions for Windows). Access is not available for Macintosh
computers (Mac users may try FileMaker Pro).
An Access database consists of the data held in a number of tables, plus a number
of other objects which are used to manage the data. All these are saved together in
a single file. In this course, we will deal with tables, forms, queries and reports.
Access: Creating queries, forms and reports
IT Learning Programme 2
A database application may be built using forms, menus, control buttons and
program code that respond to events.
1.4. Where Can I Get A Copy?
If you have a copy of Microsoft Office Professional 2010, then you already have a
copy of Access 2010. If you are unable to find it on your computer, it may not
have been installed and you should talk to your IT support contact (or the IT
Services Help Desk).
1.5. Using Office 2010
If you have previously used another version of Office, you may find Office 2010
looks rather unfamiliar. Office 2010: Whats New is a self-study guide covering
the Ribbon, Quick Access Toolbar and so on. This can be downloaded from the
ITLP Portfolio at http://portfolio.it.ox.ac.uk (look in the Access category).
For anyone who prefers not to use a mouse to control software, or who finds a
keyboard method more convenient, it is possible to control Office 2010
applications without using a mouse. Pressing ALT once displays a white box with
a letter or character next to each visible item on the Ribbon and title bar (shown
in Figure 1).


Figure 1 Keystrokes to Control Ribbon Tabs and Title Bar
(Press ALT to show these)
After you have typed one of the letters/characters shown, the relevant Ribbon tab
or detail appears, with further letters/characters for operating the buttons and
controls (shown in Figure 2).
Access: Creating queries, forms and reports
3 IT Learning Programme

Figure 2 Further Keystrokes to Control Buttons
The elements of a dialog can be controlled, as usual with Windows applications,
by using TAB to navigate between items or by typing the underlined character
shown beside an item.
Access: Creating queries, forms and reports
IT Learning Programme 4
2 Getting Started
2.1. Some Database Vocabulary
A collection of database information is organised into one or more tables. You
may think of each table in a grid layout.
Each row of the table is known as a record. There must be one record for each
item included in the table for example, the records may be the employees in a
department, the books in a library or the individual wall paintings in an ancient
cave. The order of the records is not important: indeed it is often useful to change
the order the records are shown in, when analysing the data.
Each column of the table is known as a field. Each field contains a different piece
of information about the record items for example, an employees date of birth,
a books author or the dimension(s) of a wall painting. All the entries in one
column must have the same data type e.g. all text or all integer numbers.
The set of tables, along with the queries, forms and reports used to manipulate
them, are saved together in one Access file.
The importance of designing the set of tables correctly, with appropriate fields
collected together in tables, and with relationships joining the tables, has been
discussed in the course Access: Bui l di ng a dat abase.
2.2. Using the Database Files for ITLP Exercises Access 2010
Please note that Access 2010 only trusts files if they have been saved in a Trusted
Location. The network dr i ve H: \ , used for most IT Learning Programme courses,
has been designated an Access Trusted Location. If you make copies of the files
for these exercises, and save them on your own computer in a location that is not
trusted, you may not be able to carry out all the activities described.
Appendix 1 discusses the question of virus protection and trusting locations
further.
Exercise 1: Opening a database file
Now look at this exercise (page 57).
Access: Creating queries, forms and reports
5 IT Learning Programme
3 Queries
3.1. Using Queries
A query is used to investigate and manipulate data that has been entered into the
tables that make up a database.
A query may be used to:
Sort records
Select only some fields
Select only some records using criteria
or Collect related data from several tables
3.2. Creating A Select Query
3.2.1. A Query To Select Records In One Table
Suppose you have a database file open, with a table already created and filled with
suitable data.

Figure 3 Table Design
It may be interesting to present only some of the fields from the table, to start
considering the significance of the data. A query can be created to do this, based
on the table.
Queries that have already been created are listed in the Navigation Pane on the
left-hand side of the screen. If you do not see the queries, select Obj ect Type
(under Navi gat e To Cat egor y), then go back to this menu and make sure Al l
Access Obj ect s is selected as well.
Access: Creating queries, forms and reports
IT Learning Programme 6

Figure 4 Showing All Access Objects (including Queries, if any)
3.2.2. Using the Query Wizard
The Quer y Wi zar d is started by selecting on the Cr eat e tab of the Ribbon,
then selecting Si mpl e Quer y Wi zard from the list. The wizard takes you step by
step through creating a new query. Here you specify the table it is to be based
upon, and choose which fields are to be included.

Figure 5 The Query Wizard
Access: Creating queries, forms and reports
7 IT Learning Programme
In the next part of the wizard, the query is given a name.

Figure 6 The Query Wizard, continued
3.2.3. Naming Queries and Other Objects in a Database
By convention, query names always begin with qr y. Similarly, table names begin
with t bl , form names begin with f r m and report names begin with r pt . These
Reddick naming conventions can be found at
http://mvps.org/access/general/gen0012.htm .
Although it is possible in Access to include spaces in object names, it is good
practice to avoid them. This is because when an object name is included in an
expression (perhaps in a calculation), then any spaces are difficult for Access to
parse and you must remember to enclose the object name in [square brackets]
every time. If there are no spaces, then the names of queries, forms etc are not
ambiguous and expressions are easier for Access (and people) to read. This also
applies to the names of fields and controls.
Designers may use a mixture of lower case and capital letters, or may use some
punctuation symbols to make object names and field name easy to understand.
Examples might be t bl St udent Appl i cat i ons or qr yLat eRepl i es, or
f r mSi mpl e_Address_Li st .
Access: Creating queries, forms and reports
IT Learning Programme 8
3.2.4. Query Results
After the wizard finishes, the query results are presented in Datasheet View, by
default.

Figure 7 Query Results in Datasheet View
Each time the query is run, Access re-queries the raw data in the table and
presents up-to-date results.
Only those fields chosen in the query wizard are shown. All records are shown
(until we set some criteria, as discussed below). The data in this view can be
edited changes made here will affect the underlying data in the table.
3.2.5. Looking at the Query in Design View
Click on the Home tab of the Ribbon to switch from Datasheet View to
Design View.
Access: Creating queries, forms and reports
9 IT Learning Programme

Figure 8 Simple Query in Design View
In Design View, all tables that are used in the query are shown at the top. In the
design grid below, field names are chosen and set in order.
3.2.6. Switching Query Views
The View button is now visible on the Home tab or the Query Tool s Desi gn tab,
and it has changed appearance to . This will switch back to Design View.
Use to close the query. You will be prompted to save any changes to the query
design (recall that any edits or additions to data are saved without comment as
you move between records).
Exercise 2: Creating select queries
Now look at this exercise (page 58).
3.3. Creating a Query in Design View
3.3.1. Relationship Between Two Tables
If the data in separate tables is related, then relationships must be set up between
corresponding fields. This was discussed in a separate course, Access:
Dat abase St r uct ur e, which considers the wider question of defining
relationships for a whole database (see Part 12.1).
Access: Creating queries, forms and reports
IT Learning Programme 10
A query based on two or more related tables will look for records in one table
which correspond to records in the other table. For example, each person in an
address book will be associated with the household where they live.
In this way, a one-to-many relationship can be represented, without duplicating
data between records. For example many members of a household may live at one
address, but each has their own birthday.
3.3.2. Creating a Query With Two Tables
To create a new query in design view, choose from the Cr eat e tab on the
Ribbon. The empty query design grid is shown, with the Show Tabl e dialog
where you can select from the available tables (and queries).

Figure 9 Adding Tables to Query Design
In the query design grid, lines appear between the tables for any joins that have
previously been set up.
Access: Creating queries, forms and reports
11 IT Learning Programme

Figure 10 Two Tables With a Join, in Query Design Grid
3.3.3. Adding Fields to a Query
The required fields can be added into the empty columns in the design grid, using
different methods:
Drag a field name from a table field list and drop it in an empty column
Double-click a field name in a table field list it will appear in the next
empty column
Click at the top of an empty column to display an arrow button; click this
to activate a drop-down list, then choose a field name from the list
Add as many fields as are needed, from either or both tables, in any convenient
order.
Access: Creating queries, forms and reports
IT Learning Programme 12

Figure 11 Building a Query With Two Tables
If necessary later, add a further table by clicking and choosing the table name
in the Show Tabl e dialog.
3.3.4. Running a Query Based on Two Tables
Click or (for select queries, the two buttons are equivalent) to run the
query. Access collects current data from the tables and presents them as a
datasheet. Access compares the records in both tables, looking at the field in each
which is used in the join relationship. Any value of that field which arises in both
tables is deemed a match, and that record is included in the results dataset.

Figure 12 Results of a Query From Two Tables
Access: Creating queries, forms and reports
13 IT Learning Programme
Exercise 3: Creating a query in Design View
Now look at this exercise (page 60).
3.4. Setting Query Criteria
Criteria can be set in the query design grid, to limit which records are included.
3.4.1. Criteria With Equals
On the row labelled Cr i t er i a, text or a simple number can be entered under the
field to be limited. When the query is run, only those records which have the
criteria value will be included in the results dataset presented.

Figure 13 A Query with Text Criteria
3.4.2. Changing Criteria in a Query Design
Add further criteria by typing in the Cr i t er i a row.
Remove criteria by deleting in the Cri t er i a row: click in the criteria expression
and use DELETE or BACKSPACE.
3.4.3. Criteria With Comparison Operators
Calculated expressions can be used as criteria. Use <, >, <=, >=, Between for
comparison expressions.
Use Not for not equal to. Use Is Null for no value entered (beware that if a space
is typed in a field, this will not count as a null entry, so users should be
discouraged from doing this).
For example:
>t in a Last Name field, to find those people whose surnames
begin with t or later in the alphabet
>=18 in an Age field, to find only those who are of voting age
Is Null in an Empl oyeeNumber field, to find those whose company
number did not get filled in
Not UK in a Country field, to find overseas clients
Complex expressions can be built, using brackets ( and ) to maintain clarity.
Access: Creating queries, forms and reports
IT Learning Programme 14


Figure 14 Criteria Using Comparison Operators
3.4.4. Access Edits Punctuation in Criteria
Access may add punctuation to your criteria, such as quote marks around text
or #hatches# around dates.

Figure 15 Setting Date Criteria
3.4.5. Wildcard Symbols in Criteria
Including a ? symbol in an expression allows Access to select all values which match
the expression, but allowing any single character in the position marked by ?.
# allows Access to match any single numerical digit
* allows any characters or digits, in any quantity, at the position
marked by *
For example:
J?lly will find Jolly, Jelly, Jilly but not Jenelly
am* will find amicable, American and am but not age nor a
Access: Creating queries, forms and reports
15 IT Learning Programme
3.4.6. Yes/ No Criteria
In a field which has the Yes/No data type, criteria may be set. Enter Yes or No in
the criteria line. Alternatively, enter 0 (equivalent to No) but note that the
equivalent to Yes is -1.
3.4.7. Multiple Criteria: AND and OR
Setting several criteria on the same row narrows down the results of a query: you
are permitting only those records which satisfy all the criteria (this is a logical
AND).

Figure 16 Multiple Criteria (AND)
Setting criteria on separate rows widens the results of a query: you are permitting
those records which satisfy any of the criteria (this is a logical OR).

Figure 17 Multiple Criteria (OR)

Exercise 4: Setting criteria in a query
Now look at this exercise (page 62).
3.5. Editing a Query Design
3.5.1. Removing a Field
Click the field name at the top of a column, then delete using DELETE or
BACKSPACE keys. Note you are only removing the field name from the query
design, not deleting data from the underlying table.
Access: Creating queries, forms and reports
IT Learning Programme 16
3.5.2. Rearranging Columns
Select a field by clicking on the narrow grey bar at the top of the column. Then
drag the column to the desired position and drop.

Figure 18 Selecting a Field
3.5.3. Adjusting Column Width
Drag the divider between two column headings to make one column wider or
narrower. Note this changes the column width in Design View. For wider columns
in Datasheet View, drag the column dividers there.
3.5.4. Hiding/ Showing A Field Column
In the Show row, clear the checkbox under a field to omit that field from the
query results. Check the box to show that field again.
3.5.5. Sorting Query Results
In the Sor t row, choose Ascendi ng or Descendi ng in the column of the field you
wish to sort by. When the query is run, the records will be presented sorted by
that field value.
If more than one column has a Sort, then results will first be sorted by the
leftmost marked field, then sorted by the next marked field, and so on working
from left to right.

Figure 19 Sorting Families by LastName and then by Birthday (Age)
Access: Creating queries, forms and reports
17 IT Learning Programme
3.6. Finishing
Close the query by clicking , saving when prompted.
The query name appears on the list in the Navigation Pane. Delete a query if
necessary by selecting the query name and pressing DELETE, agreeing to the
confirmation dialog.
Exercise 5: Rearranging a query
Now look at this exercise (page 65).
Access: Creating queries, forms and reports
IT Learning Programme 18
4 Creating Forms
In addition to tables and queries, the Navigation Pane also displays a list of any
forms that have been created (using the Navigation Pane options menu , make
sure that Obj ect Type and Al l Access Obj ect s are selected).
Forms can make data entry easier for you or other users of the database. A form is
used for working on the data that is saved in the tables.

Figure 20 The Navigation Pane Listing Forms
4.1. Creating a Form Instantly
Access can create a form based on an existing table or query. This is the quickest
way to generate a form. First, you must select a table or query in the Navigation
Pane. Then click on the Cr eat e tab of the Ribbon.
A new form is created, using all the fields in the selected table/query and a default
choice of layout. The new form opens in Layout View.
If you want to enter data using this form, switch to Form View by clicking
(on the Home tab).
When ready, close the form by using . You are prompted to give it a name
note that the suggested name will be the same as the table name it was based on,
so you should ensure that the prefix is changed to f r m before saving.
Exercise 6: Using a form and creating an instant form
Now look at this exercise (page 67).
4.2. Using the Wizard to Create a Form Based on a Table
Another way to generate a form is to use the wizard. is found on
the Cr eat e tab of the Ribbon.
The wizard takes you through the steps to choose the fields, layout, and
appearance of the form.
Access: Creating queries, forms and reports
19 IT Learning Programme
The first step is to select the table which contains the data required. Its fields then
appear, listed in the Avai l abl e Fi el ds box.
Here you can choose which of these fields are required in the form, by selecting a
field name and clicking > or double-clicking a field name. This transfers the
field name into the right-hand list of Sel ect ed Fi el ds. Clicking >> will transfer
all available fields. Use < or << to remove fieldnames from the Sel ect ed
Fi el ds list.

Figure 21 The Form Wizard
The remaining steps of the wizard are for choosing a layout from a short list
offered (usually Justified is a good choice).
The last step in the wizard is to give a suitable name for the form. Note that by
convention form names always begin with f r m (although Access is likely to
suggest a name that does not conform with this convention).
4.3. Using the Wizard to Create a Form Based on a Query
The procedure here is similar to creating a form based on a table. It is useful
because a query can collect together fields from several tables, and can select
records based on criteria. This selected information can then be presented in a
form.
First create and save a suitable query, which includes the required tables and
shows all of the required fields and records. Then create an instant form based on
that query or select the query in the For m Wi zar d dialog.
Access: Creating queries, forms and reports
IT Learning Programme 20

Figure 22 Form Wizard Based on a Query
Depending on the structure of the data, the wizard may ask how you want to view
your data. This is discussed in more detail in the later IT Learning Programme
course Access: Desi gni ng For ms and Repor t s (see Part 12.4).

Figure 23 Form Wizard Based on a Query, continued

Access: Creating queries, forms and reports
21 IT Learning Programme
4.4. Using the Form
Form names appear in the Navigation Pane. Double-clicking a form name opens
it in Form View, showing one or more records. Here you can navigate between
the fields and records, and view, edit or add data.

Figure 24 A Form Created Using the Wizard, Shown in Form View
4.5. Managing Forms
Close the form from Layout View by clicking . If the form design has been
changed, you will be prompted to save. You are saving changes to the form
design, not changes to the stored data (which was saved automatically as you
worked).
The name of the form appears in the Navigation Pane.
Delete any unwanted form by selecting its name in the Navigation Pane, pressing
DELETE, and then agreeing to the confirmation dialog.
Exercise 7: Creating a form using the wizard
Now look at this exercise (page 68).
Access: Creating queries, forms and reports
IT Learning Programme 22
5 Design Changes on a Form
5.1. Switching Between Views of a Form
There are a number of ways to view a form once it is open. These are found using
the first button at the left end of the Home tab (and also the For m Layout Tool s
tab when available). The face of this button varies, including , so it can
be used to toggle between Form View and Layout View.
If you click on the arrow below the button image, however, you can see a list of
Viewing options. You should choose the view based on what you need to do with
the form:


Form View is the default view where you edit the data.
You cannot change the layout of the form.

Layout View allows you to rearrange and change the
appearance of the form.
Sample data is visible (so you can get an idea of what
the form will look like in Form View) but is not
editable.

Design View allows the most detailed design changes.
No data is displayed. This view is covered in another
course (see Part 12.4).

We will focus on Layout View for the remaining work in this course.
5.2. Themes on a Form
When you switch to Layout View, three new Ribbon tabs appear, entitled For m
Layout Tool s. Not surprisingly, the Desi gn tab gives you control over the design
of the whole form.
You can easily change the whole look of the form (fonts, colours, borders, etc.) by
using the Themes Gallery. Clicking on the Desi gn tab displays a gallery of
theme designs. Selecting one of the options will re-format many of the elements
on the form.
Access: Creating queries, forms and reports
23 IT Learning Programme

Figure 25 Themes Gallery
5.3. Editing Labels
A form that is created as an instant form or using the wizard has a plain label
connected to each control.
In the first instance, these labels use the field names (e.g. LastName or Address1)
or the caption if one has been defined in the table design.
You may now prefer to modify the text in a label, so that it describes the field
more clearly (e.g. Students Surname, Address Line 1).
The text in labels can be easily edited: click the label once to select it (notice the
orange outline that appears around the object). Click a second time, inside the
box, to see a flashing insertion point. Work with this as you would in
word-processing: remove text using DELETE or BACKSPACE, then re-type the text
as needed. Click outside the label object when finished.
If you want to completely remove a label from the form, click the label once to
select it and then press DELETE.
5.4. Moving and Resizing Form Objects
The two main types of elements on a form are controls and labels. The cont rol s
are boxes where the user of the form will actually enter data (corresponding to a
particular field in a table). In Layout View, these boxes are displayed with sample
data inside.
Most field controls have an associated l abel to identify the information which
should be given in the control. Additional labels are sometimes used to display a
title or other information on the form.
Access: Creating queries, forms and reports
IT Learning Programme 24

Figure 26 A Form With Text Controls and Labels
You can select a control or label by clicking on it. An orange border will appear
around the object. You can then move the object by dragging and dropping, or
resize the object by dragging an edge. A selected object can also be moved around
using the arrow keys (up, down, left, right).
Exercise 8: Design changes on a form
Now look at this exercise (page 69).
5.5. Selecting Multiple Objects
If you want to move or resize multiple items at once, first select a series of items
by holding down SHIFT while clicking on the individual controls or labels. Then
drag to move or resize. This is especially helpful if you want to move a control
with its label to a new location, or want to make sure that several controls are the
same size.
5.6. Arranging and Aligning Form Objects in a Layout
For a regular, neatly-aligned look, form objects can be organised into a l ayout , by
selecting the relevant controls and labels and choosing or on the Ar r ange
tab.

Figure 27 A Form with a Stacked Layout
Access: Creating queries, forms and reports
25 IT Learning Programme

Figure 28 A Form with a Tabular Layout
A layout on a form is a predefined grid-like structure, which manages all the
elements as a set. Buttons for rearranging and moving items in a layout are
provided on the Ar r ange tab.

Figure 29 Buttons for Working in a Layout on a Form
When working on controls in a layout, it is usually necessary to select the relevant
column or row first, before trying to change a height, width or position: use
and .
Note that if a form was created using the Instant Form tool (as described in Part
4.1), the controls may be fixed into a layout automatically.
Layouts like this are discussed in more detail in the later ITLP course Access:
Desi gni ng For ms and Repor t s (see Part 12.4).
Exercise 9: Using a layout on a form
Now look at this exercise (page 71).
Access: Creating queries, forms and reports
IT Learning Programme 26
6 Formats and Properties of Form Objects
For this course, we will focus on working with a form in Layout View. Other views
are discussed in a later course.
6.1. Using Buttons for Formatting Controls and Labels
Remember that in Layout View some sample data is shown in the controls, to
help you with the layout, but you cannot edit the values here. You can modify the
formatting of a control or label using buttons on the Ribbon.
For each of these, start by selecting the control(s), then click a button.
A variety of popular formats can be applied, by using buttons on the For mat tab:

Figure 30 Popular Formatting Buttons
Familiar buttons are used for changing the appearance of text in a selected
control, such as (bold) (italic) and (underline).
Drop-down list boxes change the font or font size .
Alignment buttons will change the way text is aligned horizontally
within its box. The appearance of any object may be changed using further
buttons for colours, border styles etc.
The Paste Formatting button can be used to pick up the formatting of one
object and paste it onto another object.
Improve the colour and appearance of a control using and
which includes colours, line thickness etx.
6.2. Data Formats in a Form Control
There are some additional options available for individual field controls. If the
control displays numerical data, you can change the number format, for example
specifying the number of decimal places to display, or displaying the value as a
percentage.

Figure 31 Options for Number Format
Similarly, a variety of formats are available for displaying dates and times.
Access: Creating queries, forms and reports
27 IT Learning Programme
6.3. Conditional Formatting
With conditional formatting, the formatting for the control changes, depending
on the value of the control contents, record by record. For instance, the text
colour might be set to be green whenever the value in the field represents a pass
(score exceeds, say, 60%) and to be red if the value represents a fail. Formatting
the controls like this could help important data stand out on the form.

Figure 32 Conditional Formatting for a Control
Exercise 10: Formatting controls and labels on a form
Now look at this exercise (page 73).
6.4. Property Sheet
The behaviour and appearance of a control can be changed by editing its
properties in the Property Sheet.
If the Property Sheet is not visible, clicking on the Desi gn tab will show it.
When an object is selected, its properties are listed in the Property Sheet, and the
selected object is named at the top of the sheet, for confirmation.
Overtype the previous value, or choose from a drop-down list if offered.
Access: Creating queries, forms and reports
IT Learning Programme 28

Figure 33 Layout View of a Form, Showing the Property Sheet
The Properties are divided using tabs, and they include:
For mat properties some of these properties may have been set using
toolbar buttons, see above
Dat a properties here a default value and/or validation rule can be set,
and the control source is specified
e.g. Enabl ed= Yes means the user can place the focus
on a control using the mouse or keyboard;
Locked= Yes means the user cannot alter the value
set in a control
Event properties a procedure or macro can be set to take place on a
control event, such as when it is clicked or when its
value is updated
Ot her properties these include whether the control can be reached by
pressing TAB, and the text that appears in the status bar
or on a control tip
6.5. Form Properties
The background colour of the form itself can be changed, by clicking the form
background then using to choose a colour.
To select the form as a whole, click the Form Selector the bar along the left edge
of the form or use the drop-down at the top of the Property Sheet. The Property
Sheet then displays the properties of the form.
Form properties include:
Caption alternative text to appear on the title bar in Form View
Scroll bars display vertical, horizontal or both or neither
Record selectors show or hide them
Dividing lines between Detail and Header/Footer
Min/max buttons enable either or both
Access: Creating queries, forms and reports
29 IT Learning Programme
Auto center the form is automatically displayed at the centre of the
window
... and a range of form events.
6.6. Changing the Record Source of a Form Including Queries
When a form is created using the wizard or the Instant Form tool, the table
nominated becomes the record source of the form: the place where Access will
seek values to display in the field controls.
Usually the record source need not be changed. However, if the form is to display
values based on a different source, then this property of the form can be changed
in the Property Sheet.
It is common to base a form on a query, if fields are to be drawn from more than
one table. In this case, the query must be set as the record source, by choosing the
query name as the r ecord source property.

Figure 34 Changing the Record Source of a Form
Exercise 11: Using the Property Sheet
Now look at this exercise (page 74).
Access: Creating queries, forms and reports
IT Learning Programme 30
7 Creating Reports
A report is another way to present information taken from a table or query. Data
cannot be edited in a report; instead, a report provides a snapshot of the data at
the time the report is run. The data is often displayed in a layout suitable for
printing, with several records on a page and summary calculations added.
A report that is well designed helps the user to read and interpret the data much
more easily than by looking at the same information in the table. As usual,
available reports are listed in the Navigation Pane.

Figure 35 The Navigation Pane Listing Reports
7.1. Creating a Report I nstantly
Starting from a selected table or query, a report can be created automatically, by
selecting the required table or query in the Navigation Pane, then choosing
from the Cr eat e tab of the Ribbon.
A new report is created, using all of the fields in the selected table/query and a
default choice of layout. The new report opens in Layout View for editing: is
used to switch to Report View.
When you close the report, you are prompted to give it a name note that the
suggested name will be the same as the table name it was based on, so you should
change the prefix t bl to r pt before saving.
Exercise 12: Creating a report instantly
Now look at this exercise (page 77).
7.2. Using the Wizard to Create a Report Based on a Table
on the Cr eat e tab of the Ribbon will start the wizard.
Access: Creating queries, forms and reports
31 IT Learning Programme
The first part of the wizard is for choosing the table the report is to be based
upon. Then fields are chosen from those available: the field name is selected, then
> and >> are used to move field names from left to right (and < and << are
used to move field names back).

Figure 36 Report Wizard: Choose a Table and Fields
In the next part of the wizard, you can try out the Grouping levels to see which
combination may be a sensible way to organise your data, then set a sort order if
appropriate.
Access: Creating queries, forms and reports
IT Learning Programme 32

Figure 37 Report Wizard, Grouping Levels
Next choose a layout and orientation you prefer. In the last part of the wizard,
give the report a suitable name remember the convention that report names
begin with r pt , even if the wizards suggestion does not conform to this.

Figure 38 Report Wizard, Setting a Report Name
Access: Creating queries, forms and reports
33 IT Learning Programme
7.3. Using the Wizard to Create a Report Based on a Query
The procedure here is the same as for creating a report based on a table. It is
useful because a query can collect together fields from several tables, and can
select records based on criteria.
The first step is to create and save a suitable query, including all the fields
required from one or more tables, and selecting the records using criteria as
needed.
In the wizard, choose that appropriate query, and whichever fields are needed.
Try out the Grouping options to see which will give a suitable presentation.

Figure 39 Report Wizard Based on a Two-Table Query
Again, choose sorting and layout to taste, and assign a suitable name for the
report.
Access: Creating queries, forms and reports
IT Learning Programme 34
7.4. Using the Report

Figure 40 A Report Created Using the Wizard
After the wizard has run, the report is presented by default in Print Preview. Here
you can navigate between the pages of the report and see how the fields and
records are laid out for printing, but the data and layout cannot be edited.
A report preview can be magnified using the various zoom tools on the Ribbon,
and the report can be printed.
7.5. The Mailing Label Wizard (Optional)
A report can be created which generates short lists suitable for printing on sheets
of sticky labels, for example for addressing envelopes. Microsoft Office has a
library of the dimensions of many well-known brands of sticky label.
In the Navigation Pane, select the table/query which contains the names and
addresses (or other data for the label) and choose on the Creat e tab.
Using the wizard, choose the standard labels to suit your supplies. First choose
your Manuf act ur er , then the Pr oduct number if available. If no label is available
to match your supplies, use and enter the dimensions from your
own sheets of labels.
Access: Creating queries, forms and reports
35 IT Learning Programme

Figure 41 Choosing Standard Label Sizes
Next choose from a limited range of font formatting. Then set up the way you
want the fields to appear on the label, by selecting field names in the left list and
clicking > . Press ENTER to move onto a new line in the label, and type other
characters as needed.

Figure 42 Assembling Fields Onto a Label
Finally, set a sort order if wanted, and give the report a name.
It is a good idea to preview the report before printing on real sheets of stickers.
Access: Creating queries, forms and reports
IT Learning Programme 36

Figure 43 Preview of a Labels Report
7.6. Managing Reports
Close the report by clicking . If the report design has been changed, you will be
prompted to save.
The name of the report appears with any others in the Navigation Pane.
Delete any unwanted report by selecting its name in the Navigation Pane,
pressing DELETE, and then agreeing to the confirmation dialog.
Exercise 13: Creating a report using the wizard
Now look at this exercise (page 77).
Access: Creating queries, forms and reports
37 IT Learning Programme
8 Design Changes on a Report
8.1. Switching Between Report Views
There are a number of ways to view a report. You should choose a view based on
what you need to do with the report.

Report View is the default view where you review the
data in the report.

Print Preview is used to view the report as it will be
printed (with pagination).

Layout View allows you to rearrange and change the
appearance of the report. Sample data is visible but is
not editable.

Design View allows the most detailed design changes.
No data is displayed. This view is covered in another
course (see Part 12.4).

As with Forms, we will focus on Layout View for the remaining work in this
course.
8.2. Themes on a Report
When you switch to Layout View, four new Ribbon tabs appear, entitled Repor t
Layout Tool s.
You can easily change the whole look of a report (fonts, colours, borders, etc.) by
clicking on the Desi gn tab. Selecting one of the options from the Themes
Gallery will re-format many of the elements on the report.
8.3. Page Layout
In Layout View (or in Print Preview), you can control printing options using page
setup. Choose the Page Set up tab among Repor t Layout Tool s. Here you can
change the paper size and change the orientation between portrait and landscape.
Clicking on launches the Page Set up dialog with additional options.
Access: Creating queries, forms and reports
IT Learning Programme 38

Figure 44 The Page Setup Dialog
If you need to add (or change the format of) page numbers for a printed report,
insert page numbers using on the Desi gn tab.

Figure 45 Inserting/Formatting Page Numbers
Exercise 14: Design changes on a report
Now look at this exercise (page 79).
Access: Creating queries, forms and reports
39 IT Learning Programme
9 Working With Controls and Labels on a Report
9.1. Control or Label?
A control is the box where data from a field is shown. Most controls are bound to
a particular field in the table or query that the report is based on.
A label is the piece of text which may appear close to a control, stating what is
contained there. Typically, the label is the field name or a more human-readable
variant of the field name.
Typically, labels are put in the headers and footers of a report, where they act as
banners across the edge of the paper or as column headings. Controls in the
detail section of the report show the data values from the records and fields.
9.2. Editing a Label
The label text for column headings or the report title can be edited directly in
Layout View by clicking the label once to select it (notice the orange outline that
appears around the object) and then clicking a second time inside the box to see a
flashing insertion point. Use this as you would in word-processing: remove text
using DELETE or BACKSPACE, then re-type the text as needed. Once you have
modified the text, you can resize the label to fit the new contents.
If you want to completely remove a label from the report, click the label once to
select it and then press DELETE.
9.3. Moving and Resizing Controls in a Layout
In Layout View, you can select a control or label on a report by clicking on it.
Because information in a report is often structured in a grid format known as a
layout
1
, you will notice that an orange border appears around the object, and a
lighter orange border appears around any other related objects (for instance,
other controls which display data from the same field). Any changes will affect all
of the controls with the light orange outline.

Figure 46 Selecting a Control (With Others in the Same Field)

1
Layouts were mentioned earlier in this course, when editing forms (part 5.6)
Access: Creating queries, forms and reports
IT Learning Programme 40
You can drag a control to move it (along with other controls in the same layout).
Dragging a control sideways changes the order of the columns, and dragging a
control up or down changes the spacing between the rows in the report. You can
also drag the edge of the control to resize all of the selected textboxes.
Clicking in the left or right margin of the report selects an individual record.

Figure 47 Selecting a Record
Working with structured layouts like this is discussed in more detail in the later
ITLP course Access: Desi gni ng Forms and Repor t s (see Part 12.4).
9.4. Gridlines Around a Layout
If the report displays information in a layout, you may want to display gridlines as
a guide within the layout. In that case, it is helpful to click inside the layout and
then click on the square handle (at top left) to select the entire layout.
Clicking on the For mat tab displays gridlines between each row, each
column, or both.

Figure 48 Options for Gridlines in a Layout Table
Exercise 15: Working with controls and labels on a report
Now look at this exercise (page 81).
Access: Creating queries, forms and reports
41 IT Learning Programme
10 Formats and Properties in a Report
10.1. Formatting a Label or Control Using Buttons
The For mat tab gives you control over the appearance of a selected report
element.
As discussed in Part 9 above, when you click on an individual control in Layout
View, you often select an entire column or collection of controls (i.e. all of the
controls related to a single field). Any formatting changes are applied to all of the
related controls.
Using the buttons on the For mat tab, you can also change the font name, size,
style (bold, italic, underline), alignment (left, centre, right), text colour and
background colour of the selected label(s).

Figure 49 Formatting the Appearance of a Label or Control
In addition to changing its appearance, if a control displays numerical or date
data, you can change the number or date format. For example you might specify
the number of decimal places to display, display the value as a percentage, or
change to a short date form.

Figure 50 Options for Number and Date Format
You can also set up conditional formatting by choosing on the For mat tab.
Conditional formatting changes the appearance of a control, depending on the
value of the control contents. Formatting controls in this way could help
important data stand out on the report.
Access: Creating queries, forms and reports
IT Learning Programme 42

Figure 51 Conditional Formatting for a Control
10.2. The Report Background
The background colour of the report itself can be changed, by first clicking the
report background then using to choose a colour (choose with some care, if
the report is to be printed on paper).
10.3. Property Sheet for Individual Controls
Further changes can be made to the behaviour or appearance of parts of a report,
by changing properties in the Property Sheet. The Property Sheet is displayed
using .
When an object is selected, its properties are listed in the Property Sheet and the
selected object is named at the top of the sheet, for clarity.
Select a control or section of the report, to see its properties listed in the Property
Sheet. These can be changed independently.

Figure 52 Properties of a Text Box Control
Access: Creating queries, forms and reports
43 IT Learning Programme
The Property Sheet is divided into tabs. Some of the properties on the For mat tab
can also be changed using buttons on the Ribbon. A property can be changed by
overtyping the value in the Property Sheet, or by choosing from a drop-down list
if one is offered.
Other For mat properties include:
Vi si bl e the control can be present on the report, but made not visible
for convenience or temporarily
Can Grow the control or section adjusts vertically to show all the data it
contains
Can Shr i nk the control or section shrinks vertically to remove all spare
lines when its data is displayed
Further properties are shown in the Dat a and Ot her tabs (there are no events
associated with individual controls on a report, because a report is intended to be
printed on paper rather than operated in a window).
10.4. Properties of a Section or Whole Report
Click a section (Detail, Header or Footer) to see its properties listed in the
Property Sheet. Another way to see the properties of some part of a report,
including the report itself as a unit, is to choose using the drop-down list at the
top of the Property Sheet.
Format properties of a section include For ce New Page: set this to Af t er in a
Footer, to ensure that the next data group is placed on a new page when printing.
Data properties include setting a Fi l t er and/or Sor t or der for a report.
A useful property of the report is the Capt i on, which is the text that appears in
the title bar when the report is run (it is usually desirable to change this from the
default which may be a table or query name that is no longer appropriate).
10.5. Changing the Record Source of a Report I ncluding
Queries (Optional)
When a report is made using the wizard, the table containing the required data
becomes the record source of the report the place where Access will seek values
to display in the field controls.
Usually this need not be changed. However, if the report is to display values
based on a different source, then this property of the report can be changed in the
Property Sheet.
It is common to base a report on a query, if fields are to be drawn from more than
one table. In this case, the appropriate query must be set as the record source, by
choosing the query name as the Record Source.
If a report is fairly simple, it may be more convenient to create a new one using
the wizard, basing the report on a query at the outset.
Access: Creating queries, forms and reports
IT Learning Programme 44

Figure 53 Changing the Record Source of a Report
Exercise 16: Formats and properties in a report
Now look at this exercise (page 82).
Access: Creating queries, forms and reports
45 IT Learning Programme
11 Ordering Data in a Report
11.1. Grouping Records Using the Report Wizard
In the Report wizard, you can choose to group together all records which have the
same value in a particular field. For instance, grouping by Last Name will collect
all the records for the Jones family together, with the label Jones printed just
once before this set of records.

Figure 54 Grouping by a Field
Select the field name in the left-hand list, and click > to add it as a grouping
level. The effect is previewed on the right-hand side.
11.2. Sorting in a Report
When a new report is created using the wizard, a sort order can be set, so that
records appear in alphabetical/numerical order by one or more fields. Choose a
field name to sort by, then click to select or beside
each sorting field.
Access: Creating queries, forms and reports
IT Learning Programme 46

Figure 55 Setting the Sort Order in Report Wizard

Figure 56 A Report with Grouped and Sorted Records
If you do not get the grouping and sorting that you want, it is often easiest to
delete the report and run the wizard again.
Exercise 17: Sorting and grouping records in a report
Now look at this exercise (page 84).
11.3. Summarising Data in a Report, Using the Report Wizard
If the data includes one or more numerical fields, Access can make summary
calculations or running totals. This may be, for example, calculation of Sum,
Maximum or Minimum Value for each field value and then a grand total or
overall value for the whole dataset. This can be set up using the wizard, at the
time of creating a report.
Access: Creating queries, forms and reports
47 IT Learning Programme
The first parts of the wizard is used as above, specifying the table or query
containing the data, and choosing appropriate fields, then choosing suitable views
and grouping for the data.

Figure 57 Starting the Report Wizard
In the sort order part of the wizard, appears if the data is
suitable.

Figure 58 Summary Options Button Appears (when data is suitable)
Access: Creating queries, forms and reports
IT Learning Programme 48
The Summar y Opt i ons dialog offers checkboxes for various summary
calculations (depending on the data fields present).

Figure 59 The Summary Options Dialog
Finally the wizard the creates the report.

Figure 60 Report With Running Summary Calculations
The report generated by the wizard may be rather congested, and include
unfriendly labels with text like Summary f or ' ToyMake' = BeyBl ades
( 4 det ai l r ecor ds) . You may want to re-word or even delete the summary labels.
Access: Creating queries, forms and reports
49 IT Learning Programme
You may also re-position some controls, and use formatting to emphasize the
summary calculations (e.g. making the labels/values bold).
Exercise 18: A report with summary calculations
Now look at this exercise (page 85).
Access: Creating queries, forms and reports
IT Learning Programme 50
12 What Next?
Now that you have some basic Access skills you may want to develop them
further. IT Learning Programme offers a range of resources for study and
teaching.
12.1. Downloadable Course Materials and More the
ITLP Portfolio
These course materials are available through the ITLP Portfolio, at
http://portfolio.it.ox.ac.uk .
Each course pack includes the course handbook in pdf form and a zip folder of the
exercise files that you need to complete the exercises. Archive versions of the
course book may also be useful if you use an earlier version of the software.
The ITLP Portfolio helps you find articles, videos, resources and weblinks for
further IT study. For some resources, you will be asked for your Oxford (SSO)
username and password.
12.2. Databases: Concepts of database design
This course takes you through the steps required to create a good relational
database design from concept to implementation. The course does not use any
particular software, so it will help you create a well-designed database structure
which you can later build using the database software of your choice.
12.3. Access Courses Which Precede This
Access: Building a database
12.4. Access Courses Which May Follow This
Access: Designing forms and reports
Access: Analysing data
Read about the content of these courses in the IT Learning Programme Catalogue
at www.it.ox.ac.uk/itlp/courses/catalogue
12.5. Computer8
We encourage everyone to work at their own pace. This may mean that you dont
manage to finish all of the exercises for this session. If this is the case, and you
would like to complete the exercises while someone is on hand to help you, come
along to one of the Computer8 sessions that run during term time. More details
are available from www.it.ox.ac.uk/courses/
12.6. IT Services Help Centre
In the IT Services Help Centre, you can use the facilities to work through the
exercises in this booklet, or use any of the applications that are available. The
Help Centre is also a good place to get advice about any aspect of using computer
software or hardware.
For Help Centre opening times, visit www.it.ox.ac.uk/help/gettinghelp/ and
follow links to the General Helpdesk, or contact them by email on
help@it.ox.ac.uk.
Access: Creating queries, forms and reports
51 IT Learning Programme
Appendix 1:
Viruses and Security Levels in Access
Why Worry About Viruses?
A virus is malicious code that may arrive from another computer, and copy itself
onto your hard disk. Depending on the taste of the person who devised it, it may
be just a joke, or it may destroy data or system files. Some viruses send
themselves on to other people via your email setup.
A virus may infect your computer while you are connected to the internet, or it
may arrive attached to an email or on a contaminated removable disk, and it may
take the form of a macro in an Access database file. It is essential to make
provision for your computer to be scanned frequently for any viruses which may
have arrived.
Versions 2003 and 2010 of Access handle this threat in different ways, so make
sure you have made suitable settings for your own computer.
Scanning for Viruses
Virus Scanning Software
You should install and use virus-checking software such as Sophos (supported by
IT Services). Other popular virus-checkers include McAfee VirusScan and Norton
AntiVirus. Contact the IT Services Online Shop or visit www.it.ox.ac.uk for more
information about obtaining Sophos at no cost or low cost for University
members.
A typical virus-checker scans your computer disks according to a preset schedule.
For instance, it may be set to check the hard disk every time you start Windows,
or twice a week, or to scan every document on opening. The program detects any
viruses, then alerts you and gives the options of deleting the file, putting it in
quarantine or perhaps fixing it.
Keeping the List of Viruses Up-to-date
A virus-checking program must be kept up-to-date. It is important to connect
frequently to the virus-checking centre (this is typically done via their Internet
website). The virus list on your computer is then updated with all viruses known
to date, with any antidotes.
Access 2010
2
and Virus Security
Access 2010 considers any database file (such as . accdb or .mdb) as a potential
route for virus infection. It starts by disabling any automatic content, and then
asks you to decide whether to enable it.
This applies to content such as macros and some Control Wizards and ActiveX
Controls.
Information about the other levels of protection, and further options for the way
Access handles macros, is given in Access Hel p.

2
Access 2007 handles viruses in a similar way to Access 2010
Access: Creating queries, forms and reports
IT Learning Programme 52
Security Warning Message
When you open a database file using Access 2010, a Security Warning message
may appear in a white/yellow bar near the top of the window.

Figure 61 Security Warning Message When a Database File is Opened
If you do not expect to use any automatic features, you can safely ignore this
message and continue work.
Enabling Automatic Content For J ust One Visit
Enabl e Cont ent on the Security Warning bar gives you the opportunity to
enable any automatic content that may be present: only do this if you are sure
that the database file comes from a safe source and does not contain any virus or
other hostile code.
Note that the decision to Enabl e t hi s cont ent is effective for this session only. If
the database is closed, then the decision will need to be repeated each time it is
opened. This may be a convenient and cautious approach to take.
Trusted Locations in Access 2010
Some locations (folders, drives or devices) can be nominated as Tr ust ed
Locat i ons: Access then considers any database files found there to be trusted,
and their automatic content is permitted to run.
So you may find it convenient to nominate a folder or area on your computer or
your network as being Trusted by Access. Then make sure that all your Access
database files are saved there.
This decision may be reached in consultation with colleagues and other users of
the database, and with your local IT support contact. Some departments have a
policy about where computer files of different kinds should be saved.
For example, in the ITLP teaching rooms, the students files are provided for you
on a drive known as H: \ , and this has been set as a Trusted Location in the
installed copies of Access. IT Learning Programme computers have Sophos virus
protection software which is kept up-to-date. If you are in an ITLP teaching room,
you can rely on Sophos to manage the virus scanning.
The program files for Access are placed in a Trusted Location, by default.
When to Trust a Location for Access 2010
You should only consider doing this if you do need to use automatic content such
as macros, and if you have made very good alternative arrangements to protect
the computer from virus attack.
Access: Creating queries, forms and reports
53 IT Learning Programme
If you are using a University or College-owned computer, take advice from your
local IT Support Staff before making a location Trusted. Ensure that you have
reputable virus scanning software installed, and that you keep its files of known
viruses up-to-date (i.e. it checks at least weekly by connecting to the software
provider and downloading the latest lists). Then confirm that the software is
configured to scan every file as it is opened.
Only once this is in place can you rely on the virus scanning software to do the
virus scanning, and use Access to manage your database files.
Finding the Access Trust Center
You may decide to set Access to Tr ust a folder or computer storage area. This is
done in the Tr ust Cent er , which is among the Access Opt i ons (found on the
Fi l e menu) .
In the left-hand column of the Access Opt i ons dialog, choose the Tr ust Cent er
category. This reveals the button on the right.

Figure 62 The Trust Center With the Trust Center Settings Button
How to Trust a Specific Location with Access 2010
Trust ed Locat i ons (found in the category list on the left) shows which locations
have already been treated as trusted. Here you can or
. Beware that if you add a location to this list, you are no longer
protected from active content saved in that location.
If the location where you plan to save your databases is on a network drive, check
Al l ow Trust ed Locat i ons on my net work in the same dialog. You should
consult the IT support contact who is responsible for the network, before doing
this.
Access: Creating queries, forms and reports
IT Learning Programme 54

Figure 63 The List of Trusted Locations
You may also decide to trust subfolders within the chosen location there is a
check box for this in the Trust ed Locat i on dialog.

Figure 64 Trusting Subfolders in a Trusted Location
Once a folder has been Trusted, save all database .accdb files there.
Sandbox Mode
Note that these choices makes Access run in a controlled and limited way, known
as sandbox mode. In sandbox mode, Access will run a reasonable range of
commands and functions. Occasionally, some macros created using older
versions of Access may need to be re-written using revised commands which are
now permitted.
In sandbox mode, some commands are disabled because they are deemed
potentially unsafe, and could be used maliciously to damage your files or system.
A user can only disable sandbox mode by changing keys in the Windows registry,
which is not a task for the inexperienced to attempt (if you are not perfectly
familiar with working in the Windows registry, dont experiment: ask someone
who has experience, as there is a risk of making the computer unusable).
Access: Creating queries, forms and reports
55 IT Learning Programme
Access 2003 and Virus Security
Security Levels Available
Access 2003 considers any .mdb file as a potential route for virus infection.
By default, the Access Security Level is set to Medi um. This means that opening
almost any .mdb file will trigger a series of warning dialogs, asking the user for
confirmation about opening the file and/or offering to block unsafe expressions.

Figure 65 Warning Dialog With Medium Security Level
With the Low setting, Access does not intervene when you open a file, assuming
you have made other provision for virus scanning.
With the Hi gh setting, almost any .mdb file cannot simply be opened for use
without intervention by Access.
When to Set a Lower Security Level with Access 2003
Computers in IT Services have Sophos virus protection software which is kept
up-to-date. If you are in an ITLP teaching room, you can set Access virus security
level to Low, and rely on Sophos to manage the virus scanning.
If you are using another computer, take advice from your local IT Support Staff
before setting a lower Security Level. Ensure that you have reputable virus
scanning software installed, and that you keep its files of known viruses up-to-
date (i.e. check at least weekly by connecting to the software provider and
download the latest lists). Then confirm that the software is configured to scan
every file as it is opened.
Only once this is in place can you rely on the virus scanning software to do the
virus scanning, and use Access to manage your database files.
The Security Level Dialog
Before attempting to open any files in Access, you may decide to set the Security
Level to Low.
Choose Tool s| Macr o| Secur i t y to display the Secur i t y dialog, then choose the
Secur i t y Level tab. Choose Low, then click OK. You may be prompted to close
Access and restart, to make the change effective.
Note: do not use the menu Tool s| Secur i t y look carefully for
Tool s| Macro| Secur i t y.
Access: Creating queries, forms and reports
IT Learning Programme 56

Figure 66 Setting the Security Level to Low
Further Help with Security and Trust Center Settings
There is a range of further settings available through the Trust Center. Read more
about this in Access Help.
Access: Creating queries, forms and reports
57 IT Learning Programme
13 Appendix 2: Student Exercises
Exercise 1 Opening a database file
Start Access 2010
Open an existing database file
View the list of queries

All the files for these exercises have been provided for you on a network drive.
Your area of the drive is called dr i ve H: \
This drive has been set up as an Access Trusted Location

Task 1
Start Access from the St ar t
menu
Step 1
Start the computer if necessary
Step 2
Click on the Task Bar at the bottom of the
screen
In the St ar t menu, explore the folders and look for the
Mi crosof t Of f i ce folder
Choose Access
Step 3
If you are prompted for any user information, just click
on OK
Step 4
(On your office or home computer you are likely to start
the program using an Access icon on the Desktop)
Task 2
Open Depar t ment
Asset s. accdb
It has been placed in your
network drive H: \ (or in
another place as directed by
your teacher)
Step 1
Choose Fi l e| Open
Step 2
Navigate to the network drive called dr i ve H: \
Alternatively, navigate to a drive and folder as directed
by your teacher
All the files you need for this course will be found here
Step 3
Locate the file called Depar t ment Asset s. accdb
Open the file by selecting the filename then clicking

Step 4
If a security warning bar appears, stating that certain
content in the database has been disabled, then read
Appendix 1
Access: Creating queries, forms and reports
IT Learning Programme 58
Task 3
Use the Navigation Pane in
the database window
Step 1
Select next to the title on the Navigation Pane (on
the left-hand side of the screen)
Select Obj ect Type (under Navi gat e To Cat egory)
Step 2
Select again and choose Al l Access Obj ect s
(under Fi l t er By Gr oup)
Task 4
Look at the list of tables
and queries in the
Navigation Pane
Step 1
Notice that the names of tables and queries that have
already been created are listed in the Navigation Pane

Exercise 2 Creating select queries using the wizard
Creating a select query using the wizard
Saving the query
Running the query and look at the results
Switching between Design View and Datasheet View

Task 1
Continue work in
Depar t ment
Asset s. accdb
Step 1
Ensure that the file Depar t ment Asset s. accdb is
open (if necessary, open it by choosing Fi l e| Open)
Task 2
Use the wizard to create a
query based on t bl Asset s,
including these fields:
Asset Description, Make,
Model and Date Acquired
Step 1
Click on the Cr eat e tab of the Ribbon
Select Si mpl e Query Wi zard and click
Step 2
In the list of available tables, choose the table called
t bl Asset s
Step 3
Double-click on the fields called Asset Descr i pt i on,
Make, Model and Dat eAcqui r ed to place these fields
in the right-hand list
Step 4
Click to move through the wizard
Access: Creating queries, forms and reports
59 IT Learning Programme
Task 3
Save the query
Name it qryAsset s
Examine the results of
qr yAsset s
Step 1
When asked by the wizard, give a suitable name for the
new query: qryAssets
Make sure Open t he quer y t o vi ew i nf or mat i on is
selected
Step 2
Click
Step 3
The query runs [44 records] and the results are
presented in Datasheet View
Notice that all records are included, but only those fields
you requested
Task 4
Switch between Design
View and Datasheet View
Close the query
Step 1
Use on the Home tab to switch to Design View
Step 2
In Design View, notice the table of assets with a list of all
the available fields, in the top pane
In the design grid (lower part), notice the fields that
have been chosen and set out in columns
Step 3
Use on the Home tab or the Quer y Tool s
Desi gn tab, to switch to Datasheet View
Step 4
When ready, close the query using
(if you have made no changes to the query design, you
will not need to save on closing)
Leave the file open, showing just the Navigation Pane
Practice Task 5
Create another query based
on the table
t bl Depar t ment s
List every department by
name, along with the name
of the Head of Dept and a
contact phone number
Save the query with a
suitable name (with the
prefix qr y)
Step 1
Click on the Cr eat e tab of the Ribbon, select
Si mpl e Quer y Wi zar d and click
Step 2
Select the table t bl Depar t ment s
Choose the fields Dept Name, Dept Head,
Cont act Tel Num
Step 3
Save the query as qryCont act i ngHeadsof Dept
Examine the resulting data
Step 4
Close the query
Access: Creating queries, forms and reports
IT Learning Programme 60

Exercise 3 Creating a query in Design View
Starting a new query
Adding tables in Query Design View
Adding fields
Running a query based on two or more tables
Saving and closing the query

Task 1
Continue work in
Depar t ment
Asset s. accdb
Step 1
Ensure that Depar t ment Asset s. accdb is open
Close any tables or queries that may be open using
Task 2
Start a new query in Design
View
Add two tables t bl Asset s
and t bl Depar t ment s
These tables are already
related by a join using
Dept I D

Step 1
Click to display the Design View with the Show
Tabl e dialog
Step 2
Choose t bl Asset s and t bl Depart ment s by selecting
the table name and clicking or double-
clicking a table name.
Repeat until you have both the required tables in the
design grid behind
(do not worry if you collect some extras, they can be
deleted later)
Step 3
Click to use the design grid
If an unwanted table has appeared, click it once to select
it then press DELETE to delete
Step 4
Notice that the two tables are shown in the top pane,
with a line joining the Dept I D fields
The top pane can be resized by dragging the divider
between the two panes
Task 3
Choose fields and set them
up in the design grid:
Asset ID
Description
Step 1
Set up a field in the first column of the design grid:
Select the field name Asset I D in the list for t bl Asset s
Drag the field name to the top of the first empty column
in the grid
Access: Creating queries, forms and reports
61 IT Learning Programme
Step 2
The next fields you need are Asset Descr i pt i on,
Make and Next Mai nt Dat e from the t bl Asset s
Set these up in the design grid, perhaps by double-
clicking a fieldname, or by clicking at the top of an
empty column and picking a fieldname from the menu
that drops down
Step 3
The final field, Cont act Tel Num, must be taken from
the related table t bl Depar t ment s
Task 4
Run the query
Examine the results
Step 1
Click or to switch to Datasheet View
The query is run (Access interrogates the data in the
tables at that moment)
Any records which appear in both tables with
corresponding Dept I D values are presented
Only those fields you selected in the query design are
presented
Step 2
The data can be edited in the query
For example, suppose that asset number 15, a Watkins
bar code reader, should next be serviced on 1 January
2016
Locate that record, move into the Next Mai nt Dat e
field, and type the required date to change the date in
this list
You have changed the value in the underlying table,
t bl Asset s
Task 5
Close the query
Save it, giving a suitable
name
Step 1
Close the query by clicking , saving any changes
when asked
When asked, give the query a name that conforms to the
naming convention, such as qr yMai nt enanceLi st
Practice Task 6
Create another new query
in Design View, which lists
each asset with its
description, serial number,
date acquired and expected
life, with the name of a
responsible Head of
Department
Step 1
Click to display the Design View with the Show
Tabl e dialog
Add the tables t bl Asset s and t bl Depart ment s
Step 2
Choose the fields: Asset Descr i pt i on,
Seri al Number , Dat eAcqui r ed and
Depr eci abl eLi f e from one table
Choose the Dept Head from the other table
Access: Creating queries, forms and reports
IT Learning Programme 62
Step 3
Run the query and examine the results
Task 7
Close the query, saving it as qr yAsset Li f eTi mes

Exercise 4 Setting criteria in a query
Criteria with equals
Editing criteria
Comparison criteria
Criteria with wildcard symbols
Criteria with Not and Is Null
Multiple criteria with AND and OR

Task 1
Create a query listing assets
with their description,
make, model, date acquired
and purchase price
Step 1
Continue working in Depar t ment Asset s. accdb
Close any tables or queries that may be open, using
Step 2
Create a new query in design view, with t bl Asset s only
Step 3
Add these fields:
Asset Descri pt i on, Make, Model , Dat eAcqui r ed,
PurchasePr i ce
Step 4
Run the query [44 records]
Task 2
Add criteria to show only
laptops
Save the query so far
Step 1
Switch back to Design View for the same query
In the Asset Descr i pt i on column, on the Cr i t er i a
row, type laptop
Step 2
Run the query [11 records]
Step 3
Save the query, by clicking on the Quick Access
Toolbar (a suitable name might be
qryAsset sWi t hPr i ces)
Access: Creating queries, forms and reports
63 IT Learning Programme
Task 3
Edit the same criteria so the
query now shows only
printers
Then change the criteria to
show all assets made by
Watkins
Step 1
In design view of the same query, delete laptop from
the Cr i t er i a row
Step 2
Enter printer as the Criteria for Description
Run the query [8 records]
Step 3
Delete any previous criteria (look at all the columns)
In the Make column, enter Watkins
Run the query [10 records]
Task 4
Edit the same query to
show all assets which cost
over 200
Step 1
Delete any previous criteria (look at all columns)
Step 2
In the PurchasePr i ce column, enter >200
(note you do not need to type the symbol, as that is
part of the format for this field)
Step 3
Run the query [18 records]
Task 5
Use this query to show all
laptops which cost over
350
Step 1
Delete any previous criteria
In the Descr i pt i on column enter the criteria laptop
In the PurchasePr i ce column, in the same row, enter
>350
Step 2
Run the query [3 records]
If you do not get 3 records, check both criteria, and
confirm that each one is in the correct column and in the
correct row
Task 6
Revise the query to show all
assets made by Watkins,
Wilkinson or Wood
Associates (hint: use the *
wildcard symbol)
Step 1
Delete any previous criteria
In the Make column, enter the criteria w*
Access edits this to Like w*
Step 2
Run the query [16 records with machines by Watkins,
Wilkinson and others beginning with W]
Task 7
Revise the query to show all
machines whose model
number is 180 to 190 (use
Between)
Step 1
Delete any previous criteria
In the Model column, enter the criteria Between 180
and 190
Step 2
Run the query [7 records]
Access: Creating queries, forms and reports
IT Learning Programme 64
Task 8
Revise the query to show all
machines which are not
laptops
Step 1
Delete any previous criteria
In the Asset Descr i pt i on column, enter the criteria
not laptop
Step 2
Run the query [33 records]
Task 9
Find all records for
machines that have not yet
been sold (no value has
been entered in the
Dat eSol d field)

Step 1
Delete any previous criteria
Add the field Dat eSol d to an empty column on the
query design grid
Under Dat eSol d, enter Is Null
Step 2
Run the query [22 records]
This suggests that 22 of the machines have not yet been
sold, as no Dat eSol d has been entered
Task 10
Revise this query again, to
show a list of laptops and
PCs and printers
Step 1
Delete any previous criteria
In the Descr i pt i on column, enter laptop
In the next row of the Descr i pt i on column, enter PC,
and on the next row enter printer
Run the query [28 records]
Practice Task 11
Make up some more
queries, such as:
all assets acquired since 1
st

January 1985
all assets which cost
between 100 and 300
Step 1
Devise some more interesting query criteria, and try
them out
Step 2
For each new attempt, delete any previous criteria
before entering new values
Look carefully at criteria on the same row (AND) or on
separate rows (OR)
Step 3 Entering criteria
Enter any date criteria in the form 1/1/1985
(Access will insert # symbols as necessary when it
recognises your date)
If you use between, the criteria should be of the form:
between 100 and 300
Step 4
Close the query, saving if necessary
Close all tables and queries, but leave the Navigation
Pane and Depar t ment Asset s. accdb still open

Access: Creating queries, forms and reports
65 IT Learning Programme
Exercise 5 Rearranging a query
Removing a field
Rearranging columns
Adjusting column width
Hiding and showing a field
Sorting query results
Deleting a query

Task 1
Continue working in the file
Depar t ment
Asset s. accdb
Step 1
If necessary, open Depar t ment Asset s. accdb
Close any tables or queries that may be open, using
Task 2
Open the query
qr yAsset sAndPr i ces
which has already been
made, in Design View
Step 1
Double-click the query qryAsset sAndPr i ces which
has already been made
Click on the Home tab to open this query in
Design View
Step 2
Look carefully at the design grid, noting which tables
and which fields are included
Step 3
Run the query to look at the resulting dataset, then
return to Design View
Task 3
Delete the field
Depar t ment I D
Step 1
Select the column for Depar t ment I D (click at the top
of the column until the whole column appears black)
Press DELETE to delete this field from the query
Task 4
Drag the column
Dept Name to be the last on
the right
Step 1
Click at the top of the Dept Name column to select it
(the column turns black)
Use drag and drop to move it to an empty column to the
right of other fields on the grid
This may be tricky and takes practice!
Task 5
Run the query
In Datasheet View, make
the Dept Name column
wide enough to show all the
text entries
Step 1
Click to run the query and display fresh results.
Step 2
In Datasheet View, drag the divider at the right-hand
edge of the top of the Dept Name column, to adjust the
column width
Step 3
Make this column wider until the text values can be seen
Access: Creating queries, forms and reports
IT Learning Programme 66
Task 6
In Design View, clear the
Show checkbox under
Asset I D, then run the
query to confirm that this
field is no longer showing
Then tick the checkbox
again to show Asset I D
values
Step 1
Click to return to Design View
In the column for Asset I D, click the checkbox in the
Show row, until the tick disappears
Step 2
Run the query and note that the Asset I D data is not
displayed
Step 3
In Design View again, click the Show checkbox under
Asset I D to place a tick there, so these values will be
shown
Task 7
Sort the results in order of
the date the asset was
bought (acquired), oldest
items first
Then re-sort in alphabetical
order of Department name,
with a secondary sort of
Purchase Price
Step 1
In the Dat eAcqui r ed column, in the Sor t row,
choose Ascendi ng
Step 2
Run the query and notice the order the records appear
Step 3
Remove the previous sort setting: select not sor t ed in
the drop-down list
Move the Dept Name column so it appears to the left of
the Pur chasePr i ce column
Step 4
Select Ascendi ng in the Sor t row in the Dept Name
column and also in the PurchasePr i ce column
Step 5
Run the query and check the sorting is as expected
(alphabetical order by Department name with a
secondary sort based on the purchase price)
Task 8
Close the query, discarding
changes
Step 1
In either view, click to close the query
When asked, choose not to save the changes
Task 9
Close the database file Depar t ment Asset s. accdb, leaving Access still open

Access: Creating queries, forms and reports
67 IT Learning Programme
Exercise 6 Using a form and creating an instant form
Using an existing form
Using a form to view or edit data
Creating a form using the instant form tool
Saving the form (using naming convention)

Task 1
Open the file Pendl et on
Pr oduct s. accdb
Step 1
Open Pendl et on Pr oduct s. accdb which is in the
network drive H: \ (or in another location as directed by
your teacher)
Task 2
Run f r mEmpl oyees from
the Navigation Pane
Edit some data values
Close the form
Step 1
In the Navigation Pane, find the form named
f r mEmpl oyees
Run it by selecting the form name and pressing ENTER,
or by double-clicking the form name
Step 2
This form shows just one record at a time; use the
navigation buttons (at bottom left) to move among the
records
Navigate to the record for Keith Simpson
Step 3
Use TAB and SHIFT+TAB to move among the fields of a
single record
Correct his salary to 20000 (the symbol will be added
by Access as part of the currency format)
Step 4
Correct his middle name to Arthur
Close the form
Task 3
In the list of tables, select
t bl Orders
Create an instant form
based on this table
Step 1
Select t bl Orders from the list of tables in the
Navigation Pane (click just once)
Step 2
Click on the Cr eat e tab of the Ribbon to create an
instant form based on t bl Orders
Step 3
The form opens in Layout View
Access: Creating queries, forms and reports
IT Learning Programme 68
Task 4
Look at the new form in
Form View
Navigate among the fields
and among the records
Step 1
Change to Form View by clicking
Step 2
This form shows just one record at a time; use the
navigation buttons (at bottom left) to move among the
records
Use TAB and SHIFT+TAB to move among the fields of a
single record
Step 3
Close the form, giving it a suitable name such as
f r mOr der sI nFul l
Task 5
Close all forms, leaving the
database open
Step 1
Close all forms, but leave the Navigation Pane and
Pendl et on Pr oduct s. accdb still open

Exercise 7 Creating a form using the wizard
Creating a form using the wizard, based on a table
Creating a form using the wizard, based on a query

Task 1
Continue working in the file Pendl et on Product s. accdb
Close any tables, queries, or forms that may be open, using
Task 2
Start the wizard
Choose t bl Cust omers and
all fields
Choose Just i f i ed layout
Give a suitable name for the
form, with the prefix f r m
Step 1
Click on the Cr eat e tab of the Ribbon
Step 2
In the wizard, choose t bl Cust omers
Select all the fields available, using >>
Step 3
Choose the Just i f i ed layout
Step 4
Name the form f rmCust omers
Click to view the form in Form View
Here you can edit the data
Access: Creating queries, forms and reports
69 IT Learning Programme
Task 3
Use the wizard and create a
new form based on
qrySal esTeamAndOr ders
including all the fields and
a design that seems suitable
to you
Name it
f r mSal esTeamOr der s
Run the new form
Step 1
Click on the Cr eat e tab of the Ribbon
Step 2
Base the new form on the query called
qrySal esTeamAndOr ders
Use all the fields
In the layout, choose to view the data by t bl Orders
using a single form
Choose the Just i f i ed for the layout
Step 3
Save the form, giving it the name
f r mSal esTeamOr der s
Examine the form in Form View and inspect several
records of data
Task 4
Leave the form f r mSal esTeamOr der s still open for the next exercise

Exercise 8 Design changes on a form
Using a theme to change the appearance of a form
Editing label text
Moving and resizing labels
Moving and resizing controls

Task 1
Open
f r mSal esTeamOr der s in
Layout View
Step 1
Continue working on f r mSal esTeamOr ders
If necessary, right-click on the form name in the
Navigation Pane then select Layout Vi ew
Step 2
Check that you are working in Layout View
Step 3
Notice that the For m Layout Tool s tabs appear
Sample data is displayed in the form, but it is not
editable here
Task 2
Use the Themes Gallery to
change the formatting
Step 1
Click on the Desi gn tab to display a gallery of
theme options
Step 2
Select any one of the options
Step 3
Notice how the font, colours, and borders of the whole
form are affected
Access: Creating queries, forms and reports
IT Learning Programme 70
Task 3
Modify the title of the form:
Our Sales Team
Resize the label to fit the
contents
Step 1
Select the label displaying the title text
frmSalesTeamOrders (an orange border should
appear around the label after you click on it)
Step 2
Click again inside the box to start editing the text
Step 3
Change the text to: Our Sales Team
Click outside the label to stop editing the text
Step 4
Select the title label again
Drag the rightmost edge of the title control, to resize the
label to fit the new text
Drag the lower edge to fit the contents
Task 4
Move the Requi r ed- By
Dat e control with its label
so it is below the Order
Date
Resize the date controls so
the right edges are lined up
Step 1
Select the label Requi red- By Dat e
Step 2
Click and drag (or use the arrow keys) to position this
label underneath the order date
Step 3
Select the control for the Requi r ed- By Dat e (it
probably displays sample data similar 03-01-2003)
Click and drag to position the field control underneath
its label
Step 4
Select the control for the Or der Dat e field
Drag the rightmost edge of the control, resizing to match
the Requi r ed- By Dat e control
Repeat for the Or der Dat e label
Task 5
Run the form and edit some
data
Close the form (save
changes)
Step 1
Select to view your changes in Form View
Enter or modify some data using the form
Step 2
Click to close the form, saving changes when
prompted

Access: Creating queries, forms and reports
71 IT Learning Programme
Exercise 9 Using a layout on a form
Creating an instant form
Recognising a layout
Resizing a control in a layout
Moving a control in a layout
Arranging parts of a layout
Showing and hiding grid lines around a layout

Task 1
Create an instant form,
based on t bl Cust omers
Rename the form
f r mCust omersArr anged
Step 1
Continue working in Pendl et on Pr oduct s. accdb
Step 2
Select the table t l bCust omers, by clicking once on the
table name in the Navigation Pane
Step 3
Create an instant form based on that table, by clicking
on the Cr eat e tab
Step 4
Save the new form, naming it
f r mCust omersArr anged
Task 2
Confirm that you are
working in Layout View
Step 1
In the Home tab, use to ensure that you are
working in Layout View
Task 3
Edit the label at the top of
the form
Step 1
Click the label in the blue area at the top of the form
(it probably reads tblCustomers)
Step 2
Click a second time inside the label, so that a flashing
insertion point appears
Step 3
Replace the text tblCustomers with
Customer Details
Task 4
Examine the stacked layout
that has been set up on this
form
Step 1
Click on any field control in the main form
Step 2
Notice the dotted box that appears, enclosing several of
the field controls
Step 3
Notice the handle that appears at the top left of the
dotted box
Access: Creating queries, forms and reports
IT Learning Programme 72
Step 4
These field controls have been organised into a stacked
layout (the instant form creator did this automatically)
Task 5
Experiment with the effect
of resizing a control within
the layout
Step 1
Click on one control in the layout
Step 2
Drag the left edge of the control, to re-size it
What happens?
Step 3
Drag each edge of the control in turn , and observe the
effect on other members of the layout
Task 6
Experiment with the effect
of moving a control up and
down within the layout
Step 1
Click (once) on the Emai l Address control
Use to select this row in the layout
Step 2
Use and to rearrange this control
Step 3
Notice that the label accompanies the Emai l Address
control
Notice the way the field controls in the layout rearrange
Step 4
Leave the Emai l Address control just below the
Company/ Depar t ment control
Task 7
Experiment with inserting a
row or a column into the
layout
Step 1
Click the Bi l l i ng Addr ess control
Step 2
Click to insert a blank row above the current
selected position
This may provide a space to improve the appearance of
the form, or you may later decide to insert another field
control
Task 8
Experiment with some of the other buttons on the Ar r ange tab
Task 9
Use and experiment with showing and hiding the gridlines
These gridlines are shown on the screen to help you when designing; they will not
be seen when the form is used
Access: Creating queries, forms and reports
73 IT Learning Programme
Task 10
Run the form and edit some
data
Close the form
(save changes)
Step 1
Select to view your changes in Form View
Step 2
Enter or modify some data using the form
Step 3
Notice the effect of the layout in keeping the controls
neatly arranged
Step 4
Click to close the form, saving changes when
prompted

Exercise 10 Formatting controls and labels on a form
Formatting text in a field box on a form
Colour fills and borders around controls and labels
Changing background colours

Task 1
Open
f r mDet ai l sOf Cust omers
in Layout View
Step 1
Continue working in Pendl et on Pr oduct s. accdb
Close any tables, queries, or forms that may be open,
using
Step 2
Open f r mDet ai l sOf Cust omer s in Layout View, by
right-clicking on the form name in the Navigation Pane
then selecting Layout Vi ew
Task 2
Change the font size for the
Company Name field and
make it bold
Step 1
Select the control for the field Company Name
(it probably displays the sample data Jennies
Jellies)
Step 2
Change the font size to 18 point using the font tools
on the For mat tab
Step 3
Use a button to make this text bold
Task 3
Change the fill and border
colours for the Emai l
Address field
Step 1
Select the control for the Emai l Address field
(it probably displays the sample data jen@jellies)
Step 2
Click the dropdown arrow for on the
For mat tab and change the fill colour to yellow

Access: Creating queries, forms and reports
IT Learning Programme 74
Step 3
Click the dropdown arrow for on the
For mat tab and change the border colour to red
Step 4
Experiment with changing the colours and borders of
other controls and labels, using the options on the
For mat tab
Task 4
Change the background
colour of the form detail
Step 1
Click on the background of the form
(i.e. not on a control or label)
An orange border should appear around the Detail
section of the form
Step 2
Use on the Format tab to change the
background colour of the form detail to something
suitable

Task 5
Run the form
Save changes; leave the
form open for the next
exercise
Step 1
Select to view your changes in Form View
Step 2
Click on the Quick Access Toolbar, to save this
form, leaving it open for the next exercise

Exercise 11 Using the Property Sheet (for a Form)
Display the Property Sheet (and review some of the changes made
recently)
Change some Format properties
Change a Data property
Change an Other property
Change a property of the Form itself

Task 1
Continue working in f r mDet ai l sOf Cust omers in Layout View
Access: Creating queries, forms and reports
75 IT Learning Programme
Task 2
If necessary, display the
Property Sheet
Step 1
Confirm that you are working in Layout View
Step 2
If the Property Sheet is not visible, click on the
Desi gn tab of the Ribbon
Step 3
Move the Property Sheet to a convenient place, by
dragging its title bar
Task 3
Look at the properties of
the CompanyName control
in the Property Sheet
those in the For mat page
will be as you set earlier,
using the buttons
Change one of the
properties
Step 1
Select the CompanyName control
The properties of this control are now shown in the
Property Sheet
Step 2
Click the For mat tab on the Property Sheet
Notice that some of the formats set here are the values
you set earlier when you were using buttons
Step 3
This is an alternative way of making the same changes
you made earlier using toolbar buttons
With the CompanyName control selected, set the
Font Size to 18
Step 4
The Property Sheet offers many more properties
Change the Special Effect (on For mat tab) to
Shadowed
Task 4
Use the Property Sheet,
Dat a tab, to set a default
value of Oxon, for the
Count r y/ Regi on control
Step 1
Select the Count r y/ Regi on control
In the Property Sheet, click the Dat a tab
Step 2
In the Default Value box, type Oxon
Now whenever a user creates a new record using this
form, the default value of Oxon will be entered
(the user can over-write this value as necessary)
Task 5
Use the Ot her tab of the
Property Sheet to enter a
ControlTip text for the
Not es control, such as
Please give any
further relevant
information here
Step 1
Select the Not es control
In the Property Sheet, click the Ot her tab
Step 2
For the ControlTip Text, type Please give any
further relevant information here
Now when a user pauses the mouse pointer over the
Notes box, they will see a ControlTip with your helpful
message
Access: Creating queries, forms and reports
IT Learning Programme 76
Task 6
Look at the properties of
the form itself
Give the form a caption
such as Pendleton
Products, Lancs
Step 1
Use the combo box at the top of the Property Sheet to
display the properties of the Form itself
Step 2
In the Property Sheet, click the For mat tab
Step 3
In the Capt i on box, type Pendleton Products,
Lancs
Now this caption will appear on the title bar when the
form is opened in Form View
Task 7
Examine the effects of your
changes in Form View
Close and save the form
Step 1
Click to switch to Form View
Notice all the changes you have made
Step 2
Return to Layout View to make further changes if
necessary
Step 3
Close the form, agreeing to save changes if prompted
Task 8
Close the form (save
changes) and close the file
Pendl et on
Pr oduct s. accdb
Leave Access open
Step 1
Click to close the form, saving changes when
prompted
Close the database file Pendl et on Product s. accdb,
leaving Access still open

Exercise 12 Creating a report instantly
Creating a report using the instant report tool
Run the report and examine the data

Task 1
Open I nvent ory Toy
Li br ar y. accdb
Examine the tables to find
out the data that is included

Step 1
Open I nvent or y Toy Li br ary. accdb which is in the
network drive H: \ (or in another location as directed by
your teacher)
Step 2
Open each of the tables to explore the information in the
database and the names of fields
Step 3
Close all tables
Access: Creating queries, forms and reports
77 IT Learning Programme
Task 2
Create an instant report
based on t bl Toys
Step 1
Select t bl Toys from the list of tables in the Navigation
Pane (click once)
Step 2
Click on the Cr eat e tab to create a new report
based on t bl Toys
The report opens in Layout View
Step 3
Choose to switch to Report View
Notice that all fields and records have been included and
default formatting has been applied (you may have to
use the scrollbars to view all of the information)
Step 4
Close the report by clicking , saving it as r pt Toys

Exercise 13 Creating a report using the wizard
Create a report using the wizard, based on a table
Run the report and examine the data
Creating a report using the wizard, based on a query
Run the report and examine the data

Task 1
Continue work in the I nvent or y Toy Li br ar y. accdb
Task 2
Using the Report wizard,
create a new columnar
report on the families
belonging to the toy library
For each family, include the
last name, address in 3
parts plus postcode and
main telephone number
Step 1
Click on the Cr eat e tab of the Ribbon
to start the wizard
Step 2
In the wizard, choose the table called
t bl Member Fami l i es
Step 3
Choose these fields:
Last Name, Ot herLast Name
Addr ess1, Addr ess2, Address3
Post Code
Tel Num
Step 4
Do not add any grouping levels
Set a sort order based on Last Name, Ascending
Access: Creating queries, forms and reports
IT Learning Programme 78
Step 5
In the Layouts, choose Col umnar
Task 3
Name the report
r pt Fami l yAddr esses
Examine the finished report
in Print Preview
Close the report
Step 1
In the last part of the wizard, give a name for the report
r pt Fami l yAddr esses
Step 2
When you finish the wizard, the report opens in Print
Preview
Step 3
Confirm that the expected fields are included
Navigate between the pages and look at the data
Step 4
Click to close the report
Task 4
Use the wizard again to
create a new report
List all the toys that each
family has borrowed
Base this report on
qr yToysHel dByEachFami
l yNow
Step 1
Click on the Cr eat e tab of the Ribbon
to start the wizard
Step 2
In the wizard, choose the query called
qr yToysHel dByEachFami l yNow
Step 3
Choose these fields:
Last Name
Address1
Post Code
Tel Num
ToyMake
ToyName
Not esOnUse
Step 4
Choose to view the data by t bl Member Fami l i es
Do not add any grouping levels or sorting
Step 5
Choose a layout that seems suitable
Name the report r pt ToysHel d
Step 6
Examine the report, noticing how the information is
presented
Close the report

Access: Creating queries, forms and reports
79 IT Learning Programme
Exercise 14 Design changes on a report
Working on a report in Layout View and Print Preview
Using themes to change the formatting
Inserting page numbers
Changing the paper size and orientation

Task 1
Run
r pt ToyPurchaseHi st ory
Examine the data in this
report records are
grouped by Toy Make
Close the preview

Step 1
Continue working in I nvent ory Toy Li br ary. accdb
Close any tables, queries, forms, or reports that may be
open, using
Step 2
Double-click on r pt ToyPurchaseHi st ory in the
Navigation Pane to run the report and view the output
Step 3
Right-click on the report name and choose Pr i nt
Previ ew
Step 4
Set a suitable zoom % and examine the report
Step 5
Examine the column headings and data on each page
Records have been grouped so that the toys with the
same make are listed together
Task 2
Switch to Layout View
Use the Theme Gallery to
change the formatting
Step 1
Right-click on the report name and select Layout
Vi ew
Notice that the Repor t Layout Tool s Ribbon tabs
appear
Step 2
Click on the Desi gn tab, to display a gallery of
alternative themes
Select any of the themes
Step 3
Notice how the font, colours, and borders of the whole
report are affected
Task 3
Insert a page number in the
footer of the report
Step 1
In the Desi gn tab, choose
Step 2
Choose:
Page N of M format
Bot t om of Page [ Foot er ] position
Cent er alignment
Access: Creating queries, forms and reports
IT Learning Programme 80
Step 3
Click to insert a page number at the
bottom of each page of the report
Step 4
Scroll down to the bottom of the report in Layout View
to see the inserted page number label
For the time being, it is simply displayed as Page 1 of 1
since data in Layout and Report View are shown on one
long page
Step 5
Switch back to Print Preview (right-click on the report
name and choose Pri nt Previ ew)
Notice the page number (Page x of 2) in the footer of
each printed page
Task 4
In Print Preview, change
the page size to A5 and the
orientation to Landscape
Step 1
Choose from the Pri nt Previ ew Ribbon
In the Page Set up dialog, on the Page tab, change
the paper size to A5 (which is half the size of A4)
Step 2
Click to make the changes to the report
layout
Notice that the column headings may now be spread
over more pages
Step 3
Choose orientation on the Ribbon and notice how
this affects the report
Task 5
Experiment with further
layout changes
Close the report, discarding
changes
Step 1
Experiment with other settings on the Pri nt Previ ew
Ribbon or in the Page Set up dialog
Step 2
Click to close the report
When prompted, do not save the changes

Access: Creating queries, forms and reports
81 IT Learning Programme
Exercise 15 Working with controls and labels on a report
Understanding controls and labels on a report
Selecting controls and labels
Moving and resizing controls
Editing label text

Task 1
View the report
r pt MemberFami l i es
Switch to Layout View
Step 1
Continue working in I nvent ory Toy
Li br ar y. accdb
Close any tables, queries, forms, or reports that
may be open, using
Step 2
Double-click r pt MemberFami l i es in the
Navigation Pane
Step 3
Notice how the data is organized in a tabular
layout, with labels in the header for the title and
column headings, and labels in the footer for the
date and page number
Step 4
Switch to Layout View by right-clicking on the
report and choosing Layout Vi ew
Task 2
Click once on a control and
notice the orange selection
border (and lighter orange
border around any related
objects)
Resize a control horizontally and
vertically
Step 1
Notice that some of the entries in the Dat e
Joi ned column appear as ######## because
the text is too long to fit in the control
Step 2
Click on one of the textboxes in the Dat e Joi ned
column (an orange border should appear around
that object, and a lighter orange border should
appear around the other textboxes in this column)
Step 3
Drag the right-edge of the control to resize the
textbox until all of the dates are visible
Notice that all of the textboxes in this column are
resized
Step 4
Drag the bottom edge of the control to include
additional vertical space between rows in the
report
This can be tricky and may take some practice!
Step 5
Experiment with selecting and resizing other
textboxes on the report
Access: Creating queries, forms and reports
IT Learning Programme 82
Task 3
Move a control sideways to
change the column order
Step 1
Click on one of the textboxes in the Dat e Joi ned
column
Step 2
Drag it to the left to move the Dat e Joi ned
column next to Sur name
Step 3
Experiment with dragging other controls sideways
to move the control and change the column order
Task 4
Modify the text in a label
Step 1
Click the label r pt Member Fami l i es in the
header of the report, to select it
Step 2
Click inside the label again to start editing the text
Change the text to read Member Families
Step 3
When finished typing, click outside the label
Task 5
Preview the report
Save the report but leave it open
for the next exercise
Step 1
Switch to Print Preview to view your changes to
the report
Step 2
Choose Fi l e| Save to save the report changes
made so far
Step 3
Do not close the report

Exercise 16 Formats and properties in a report
Formatting using buttons on the Ribbon
Conditional formatting (optional)
Formatting using the Property Sheet

Task 1
Continue working in r pt MemberFami l i es in Layout View
Task 2
Modify the text and formatting in
a label, to make it stand out
Step 1
Click the Member Families label in the header
of the report, to select it
Step 2
Change the font size to 20 point
Step 3
Experiment with other formatting options using
buttons on the For mat tab
Access: Creating queries, forms and reports
83 IT Learning Programme
Task 3
Change the date format for the
Dat eJoi ned control
Step 1
Select any of the Dat eJoi ned controls (look for
the orange border once it is selected)
Step 2
On the For mat tab of the Ribbon, click the Date
Format control
Choose a different date format, such as Short
Date
Step 3
Observe the effect on your report
Adjust control widths as necessary
(Opti onal) Task 4
Change the format of the Addr ess3 control, so that Oxon appears in bold blue
text, while other counties appear in ordinary black
Task 5
Display the Property Sheet using
Experiment with selecting various objects on the report, and notice the properties
set for each (some properties were set using buttons on the Ribbon)
Task 6
Change the Back Color and
Alternate Back Color for the
Det ai l section of the report
Step 1
Click at the right-hand edge of a row (avoiding any
data controls) to select the Det ai l section of the
report
Confirm that the Property Sheet is displaying the
properties of the Det ai l
Step 2
In the Back Col or property, click
Choose an interesting colour
Step 3
In the Al t er nat e Back Col or property, click
and choose a contrasting colour (bear in mind that
the report will probably be presented in printed
form)
Task 7
Change the Caption of the report
Step 1
Click in the report margin, to show the properties
of the report itself
Step 2
Replace the text in the Capt i on property with
Member Families
Task 8
Preview the report
Close the report, saving changes
Step 1
Switch to Print Preview to view your changes to
the report
Step 2
Close the report, saving if prompted
Access: Creating queries, forms and reports
IT Learning Programme 84

Exercise 17 Sorting and grouping records in a report
Grouping records using the wizard
Sorting records using the wizard

Task 1
Start the Cr eat e new r epor t
wizard
Base it on t bl Toys
Choose all the fields except
the ToyI D
Step 1
Continue working in I nvent ory Toy
Li br ar y. accdb
Close any tables, queries, forms, or reports that may
be open using
Step 2
Choose on the Cr eat e tab of the
Ribbon
Step 3
In the wizard, choose the table t bl Toys
Step 4
In the list of fields, click >> to select all the fields
Then select ToyI D in the right-hand list and click <
to remove just this field from the list
Task 2
Add a grouping level by
ToyMake
Sort the records by ToyName
(descending order) then by
Pri ce (descending order)
Step 1
When asked about grouping levels, select the
fieldname ToyMake and click >
The preview illustrates the way the records will be
arranged
Step 2
When asked about sort order, use the first drop-down
and choose ToyName
Then use the second drop-down and choose Pri ce
Ensure that buttons beside both are set to

Task 3
Complete the wizard,
choosing a suitable layout
Step 1
Choose the St epped layout
Step 2
Give the report name r pt ToysSor t ed
Task 4
Preview the report notice the way the records are arranged
If you like, work in Layout View to adjust the size and position of some controls as
necessary
Task 5
Close the report, saving if prompted
Close this database file, leaving Access open
Access: Creating queries, forms and reports
85 IT Learning Programme

Exercise 18 A report with summary calculations
Creating a report with detail calculations and grand totals
Examining the report

Task 1
Open Event Pl anner . accdb which is in the network drive H: \ (or in another
location as directed by your teacher)
Task 2
Run the query
qr yEvent sAndBooki ng
Numbers and notice the
fields it contains
Step 1
Run the query qr yEvent sAndBooki ngNumber s
Step 2
Notice the fields it includes your report will be based
on this query
Step 3
Close the query
Task 3
Create a new report using
the wizard, based on
qr yEvent sAnd
Booki ngNumbers,
and grouping the data by
VenueName
Step 1
Click on the Cr eat e tab of the Ribbon
Step 2
Base the new report on the query
qr yEvent sAndBooki ngNumbers
Step 3
Include all the fields
Step 4
In the part of the wizard about viewing the data, choose
t bl Event
Step 5
In the grouping part, group the data by VenueName
Step 6
In the sort order part, select Event St ar t Dat e and

Task 4
Click
Calculate the sums of the
number of visitors, number
of stands and number of
stands booked
Step 1
In the sort order part of the wizard, click

Step 2
Check the Sum column for all 3 fields,
Event NumVi si t ors, Event NumSt ands, and
Event NumSt andsBooked.
Step 3
Check other boxes if you wish
Step 4
Choose St epped layout and Landscape orientation
Access: Creating queries, forms and reports
IT Learning Programme 86
Step 5
Choose Techni c style
Name the report r pt Event Cal cul at i ons
Task 5
Review the finished report
Notice the total values
calculated for each venue
and the grand total for the
whole dataset
Step 1
The report opens in preview
With a suitable zoom setting, look over the results
Step 2
For each group of records at the same venue, the total
numbers are shown
The grand totals are shown at the end of the report
Task 6
You may wish to look at the report in Layout View, and improve the label text and
general appearance: for example, align each sub-total better below its column of
figures
Save and close the report
Task 7
After the course, close Access and leave the computer at the desktop

Access:Creatingqueries,formsandreports
1
IT Learning Programme
Access:
Creating Queries, Forms and Reports
Todays arrangements
Your teacher is:
Your demonstrators are:
We finish at: 12:15
Your safety and comfort are important
Where is the fire exit?
Please report any equipment faults to us
The toilets are along the corridor outside the
teaching rooms
The rest area is where you registered;
it has vending machines and a water cooler
The course handbook
Tasks for you to practice during todays course
Work at your own pace!
Divided into tasks and small steps
Be selective
Follow-up work
Continue with exercises after the session
Computer-8 drop-in sessions
Road map for Creating Queries, Forms and Reports
Queries
Reports
Forms
Data is
stored in
tables
Showing data
on screen
Editing and
reviewing
data
For
interrogating
data
Presenting
data on
paper
with some
analysis
Getting
Started
Access:Creatingqueries,formsandreports
2
Getting started with Access
Start Access
In IT Learning Programme teaching rooms, use a
desktop icon
or Start menu etc.
Access version 2010 in teaching rooms
Enabling macros? (see appendix in the course book)
Virus security (optional)
By default, Access 2003 intercepts every file on
opening
You must have good, up-to-date virus checking
software on your computer
If so, set Access Virus Security to Low:
Tools|Macro|Security
On the Security Level tab, set Low
Access 2010 displays a yellow info bar
For today you can proceed as usual
Trusting the File Location
with Access 2010 (Optional)
On the File menu, click
Select the Trust Center and
Select Trusted Locations and
Opening a database file
Today, the exercise files are in your
network drive H:\
Database vocabulary
A database is a collection of data
Data is organised into one or more tables
Each row is a record
Each column is a field
Name Phone Town
Record 1 Peter 238172 Oxford
Record 2 Sheila 426372 Witney
Record 3 Janine 826812 Thame
Creating a
Select Query
Access:Creatingqueries,formsandreports
3
A select query collects data from tables
Combine data from one or more related tables
Sort records
Select only some fields
Select only some records
Apply criteria
Queries are listed in the Navigation Pane
Creating a query
using the wizard
on Create tab
Choose a table (or another query)
Choose some fields
Use > and < buttons
Give the query a name
Query names begin with qry
No spaces
Query results
Results are presented in Datasheet View
Only selected fields and selected records are
shown
Editing the data here will change the source data
in the tables
Query Design View
Switch between Design and Datasheet Views
Diagram shows tables, fields and joins
Design grid lists the selected fields
Close and save the query
Using a query
Available queries are listed in the Navigation Pane
Select a query name and press <Enter>
Or double-click the query name
When query is run, Access presents the latest
values from the tables
Creating a query in Design View
Choose a table
Choose some fields
Drag & drop a field name
or double-click a field name
or choose from drop-down list at the top of a column
Wildcard * represents all fields
Access:Creatingqueries,formsandreports
4
A query based on two tables
In Query Design View
Click
Add all the tables needed for this enquiry
Joins show any relationships which had been set
up previously
Any record which appears in both tables will be
shown in the results dataset
Modifying a
Querys Design
Query criteria
Limit the records included in the results
Enter a value under one field
All records which exactly match will be included
Two or more criteria in the same row must all be
satisfied (AND)
Two or more criteria on separate rows permits
any one to be satisfied (OR)
Expressions in criteria
Comparison operators
> < >= <= between
Wildcard symbols * ? #
Not
Is Null
Yes/No criteria: use -1 or 0
Changing a query design
Drag and drop to rearrange the fields
Adjust a column width in either view
Remove a field from the grid ([Delete] key)
Show/Hide a field
Sort
Data is sorted by all the fields marked,
giving priority from left to right
Close the query, saving when prompted
Access:
Creating Queries, Forms and Reports
Look at Exercises 1 to 5
Drinks and food in the refreshment area only, please
Restart at 10:15
Demonstrators:
Access:Creatingqueries,formsandreports
5
If you want to continue with the Exercises,
you could
Copy the Exercise files to a
memory stick
Download the files (and
more) from
the ITLP Portfolio at
http://portfolio.it.ox.ac.uk
Creating a
Form
Forms
are used for entering and editing data
A form presents data from the table
Layout is suitable for using on computer screen
Typically show one record at a time
Good layout helps the user to enter data accurately
Type-in boxes, drop-down list boxes and other controls are easy to
use
Creating a form instantly
First choose a table or query in Navigation Pane
on Create tab
New form has all the fields and a default layout
and style
Name the form with care
Using a form
Available forms are listed in the Navigation Pane
When a form is run, Access takes the up-to-date
values from the tables
Navigate between fields and records
Edit data values
Creating a form
using the wizard
Wizard steps you through creating a simple form
Give a name
Form names begin with frm
No spaces and limited punctuation
Access:Creatingqueries,formsandreports
6
Modifying a
Forms Design
Editing the data
Using the form
Sample data is visible but not editable
Rearranging the form
No data values
Detailed design changes (later course)
3 views of a form
Theme transforms the form
Quickly change the whole look of a form using the
Theme Gallery
In Layout View
Manipulating a text box
Click a control or a label to select it
Drag a control to move
Drag an edge to resize
Edit text inside a label
<Delete> to remove a control or label
Arranging several controls
<Shift> for multi-select
A layout manages all its controls as a set
Drag the handle to move the whole set
Arrange the controls inside the layout
Buttons for popular formatting options
Individual controls
Font formatting
Colours, lines and fills
Number, date formatting
Conditional formatting
Access:Creatingqueries,formsandreports
7
The Property Sheet
More properties for form controls
A form itself has properties
Record source for queries
Scroll bars, buttons etc
Access:
Creating Queries, Forms and Reports
Look at Exercises 6 to 11
Drinks and food in the refreshment area only, please
Restart at 11:15
Creating a
Report
Reports
Presents data from
a table or query
In a layout suitable
for printing
Typically several
records per page
Data cannot be
edited in a report
Good layout means
data can be read
and interpreted
Summary
calculations may
be added
Creating a report instantly
First choose a table or query in Navigation Pane
on Create tab
New report has all the fields and a default layout
Choose a report name with care
Creating a report
using the wizard
First choose a table or query
Choose some fields
Group records as appropriate
Set sorting orders
Choose a layout
Assign a report name (prefix is rpt)
Access:Creatingqueries,formsandreports
8
Using a report
Report is presented in Print Preview
Navigate between the pages
Zoom
Close the preview and close the report
Reports are listed in the Navigation Pane
Select a report name and double-click to run it
Mailing label wizard
(Optional)
choose the
fields
select the
records
print the
labels
Modifying a
Reports Design
4 views of a report
Previewing the data, as it will print
out (with pagination)
Reviewing the data
Viewing sample data but not editing
values
Rearranging the report
No data values
Detailed design changes
Theme transforms the report
Quickly change the whole look of a report using
Themes Gallery
In Layout View
Manipulating a text box
Click a control to select it (with others in the same field):
Drag a control sideways to move
Drag an edge to resize
(with others in the same field)
Access:Creatingqueries,formsandreports
9
Formatting an element of a report
Edit text inside a label
On the Format tab:
Font formatting
Colours, lines and fills
Number, date formatting
Conditional formatting
More options in the Property Sheet
Overall Layout
of a Report
Report layout
Page Setup tab
Change paper size, orientation, margins etc.
Design tab
Page numbers in header/footer
Grouping data on a report
Choose grouping in the wizard
Wizard includes a preview to illustrate your choice
All records with the same value in this field are
collected together in the report
Sub-headings label each group
Summarising data
on a report
Summary calculations can be included, using the
wizard
If the data is suitable
On the Sorting page, click
Choose fields
Choose summary values SUM, Average etc
More About
Access
Access:Creatingqueries,formsandreports
10
Further courses
Further work with Access:
Designing forms and reports
Analysing data
Problems
Computer-8
help@it.ox.ac.uk
Visit or phone 8:30am-8:30pm Monday-Friday
If you want to continue with the Exercises,
you could
Copy the Exercise files to a
memory stick
Download the files (and
more) from
the ITLP Portfolio at
http://portfolio.it.ox.ac.uk
Access:
Creating Queries, Forms and Reports
Now look at the remaining Exercises, 12 - 18
Finish at 12:15
This presentation is made available by Pamela Stanworth
under a Creative Commons licence:
Attribution-NonCommercial-ShareAlike
CC BY-NC-SA
pamela.stanworth@it.ox.ac.uk

You might also like