90
Databases: Reporting data using Access

Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

  • Upload
    others

  • View
    19

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data

using Access

Page 2: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access TDAH

IT Learning Programme ii

How to Use This Course Book This handbook accompanies the taught session 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

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 Course Clinics at the IT Learning Programme, 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 ike th is .

A button to be clicked will look l ike th is .

The names of software packages are identified like this, and the names of files to be used l ike this .

Software Used

Access 2013

Page 3: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

TDAH Databases: Reporting data using Access

iii IT Learning Programme

Files Used

Extra Resource Data.accdb ExtraAuthors.txt Inventory Toy Library2.accdb Keywords for Teaching Resources.docx ResourcesTable.xlsx Sales Invoices.accdb Teaching Resources2.accdb

Revision Information

Version Date Author Changes made

1.0 August 2014 Pamela Stanworth Created

1.1 January 2015 Pamela Stanworth Small edits

2.0 July 2015 Pamela Stanworth Revised for Access 2013

2.1 February 2016 Pamela Stanworth Small edits

Copyright

Pamela Stanworth makes this document and the accompanying PowerPoint presentation available under a Creative Commons licence: Attribution-NonCommercial-ShareAlike CC BY-NC-SA. [email protected]

Screenshots in this document are copyright of Microsoft.

The Oxford University crest and logo and IT Services logo are copyright of Oxford University and may only be used by Oxford University members in accordance with the University’s branding guidelines.

Page 4: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access TDAH

IT Learning Programme iv

Contents How to Use This Course Book ..................................................... 2 

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 App or Desktop Database? .................................................................. 2 

1.5 Using Access (Office) 2013 .................................................................. 2 

1.6 Keyboard Methods for Using Access .................................................. 2 

1.7 Where Can I Get A Copy? .................................................................... 3 

1.8 Using the Database Files for ITLP Exercises ...................................... 3 

2 Data Management ..................................................................... 4 

2.1 Importing Data .................................................................................... 4 

2.2 Using the Imported Data .................................................................... 8 

2.3 Linking Data ....................................................................................... 9 

2.4 Exporting Data ................................................................................... 11 

2.5 Archiving ............................................................................................ 12 

3 Creating a Report using the Wizard ....................................... 13 

3.1 Using the Wizard to Create a Report Based on a Table ..................... 13 

3.2 Saving and Naming the Report ......................................................... 14 

3.3 Using the Wizard to Create a Report Based on a Query ................... 15 

3.4 Using the Report ................................................................................ 16 

3.5 Managing Reports .............................................................................. 17 

3.6 Mailing Labels (Optional) ................................................................. 17 

4 Building a Report From Blank ................................................ 19 

4.1 Creating a Report in Design View ...................................................... 19 

4.2 Showing and Hiding Tools and Sections ........................................... 19 

4.3 Switching Between Report Views ..................................................... 20 

4.4 Creating a Report in Layout View ..................................................... 21 

5 Controls on a Report ............................................................... 22 

5.1 Adding Title Objects In The Header or Footer ................................. 22 

5.2 Adding a Text Box (bound to a field) ................................................ 22 

5.3 Adding Several Field Controls Together .......................................... 23 

5.4 Control or Label? .............................................................................. 24 

Page 5: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

TDAH Databases: Reporting data using Access

v IT Learning Programme

5.5 Editing a Label .................................................................................. 24 

5.6 Adding a Label .................................................................................. 24 

5.7 Adding a Chart on a Report .............................................................. 25 

5.8 SubReports ....................................................................................... 25 

5.9 Reports in a User-Friendly Navigation Form .................................. 25 

6 Adjusting Report Controls ...................................................... 27 

6.1 Selecting a Control on a Report ........................................................ 27 

6.2 Resizing a Control ............................................................................. 27 

6.3 Moving a Control .............................................................................. 27 

6.4 Arranging Multiple Controls ............................................................ 27 

6.5 Deleting a Control ............................................................................. 28 

6.6 Other Kinds of Control ..................................................................... 28 

7 Formats and Properties in a Report ....................................... 29 

7.1 Themes on a Report .......................................................................... 29 

7.2 Formatting a Label or Control Using Buttons .................................. 29 

Exercise 10: Control and report properties using buttons ..................... 29 

7.3 Property Sheet for Individual Controls ............................................ 29 

7.4 The Report Background .................................................................... 30 

7.5 Properties of a Section or the Whole Report ..................................... 31 

7.6 Changing the Record Source of a Report – Including Queries (Optional) ................................................................................................ 31 

8 Working With Controls in a Layout ....................................... 33 

8.1 Creating a Layout .............................................................................. 33 

8.2 Adding and Removing Field Controls in a Layout ........................... 34 

8.3 Layouts May Be Set Up Automatically ............................................. 34 

8.4 Arranging and Aligning Objects in a Layout .................................... 34 

8.5 Moving and Resizing Controls in a Layout ...................................... 34 

8.6 Arranging a Layout ........................................................................... 35 

8.7 Gridlines Around a Layout ............................................................... 36 

8.8 Removing a Layout ........................................................................... 36 

9 Overall Design of a Report ...................................................... 37 

9.1 Orientation ........................................................................................ 37 

9.2 Page Setup ......................................................................................... 37 

9.3 Information in the Header or Footer ............................................... 37 

9.4 Sorting in a New Report Using the Wizard ...................................... 38 

Page 6: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access TDAH

IT Learning Programme vi

9.5 Sorting In an Existing Report ........................................................... 39 

9.6 Grouping in a New Report Using the Wizard .................................. 40 

9.7 Grouping In An Existing Report ........................................................ 41 

9.8 Keep Together Property ................................................................... 42 

9.9 Note: Grouping A Report Based On A Many-To-Many Relationship (Optional) ............................................................................................... 43 

9.10 Summary Calculations on a Report ................................................ 44 

10 What Next? ............................................................................ 46 

10.1 Downloadable Course Materials and More – the ITLP Portfolio ... 46 

10.2 Database Courses Which Precede This .......................................... 46 

10.3 Database Courses Which May Follow This .................................... 46 

10.4 Course Clinics.................................................................................. 46 

10.5 IT Services Help Centre .................................................................. 46 

Appendix 1: Viruses and Security Levels in Access ................... 47 

1.  Why Worry About Viruses? ........................................................... 47 

2.  Scanning for Viruses ...................................................................... 47 

3.  Access 2013 and Virus Security ..................................................... 47 

4.  Further Help with Security and Trust Center Settings .................. 51 

Appendix 2: Student Exercises .................................................. 52 

Page 7: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

1 IT Learning Programme

1 Introduction Welcome to the course “Databases: Reporting data using Access”.

This booklet 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 [email protected].

1.1 What You Should Already Know This session is one of a series that cover the important aspects of building and managing a database, using Microsoft Access as an example.

We will assume that you have already attended the courses “Databases: Building a database using Access” and “Databases: User-friendly databases using Access” (or equivalent), and that you are familiar with creating tables in Access with suitable fields, and creating basic forms. You do not need to know anything about creating reports.

The computer network in our 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:

Importing, linking and exporting data from other sources

Creating a report using the wizard or from blank

Adding and arranging controls in a report

Formatting reports and report objects

Ordering data in a report – sorting and grouping

Working in Layout View or Design View

Related Database sessions, should you be interested, are given in Part 10 below.

1.3 What Is Access? Access is database management software. It enables you to build and maintain a database.

Access 2013 is part of the Microsoft Office 2013 for Windows package. Access is not available for the Mac (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 reports, and we will mention tables and queries.

Page 8: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 2

A database application may be built – using forms, menus, control buttons and program code that responds to events.

1.4 App or Desktop Database? Access 2013 can also be used to create an app database : where users work on the data via a web browser. This would require communication using Office 365 or SharePoint 2013, and is not the subject of this course. We will create a desktop database , which is saved locally on your computer or a network drive.

1.5 Using Access (Office) 2013 If you have previously used another version of Office, you may find Office 2013 looks rather unfamiliar. “Office 2010: What’s 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

1.6 Keyboard Methods for Using Access 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 2013 applications without using a mouse. Pressing ALT once displays a black box with a letter or character next to each visible item on the ribbon and title bar (shown in Figure 1).

Figure 1 Keystrokes for Controlling 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).

Page 9: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

3 IT Learning Programme

Figure 2 Further Keystrokes for Controlling Buttons (press ALT+P to show these on the Page Layout tab of the Ribbon)

The elements of a dialog can be controlled, as usual with Windows applications, by using TAB to navigate between items or typing the underlined character shown beside an item.

1.7 Where Can I Get A Copy? If you have a copy of Microsoft Office Professional, then you already have a copy of Access. 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).

If you are a member of staff, you can obtain a copy of Microsoft Office Professional from the IT Services Online Shop. Students can obtain a Microsoft Student Licence, but this must be bought through a Microsoft Authorised Education Reseller; the help desk can direct you to a suitable reseller.

1.8 Using the Database Files for ITLP Exercises Please note that Access only trusts files if they have been saved in a “Trusted Location”. The network dr ive 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 52).

Page 10: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 4

2 Data Management

2.1 Importing Data Some of your data may have been created already, perhaps using another database management program, or even using some entirely different software such as a spreadsheet. It is often possible to import the data directly into an Access table, saving a lot of time and inevitable errors from hand-copying.

It is important, however, to plan the database carefully first, designing the tables, fields and relationships before you start inserting data. This process is discussed in the IT Learning Programme course “Databases: Concepts of database design” (see Part 10.2 below).

2.1.1 Importing Data From Excel Where the data has already been collected in a tabular layout, using a Microsoft Excel worksheet, it can be imported directly into an Access database, creating a new table. It is good practice to name the required range of cells, in the Excel file, first.

2.1.2 The Import Data Wizard

The Import group on the External Data tab of the ribbon includes . This starts the wizard that will take you through the process.

Now the Import Wizard starts.

In the first page, decide whether the data from Excel is to create a new table or is to be appended to an existing Access table. Appending will only work if the column headings in the Excel file match the existing field names in the Access table. Linking is discussed in Part 2.1.3 below.

If the workbook contains data in several ranges, it is important to indicate which range is wanted. Select either the correct worksheet or the correct Named Range. Sample data is then listed below, for confirmation.

Figure 3 Importing Data from a Spreadsheet

Page 11: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

5 IT Learning Programme

In the next page of the wizard, you can indicate whether or not there is already a header row at the top of the data in the spreadsheet.

Figure 4 A Row of Headings on a Spreadsheet

In the next page, you can set field options for each column (field). You may want different choices for each individual field.

Figure 5 Setting Field Options for Imported Data

Next you decide which field is to be the primary key.

Page 12: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 6

Figure 6 Choosing a Primary Key Field

Finally, assign a suitable name for the table. By convention, table names always begin with tb l . Similarly, query names begin with qry , form names begin with f rm and report names begin with rpt . These Reddick naming conventions can be found at http://mvps.org/access/general/gen0012.htm .

2.1.3 Importing Data From a CSV File Data may have been assembled using other software, with some file type which Access cannot import directly. In this case, it may still be possible to export the data into the widely-used csv (comma-separated variable) form, which Access can then import.

csv is a text file where the each record appears on a separate line, and field data within a record is separated using commas.

Figure 7 A csv File Viewed Using Notepad

The procedure for importing data from a csv file is similar to the above. Use

or one of the options from .

Page 13: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

7 IT Learning Programme

Figure 8 Importing Data from a csv File

The wizard then continues as described above.

The new table appears in the Navigation Pane. Note that this is a copy of the data from the original csv file. This table can be edited and changed, but the original file is unaffected.

2.1.4 Importing Data From a Text File If a list has been collected and saved using a word-processor program, it may be possible to import the data into an Access table. The source file should be saved in unformatted form (such as a .txt or .r t f file type) containing nothing apart from the data that is to be imported, and then imported into Access.

If the data is in a word-processor table (as is commonly used in Microsoft Word), this must be converted to a non-table layout. The Word command Convert to Text will make this change easily, inserting tab characters instead of a table. Ensure that no blank paragraph is left at the bottom of the document, as Access will read this as a record with null values which may lead to error messages.

The procedure to import the data from a text file is the same as for a spreadsheet file described above, but in the Fi le Open dialog it is important to select a suitable Fi le Type .

If the imported data is to be appended to an existing Access table, then column headings in the source file must match field names in the destination table.

2.1.5 Importing Other File Types Access is able to import a range of other widely-used file types into tables. The

Import group and offer some options, including various versions of dBASE and Paradox.

Page 14: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 8

Figure 9 File Types That May Be Imported

Exercise 2: Importing table data Now look at this exercise (page 54).

2.2 Using the Imported Data Now the new table appears in the Tables list of the Navigation Pane. It can be edited and manipulated just like any other Access table. Note that if you imported it, you have created a copy of the data from the Excel or other source file. Editing this table or its data contents will not affect the original data in the Excel file.

A precaution is to open the imported table in Design View and check that suitable data types have been assigned to each field.

The imported table should then be included in the relationships diagram along with the existing tables, setting up relationships between its fields and those of other tables. However note that referential data integrity cannot be enforced when one table is external.

If data has previously been collected in a flat file, perhaps as a pilot study in a spreadsheet, it needs to be re-organised into the separate tables of a relational database. Follow the steps discussed in the course “Databases: Concepts of database design” to plan out how the data should be broken up into tables with one-to-many relationships between them.

The next step is to import the whole block of data into one new table in the database, with a name such as tblRawData . The various action queries described in the course “Databases: Querying and analysing data” can then be used to transfer portions of the raw data into the appropriate new tables, using suitable primary keys for joining.

Page 15: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

9 IT Learning Programme

2.3 Linking Data Data may be assembled in an external file, such as an Excel workbook that has been saved elsewhere with a known filename and location. A link makes the data in an external location available to an Access database, without making a copy.

The data is still located in the external file, and changes made to the data using the external software will be seen when the data is viewed using Access.

Note that with some but not all file types, the link is two-way so that changes can be made at either end of the link, and will appear at the other end. However if an Excel file is linked, changes are one-way only: the data can be edited in Excel, and changes are then seen in Access – but not vice versa (read the text of the wizard carefully).

A linked table should then be included in the relationships diagram, and relationships should be set up between its fields and those of other tables. However note that referential data integrity cannot be enforced when one table is external.

2.3.1 The Link Data Wizard Linking is an option offered in the first part of Get External Data , started using

for example.

Figure 10 Linking to External Data

The steps of the wizard are the same as for importing (described earlier).

Finally, the linked table must be given a name. Although the data itself is not held inside the Access database file, this table-placeholder name should still conform to the usual naming conventions (see Part 2.1.2 above).

The linked table appears in the list of tables in the Navigation Pane, with a special icon.

Page 16: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 10

Figure 11 Tables with a Linked Excel Table

2.3.2 Linking Data From Another Access Database File A link may be set up between an Access database and a single table in another

Access database, using . In this case, you browse to the required database file, and you select one or more tables from the list available.

Figure 12 Linking Tables From An External Database

The linked tables appear in the Navigation Pane, with a special icon

. The table can be edited from within this database. Changing data values here will affect the underlying data that is stored in the source file.

Exercise 3: Linking external table data You may look at this optional exercise (page 56).

Page 17: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

11 IT Learning Programme

2.4 Exporting Data Data from an Access table or query can be exported, creating a separate file.

2.4.1 Exporting a Table To a Spreadsheet Access can readily send data between a table (or query) and an Excel workbook.

In the Navigation Pane, the selected table must first be selected, then in the Export group will display the Export Spreadsheet dialog. Here you specify where the new file is to be saved (location and file name).

A new Excel workbook is then created. It contains all the fields and all the records of the selected table.

Note that the new Excel file is a copy of the data from the Access table – editing one copy will not affect the other because they do not continue to be linked.

The same steps can be used to export the result of a query to a spreadsheet.

2.4.2 Exporting Data To Word For Mail Merge A collection of data in an Access table can be exported to provide the data source for a mail merge. Mail merging is a word-processor activity where a single document such as a letter or email is compiled, and then many copies are generated using varying data such as a list of people’s names and addresses.

With the desired table selected in Access’ Navigation Pane, will start the Word Mail Merge Wizard . Following the series of steps, you specify the main document such as letter text, or create a fresh one. In the Write your letter

step, click to see the list of fields in the exported table, and place field codes in the text. When the mail merge is performed, a set of similar letters is assembled, addressed to each of the records given in the data from Access.

Further IT Learning Programme courses and study material are available for word-processing techniques including mail merge (see Part 10 below).

2.4.3 Exporting to Other File Types

The Export group of the External Data ribbon tab, including , offers a wide range of file types that can be created.

Figure 13 File Types for Exporting a Table

Page 18: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 12

Exercise 4: Exporting table data Now look at this exercise (page 57).

2.5 Archiving Bear in mind that Access does not keep a rolling archive of your data: once a value has been edited, only the new value (text, numbers, etc.) is stored.

If it is important to keep a record of past data values, you will need a procedure for backing up or archiving the data.

The simplest method is to make repeat copies of the whole Access database: the .accdb file. This will keep copies of all your data in tables, however it also includes copies of all your queries, forms, reports and macros, which may not be necessary.

Read more about backing up your data in the IT Services advice pages: http://help.it.ox.ac.uk/hfs/index .

It may be sufficient to take backup copies of all the tables, or of selected tables whose data changes frequently. For example, make copies using Copy/Paste of all the tables, at planned intervals such as the end of each week or the start of each academic year. Alternatively, the Export command may be suitable (see 2.4 above).

If data in several tables is to be archived frequently, it may be worth creating a macro that uses the ExportWithFormatt ing macro command to export each of the necessary tables to an external file. Read about creating macros and assigning them to buttons in the ITLP course “Databases: User-friendly databases using Access” (see part 10.2 below).

A useful habit is to follow a naming convention, such as including the date in the name of each newly copied table: tb lPeople could be saved as 2014-06-10 tblPeople .

Page 19: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

13 IT Learning Programme

3 Creating a Report using the Wizard A report is a 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 14 The Navigation Pane Listing Reports

3.1 Using the Wizard to Create a Report Based on a Table

on the Create tab of the ribbon will start the wizard.

Page 20: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 14

Figure 15 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.

Figure 16 Report Wizard, Grouping Levels

3.2 Saving and Naming the Report In the last part of the wizard, give the report a suitable name – remember the convention that report names begin with rpt , even if the Access wizard’s suggestion does not conform to this.

Page 21: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

15 IT Learning Programme

Figure 17 Report Wizard, Setting a Report Name

Save the report frequently while designing, giving it a suitable name using the Reddick naming conventions outlined 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 reports, 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 tb lStudentAppl icat ions or qryLateReplies , or rptSimple_Address_List .

3.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.

Once the query has been created, which includes the required tables and shows all of the required fields and records, then the same wizard can be used to create a report based on the query.

Depending on the data used in the query, you may be offered Grouping options: try them out to see which will give a suitable presentation.

Page 22: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 16

Figure 18 Report Wizard Based on a Two-Table Query

3.4 Using the Report

Figure 19 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.

Page 23: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

17 IT Learning Programme

3.5 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 5: Creating a report using the wizard Now look at this exercise (page 59).

3.6 Mailing Labels (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.

Figure 20 Assembling Fields Onto a Label

Page 24: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 18

Figure 21 Preview of a Labels Report

Exercise 6: Creating mailing labels using the wizard Now look at this optional exercise (page 60).

Page 25: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

19 IT Learning Programme

4 Building a Report From Blank A report collects selected data from the database, and is generally designed with the intention of printing out on paper (in contrast with a form, which is typically used to display or edit live data on the computer screen; that is covered in the course “Databases: User-friendly databases”, see part 10.3).

Although the Report Wizard is a quick way to create a report, it does not offer flexibility of design or layout. Working in Design View, you can create a report starting with a blank.

4.1 Creating a Report in Design View The Navigation Pane shows the list of reports already saved.

Clicking , on the Create tab of the ribbon, creates a new report in Design View. Initially, the report is not bound to any table or data.

The new blank report is shown in Design View.

Figure 22 A New Report in Design View

4.2 Showing and Hiding Tools and Sections

If the Field List is not yet showing, will display it.

As in Form Design View (which you may recall from another IT Learning Programme course), some useful features can be shown or hidden as preferred, using tools in the Arrange tab.

Page 26: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 20

The menu includes options to display useful rulers and gridlines

. The design gridlines will not appear when the finished report is used.

A report is often divided into sections, as shown in Figure 24: the Detai l is the middle part, whose contents may change from one record to the next. The Page Header appears at the top of each page when the report is printed, and the Page Footer appears at the bottom of each page.

If a Report Header and Footer are also required, the command is found on the context menu if you right-click on the report. The Report Header/Footer displays a header at the beginning of the first page, and a footer at the bottom of the last page.

The size of the sections can be adjusted independently by dragging the right-hand edge and bottom edge, or by dragging the grey divider bars.

4.3 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. This view displays the whole set of data as if it were all on one page; the report itself cannot be altered here.

Print Preview is used to view the report as it will be printed (with pagination). Use toolbar buttons as necessary to change the zoom display. Nothing can be edited here.

Layout View allows you to rearrange and change the appearance of the report. Sample data is visible but is not editable. This is a good choice for working on the visual appeal and effectiveness of a report.

Design View allows the most detailed design changes. No data is displayed. This view is good for making detailed choices and settings.

is used to switch between Design View, Layout View and Report View, as well as Print Preview. It is usual to switch frequently between views, while the design is evolving. Note: Many of the activities discussed in this course can be carried out equally in Layout View or Design View, and we will do some work in each.

Page 27: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

21 IT Learning Programme

Figure 23 Switching Between Views of a Report

4.4 Creating a Report in Layout View A blank report can also be created in Layout View.

Clicking , on the Create tab of the ribbon, creates a new report in Layout View. Initially, the report is not bound to any table or data.

The new blank report is shown in Layout View. Here the header, footer and detail sections are simply shown in their positions on the report.

Figure 24 A New Report in Layout View

Page 28: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 22

5 Controls on a Report Controls can be added to any appropriate part of a report, using the same procedure that we saw with forms, above.

5.1 Adding Title Objects In The Header or Footer

Figure 25 Buttons For Adding Objects in the Header or Footer

The Page Numbers button on the Design tab adds a control in the Page Header, which shows the page number on each printed page. If preferred, this can be dragged into the Footer.

The other buttons in this group add objects into the Report Header and Footer, so this extra header and footer appear when you choose one of those.

Exercise 7: Creating a report with headers and footers Now look at this exercise (page 61).

5.2 Adding a Text Box (bound to a field)

If the Field List is not yet showing, will display it. Initially, all available tables and their fields are shown in the Field List (Figure 24).

A field control is created on the report by dragging a single field name from the Field List and dropping it in the Detail area of the report design. The new control is then bound to the field you chose. When the first field is added to a new report, that field’s table becomes the record source for the report.

Further fields from the same table are then displayed prominently in the Field List, and other available fields are listed below.

Page 29: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

23 IT Learning Programme

Figure 26 Report Design After the First Field Control Has Been Added

When the finished report is run by the user (Report View or Print Preview), the value of this field for the current record will be displayed here.

Each field control usually has a label associated with it, which will appear on the finished report.

5.3 Adding Several Field Controls Together Several field names can be selected at once, then dragged together onto the design grid to create several field controls.

You can select several contiguous field names in the Field List by clicking one field name, then holding SHIFT while clicking a later field name.

Alternatively, select several separate field names in the Field List by clicking one field name, then holding CTRL while clicking other field names.

Page 30: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 24

Figure 27 Adding Several Field Controls to a Report

5.4 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, but some controls are so obvious that they don’t need a label.

Labels may be put in the header of a report, where they act as banners across the top 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.

5.5 Editing a Label The label text for column headings or the report title can be edited directly 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 its new contents.

If you want to completely remove a label from the report, click the label once to select it and then press DELETE.

5.6 Adding a Label A label is a piece of text which is fixed, not varying from one record to the next. This may be used for decoration or for adding explanation to a report.

A new label is added by clicking on the Design tab, then clicking at a suitable position on the report. The flashing insertion point, similar to that seen in

Page 31: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

25 IT Learning Programme

word-processing, appears ready for you to type text as required. Press ENTER when finished typing.

A label can be added in any section: Detail, Header or Footer.

Figure 28 Adding a Label to a Report

5.7 Adding a Chart on a Report Typically, a chart is inserted in a report as a way of summarising data from many

records. on the Design tab starts the Chart Wizard. This wizard leads through the steps of choosing data, chart type and layout options.

5.8 SubReports If there is a one-to-many relationship between two tables in a database, it may be useful to display the data using a main report with a smaller subreport. The subreport shows only those records which relate to the subject of the main report.

For example, in a personal address list, the main report may show the households one at a time, with their shared address, and the subreport may appear as a box listing all the people in the given household, each with their own birthday.

The procedure for this is much the same as was discussed for subforms in an earlier course on building user-friendly databases (see part 10.2 below).

5.9 Reports in a User-Friendly Navigation Form It is useful to collect several frequently-used forms and reports together, and provide a user-friendly interface that guides the user to the places to work. A previous course discussed creating a navigation form (see part 10.2 below). Working in Layout View, a report name can be dragged onto a navigation form. The buttons can be re-ordered as convenient.

Page 32: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 26

Exercise 8: Adding text box controls and labels Now look at this exercise (page 63).

Page 33: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

27 IT Learning Programme

6 Adjusting Report Controls

6.1 Selecting a Control on a Report Once a control is selected, it can be moved, adjusted or have its properties altered. Controls can be selected in the same way as when working in a form – an orange border and/or corner handles indicate which object is currently selected.

Dragging different parts of a control will give different effects:

Similarly, the label itself can be selected separately, then resized, moved or edited as needed.

6.2 Resizing a Control As the mouse pointer moves over an orange handle or the edge of a selected object, the pointer changes into a two-headed arrow. Drag with this arrow to re-size the object.

6.3 Moving a Control Controls can be moved around in a report by dragging: move the mouse pointer until it changes into a four-headed arrow, then drag the control to another position.

When a field control is moved in Design View, its associated label moves with it. However if you drag the bigger grey handle at top left of the field data control, this moves the box but not its associated label.

6.4 Arranging Multiple Controls Hold CTRL while clicking several separate objects, to select them all at once. Then they can all be moved or resized as a set. When you click away from these objects, they are immediately un-selected.

Objects on a report have a stacking order: Access keeps track of which one lies in front of which. If you drag them together they will appear to be overlapping. Tools to manage the alignment and stacking order are on the Arrange tab (Design View only, active when multiple objects are selected):

Figure 29 Tools For Arranging Multiple Objects

Page 34: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 28

6.5 Deleting a Control A control may be easily deleted from a report, by selecting it then pressing DELETE. Note that this removes the bound control from the report, but does not affect the fields and data stored in the table.

If a bound field control is selected and deleted, then its associated label is also deleted. If just the label is selected, it is then deleted while leaving the field control intact.

6.6 Other Kinds of Control The Controls Gallery on the Design tab offers other kinds of control which may

make the report more interesting. For example a chart or an image .

Exercise 9: Rearranging controls in a report Now look at this exercise (page 64).

Page 35: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

29 IT Learning Programme

7 Formats and Properties in a Report Objects in a report – bound controls, labels etc – and the report itself all have properties which may be changed.

7.1 Themes on a Report You can easily change the whole look of a report (fonts, colours, borders, etc.) by

changing the theme: is on the Design tab. Selecting one of the options from the Themes Gallery will re-format many of the elements on the report. Note that changing the theme does not over-ride any direct formatting that has been applied to individual parts of a report, so some reports that have had a lot of work done, making small changes and re-formats, will not show much change.

7.2 Formatting a Label or Control Using Buttons The Format tab gives you control over the appearance of a selected report element.

Using the buttons on the Format tab, you can change the font name, size, style (bold, italic, underline), alignment (left, centre, right), text colour and background colour of the selected label(s).

Figure 30 Formatting the Appearance of a Label or Control

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 31 Options for Number and Date Format

Exercise 10: Control and report properties using buttons Now look at this exercise (page 66).

7.3 Property Sheet for Individual Controls Many more formats and settings are available on the Property Sheet, for making further changes to the behaviour or appearance of parts of a report. These are

found on the Property Sheet, displayed using on the Design tab of the ribbon.

Page 36: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 30

Once an object is selected, its properties are listed in the Property Sheet and the selected object is named at the top of the sheet. The same control has a drop-down list that can be used so as to select another specific object on the report (some objects are rather difficult to select by clicking).

Select a control or section of the report, to see its properties listed in the Property Sheet. These properties can be changed independently.

Figure 32 Properties of a Text Box Control

The Property Sheet is divided into tabs. Some of the properties on the Format 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 Format properties include:

Visib le 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 ink the control or section shrinks vertically to remove all spare lines when its data is displayed

Further properties are shown in the Data and Other tabs (there are no events associated with individual controls in a report, because a report is intended to be printed on paper rather than operated on a screen).

7.4 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).

Page 37: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

31 IT Learning Programme

7.5 Properties of a Section or the Whole Report Parts of the report, such as the Detail section, Headers or Footers or the report itself, also have properties which can give some interesting behaviours.

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, is to choose using the drop-down list at the top of the Property Sheet.

Format properties of a section include Force New Page: set this to After 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 ter and/or Sort order for a report.

A useful property of the report is the Capt ion , 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).

7.6 Changing the Record Source of a Report – Including 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 in the Record Source property.

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.

Page 38: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 32

Figure 33 Changing the Record Source of a Report

Exercise 11: More properties of controls and reports Now look at this exercise (page 67).

Page 39: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

33 IT Learning Programme

8 Working With Controls in a Layout A collection of controls in a form or report may be organised into a predefined grid-like structure called a layout. The objects in a layout are treated as a set and moved, resized or formatted in concert.

Once a part of the layout is selected, any formatting changes are applied to all of the related controls.

Both forms and reports can contain layouts. We will cover it here with reports, but you can apply the same approach when working on forms.

Layout View is the most convenient way to work on a layout (although it is possible to do much of this work in Design View).

8.1 Creating a Layout For a regular, neatly-aligned look, objects on a form or report can be organised into a layout , by selecting several relevant controls and their labels, and then

choosing or on the Arrange tab.

Figure 34 A Report with a “Tabular” Layout

Figure 35 A Report with a “Stacked” Layout

Page 40: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 34

8.2 Adding and Removing Field Controls in a Layout Further field controls can be added to the layout by dragging from the Field List

using . A field control can be deleted from the layout by selecting it and pressing DELETE (note that this does not affect the field and data stored in the table, it merely removes the control from the report).

It is possible to have several layouts on the same form or report.

8.3 Layouts May Be Set Up Automatically Controls on a form or report may have been placed automatically into a layout. You may have encountered layouts unexpectedly, in forms or reports that had been

created using or . When working in Layout View, if new field controls are

added using , they may be organised automatically into a layout.

8.4 Arranging and Aligning Objects in a Layout If a group of controls are in a layout, then when any one control is selected a handle with a four-headed arrow appears at the top left of the layout.

Buttons for rearranging and moving items in a layout then become active on the Arrange tab.

Figure 36 Buttons for Working in a Layout

8.5 Moving and Resizing Controls in a Layout 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 .

Clicking in the left or right margin of the report selects an individual record.

In Layout View, when you select (by clicking) a control or label that is in a layout, you will notice that an orange border appears around the object, and a lighter orange border appears around all other related objects (for instance, other controls which display data from the same field but a different record). Any changes made now will affect all of the controls with the light orange outline.

Page 41: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

35 IT Learning Programme

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

Dragging an individual item within the layout moves it to a different position, while maintaining the even spacing of the controls. 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 upwards or downwards changes the spacing between the rows in the report.

You can also drag the edge of a control to resize all of the selected textboxes. Resizing one item within a layout will resize all corresponding members of the layout by the same amount.

Figure 38 Selecting a Record

8.6 Arranging a Layout

and are useful for changing the spacing around or between the items in a layout.

The whole layout can be moved, with its contents, by dragging the handle .

Page 42: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 36

8.7 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 anywhere inside the layout and then click on the handle ( at top left) to select the entire layout.

Clicking displays gridlines between each row, each column, or both.

Figure 39 Options for Gridlines in a Layout Table

8.8 Removing a Layout If you prefer to manage each of the controls on a form or report independently, the layout can be removed, when working in Design View. With the existing

layout selected (by carefully clicking the handle ), will separate the controls on the form or report.

Exercise 12: Working with a layout in a report Now look at this exercise (page 69).

Exercise 13: Working with a layout on a form (Optional) Now look at this exercise (page 71).

Page 43: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

37 IT Learning Programme

9 Overall Design of a Report 9.1 Orientation

The orientation of the report may have been set when it was created, if the Report

Wizard was used. If it needs to be changed, buttons to present a report or

are found on the Page Setup tab. Note that if the orientation of the report is changed, it is likely that many of the controls will need to be rearranged individually, so that they fit neatly on the new page layout: this is not automatic.

9.2 Page Setup

The Page Setup dialog offers a range of choices for printing, margins, paper size and columns.

Figure 40 The Page Setup Dialog

9.3 Information in the Header or Footer If you need to add (or change the format of) page numbers for a printed report,

insert page numbers using on the Design tab.

Page 44: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 38

Figure 41 Inserting/Formatting Page Numbers

The filename and path can be included in the footer (or header) by inserting an unbound control and typing this Control Source: =CurrentProject.Fullname

It may also be useful to show the report name in the footer (or header), using the Control Source =NAME. NAME is a reserved word which Access considers as the name of the current report (this is why you cannot use this word as the name of a field).

Exercise 14: Overall design of a report (optional) Now look at this optional exercise (page 73).

9.4 Sorting in a New Report Using the Wizard Typically a report includes data from a number of records. It may be necessary to control the order in which the records are presented. For any given report, you can specify a combination of sorting and grouping the records.

The easiest way to set up sorting is to set the sort order when creating a new report in the wizard.

Page 45: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

39 IT Learning Programme

Figure 42 Setting the Sort Order in the Report Wizard

You select a field name, by which the records are to be ordered, and click the Ascending button to toggle between ascending or descending order.

If there are likely to be a number of records with the same value in this field, you may select another field for a secondary sort.

When the report is run, the records are presented in the order specified.

Figure 43 Report with Records Sorted by Surname

9.5 Sorting In an Existing Report If no sort order has been set when a report was created, the Group, Sort and Total pane can be used to control the sort order.

In Design View, clicking on the Design tab will display this pane. After

clicking , you can specify a field for sorting, and choose the sort

Page 46: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 40

direction. Secondary and further sorts can be added, if likely to be needed to resolve a “tie”.

This sort order will be applied next time the report is run.

Figure 44 The Group, Sort and Total Pane

9.6 Grouping in a New Report Using the Wizard In a report, a number of records may share the same value for one field. It may be convenient to show all these records grouped together, and to show the shared value once as a sub-heading. For example, pupils in a class might be grouped by month of birth, with sub-headings such as “January” above each group.

The easiest way to set up grouping is to choose this in the wizard when creating a new report.

Figure 45 Setting a Grouping Level in the Report Wizard

When the report is run, records are grouped together using their values in the chosen field.

Page 47: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

41 IT Learning Programme

Figure 46 A Grouped Report

9.7 Grouping In An Existing Report If grouping has not already been set up in a report, this can be set in the Group, Sort and Total pane.

In Design View, clicking displays this pane. Here you can click and select a field name from the drop-down list. This causes a Header section to appear above the Detail in the Report Design, and a Footer section to appear below the Detail. The new header and footer are named after the field they group on.

Figure 47 Grouping Records in Design View

Page 48: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 42

If there are several levels of grouping or sorting, they appear as nested pairs of headers and footers. These can be re-ordered using the arrow buttons at the right-hand end of the Group, Sort and Total pane.

Typically, you would now move the control for the grouping field into its own Group Header. You may wish to draw a dividing line or add some shading in the Group Footer, or just allow some space to separate the groups of records.

When the report is run, records which share the same value in the chosen field are grouped together, and the value appears as a sub-heading.

Figure 48 A Grouped Report

9.8 Keep Together Property In a long report, it may be useful to keep all the records of a group together on one page. This may mean some records being moved onwards to the next page, in order to keep them together.

Page 49: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

43 IT Learning Programme

This and other useful variations are found by clicking in the Group, Sort and Total pane.

Figure 49 More Options for Grouping and Sorting

9.9 Note: Grouping A Report Based On A Many-To-Many Relationship (Optional)

A many-to-many relationship may be modelled in Access using two one-to-many relationships, with a “mixing table” at the centre. This type of relationship is discussed further in the course Databases: Concepts of database design (see Part 10.1).

Presenting such data in a report requires careful grouping to make the information easy to understand. For example, many households have a number of telephones, a collection of landlines, mobile phones, fax numbers and also work numbers which should be included in a database. Thus a number of family members in one household, with between them several phone numbers to be recorded, make a many-to-many relationship. This could be modelled using three tables thus:

Figure 50 A Many-To-Many Relationship

Creating a report based on this data, via a query, offers two ways (at least) of grouping the data. Either group by Person , so all the phone numbers where a particular person may be reached are grouped together, or group by Phone , so all the people who use a particular phone number are grouped together. Either of these can be done using the report wizard, and either one could be useful, but you must choose one layout or the other when creating the report.

Aside: an alternative approach to analysing data with a many-to-many relationship is to create a cross-tab query. This is discussed in another IT Learning Programme course (see Part 10.3).

Page 50: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 44

Figure 51 Phone Numbers Grouped By People’s Surnames

Figure 52 People Grouped by Phone Number

Exercise 15: Sorting and grouping records in a report Now look at this exercise (page 74).

9.10 Summary Calculations on a Report The easiest way to include an “overview” or summary calculation on a report is to choose it while creating the report in the wizard.

Page 51: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

45 IT Learning Programme

The wizard that creates a new report is started by using . If the data

chosen is grouped (using the option provided in the wizard) then appears below the sort options. Popular functions are offered for any fields that have numerical data: Sum, Average, Minimum and Maximum.

Figure 53 Summary Value Options in the Report Wizard

A later course will discuss how to add calculated controls to an existing report (see part 10.3 below).

Page 52: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 46

10 What Next? Now that you have some useful Access skills you may want to develop them further. IT Learning Programme offers a range of resources for study and teaching.

10.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.

It may be possible for you to use the facilities at IT Services to work through the exercises in this booklet, or use any of the applications that are available. Contact us on [email protected] for details.

10.2 Database Courses Which Precede This Databases: Concepts of database design

Databases: Building a database using Access

Databases: User-friendly databases using Access

10.3 Database Courses Which May Follow This Databases: Querying and analysing data using Access

Read about the content of these courses in the IT Learning Programme Catalogue at www.it.ox.ac.uk/itlp/courses/catalogue

10.4 Course Clinics We encourage everyone to work at their own pace. This may mean that you don’t 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 Course Clinics that run during term time. More details are available from www.it.ox.ac.uk/courses/

10.5 IT Services Help Centre 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 [email protected].

Page 53: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

47 IT Learning Programme

Appendix 1: Viruses and Security Levels in Access

1. 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.

2. Scanning for Viruses

2.1. 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 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.

2.2. 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.

3. Access 20131 and Virus Security Access 2013 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 Help .

3.1. Security Warning Message When you open a database file using Access 2013, a Security Warning message may appear in a white/yellow bar near the top of the window.

1 Access 2007 and 2010 handle viruses in a similar way to Access 2013

Page 54: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 48

Figure 54 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.

3.2. Enabling Automatic Content For Just One Visit Enable Content 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 Enable th is content 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.

3.3. Trusted Locations in Access 2013 Some locations (folders, drives or devices) can be nominated as Trusted Locat ions : 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 our 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. Computers at IT Services have Sophos virus protection software which is kept up-to-date. If you are in an IT 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.

3.4. When to Trust a Location for Access 2013 You should only consider doing this if you do need to use automatic content such as macros, and if you have made very good arrangements to protect the computer from virus attack.

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

Page 55: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

49 IT Learning Programme

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.

3.5. Finding the Access Trust Center You may decide to set Access to Trust a folder or computer storage area. This is done in the Trust Center , which is among the Access Opt ions (found on the Fi le menu) .

In the left-hand column of the Access Opt ions dialog, choose the Trust Center category. This reveals the button on the right.

Figure 55 The Trust Center With the Trust Center Settings Button

Page 56: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 50

3.6. How to Trust a Specific Location with Access 2013

Figure 56 The List of Trusted Locations

Trusted Locat ions (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 Allow Trusted Locat ions on my network in the same dialog. You should consult the IT support contact who is responsible for the network, before doing this.

You may also decide to trust subfolders within the chosen location – there is a check box for this in the Trusted Locat ion dialog.

Figure 57 Trusting Subfolders in a Trusted Location

Page 57: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

51 IT Learning Programme

Once a folder has been Trusted, save all database .accdb files there.

3.7. Sandbox Mode Note that these choices make 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, don’t experiment: ask someone who has experience, as there is a risk of making the computer unusable).

4. 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.

Page 58: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 52

Appendix 2: Student Exercises Exercise 1 Opening a database file

Start Access

Open an existing database file

Examine the structure of the database

View the list of tables, reports etc

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

Task 1 Start Access from the Start menu

Step 1 Start the computer if necessary

Step 2

Click the Start button on the Task Bar at the bottom of the screen

In the Start menu, explore the folders and look for the Microsoft Off ice 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 may start the program using an Access icon on the Desktop)

Task 2 Access 2013 can also be used to create an app database : where users work on the data via a web browser. This would require communication using Office 365 or SharePoint 2013, and is not the subject of this course. We will work on a desktop database , which is saved locally on your computer or a network drive.

Task 3

Open Teaching Resources2.accdb

It has been placed in your network drive H:\ (or in another place as directed by your teacher)

Step 1 Choose Fi le| Open

Step 2 Browse to the network drive called dr ive 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

Page 59: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

53 IT Learning Programme

Step 3 Locate the file called Teaching Resources2.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

Task 4 Look at the relationships diagram to see the tables in this database

In this database, a group of teachers are managing the teaching resources they create and share – the table of resources has not been created yet, so there are no joins

When ready, close the Relationships diagram

Task 5 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 Object Type (under Navigate To Category)

Step 2

Select again and choose All Access Objects (under Fi l ter By Group)

Task 6 Look at the list of tables, reports and other objects in the Navigation Pane

Step 1 Notice that the names of tables and other objects including reports that have already been created are listed in the Navigation Pane

Step 2 Data is stored in the tables

Step 3 Reports will be used for presenting selected data, arranged in an understandable way

Task 7

Close all reports, leaving the Navigation Pane and Teaching Resources2.accdb still open

Page 60: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 54

Exercise 2 Importing table data

Import a new table from an Excel worksheet, using the wizard

Import a table from a csv file, appending to an existing table

Import data from a Word file

Task 1 Import the table of teaching resources that has been set up in the Excel file ResourcesTable.xlsx

Use this data to create a new Access table called tb lResources

Step 1 Continue work in the database file Teaching Resources2.accdb

Step 2

In the External Data tab of the ribbon, click in the Import group, to start the Import Data Wizard

Step 3

Click

In the Fi le Open dialog, ensure that Fi les of Type is set to Microsoft Excel

Locate the Excel file ResourcesTable.x lsx

Step 4 Choose to Import the source data into a new table

Step 5 In the wizard, make these choices:

choose the worksheet called tb lResources

confirm that the first row contains column headings

look briefly at the columns of data (no changes here)

let Access add a primary key field

name the new table tb lResources

Step 6 When the wizard closes, the new table now appears in the Navigation Pane

Task 2 Inspect the table and some data

Close the table

Task 3 At this point, you would normally spend some time creating relationships between the new table and the existing tables

We will skip this step for now, but if you are not sure about setting up joins or relationships in a database refer to the course “Databases: Building a database using Access”. Either book a place on the taught course, see part 10.2 above, or download the course materials from the ITLP Portfolio, see part 10.1 above.

Page 61: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

55 IT Learning Programme

Task 4 Notice some of the other file types available in the Import group of the ribbon, for importing data into Access

Task 5 Collect some more authors from the file ExtraAuthors.txt and append them as extra records in tb lAuthor

Hint: make sure you confirm that the first row of the data contains Field Names

Step 1 In the External Data tab of the ribbon, click

in the Import group

Step 2

Click

In the Fi le Open dialog, set Choose Fi les of Type to be Text Files

Select ExtraAuthors. tx t and click

Step 3 Choose to Append a copy of the records and select tb lAuthor

Step 4 In the wizard, confirm that the data is delimited (separated) by commas

Confirm that the First row contains Field Names (** be sure to check this checkbox **)

Task 6 Inspect the table tb lAuthor and notice that 4 records have been appended

Close the table

Task 7 (optional) Collect some more keywords from the Word document Keywords for Teaching Resources.docx

Append these keywords to those already in tb lKeyword

Step 1

Start Word (from the Start menu ) and open the document Keywords for Teaching Resources.docx

Some more keywords are listed here

Step 2 Note: You need to convert the Word document to a .tx t file before importing to Access

Use Word’s Save As dialog (found on the Fi le menu) to save the document as a plain text file, called Keywords for Teaching Resources.tx t

In the Fi le Convers ion dialog, accept any suggested settings

Step 3 Close Word

Step 4

Choose in the External Data tab of the ribbon

Page 62: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 56

Step 5 Select tb lKeywords

Browse to Keywords for Teaching Resources.tx t (you may need to set the Files of Type)

Step 6 Choose to Append a copy of the records

Step 7 Agree to store the data in the existing table tb lKeywords

Step 8 Accept that the data is delimited (the choice of delimiter character does not matter because this table only has one column/field)

The first row does contain field names

Complete the wizard

Task 8 Look at the new records which have been appended to tb lKeyword

Close all tables

Exercise 3 Linking external table data (Optional)

Make a link to a table in another Access database

See the linked table in the Tables list

Change a data value

See the change has taken place in the other database file

Task 1 Set up a link to another Access database file called Extra Resource Data.accdb

Link to the table tb lType

Step 1 Continue work in the database file Teaching Resources2.accdb

Step 2

Click in the Import group of the External Data tab

Step 3 Find and select Extra Resource Data.accdb

Choose to Link to the data source

Step 4 The Link Tables dialog shows the tables available in this database file

Choose tb lType and link to it

Page 63: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

57 IT Learning Programme

Step 5 The linked table tb lType appears in the Navigation Pane, with a special arrow icon

Task 2 Open the linked table tb lType and add another record for Dreamweaver

Step 1 Select tb lType in the Navigation Pane and open the table

Step 2 Add another record to the table, with the single field entry Dreamweaver

Step 3 Close the table and close the Access file

Task 3 Close this file and open Extra Resource Data.accdb

Confirm that the data in this external file has been changed

Step 1 Open the Access file Extra Resource Data.accdb (use the File menu)

Step 2 Open the source copy of tb lType

Notice that the extra record has been added (this list is sorted alphabetically, so look carefully for the additional record)

Task 4 Close all records

Exercise 4 Exporting table data

Export a table to an Excel workbook, then look at the table in Excel

Export a table to a Word document, then look at the data in Word

Task 1

Continue work in the database file Teaching Resources2.accdb

Task 2 Export the table tb lSubject to create a new Excel workbook

Step 1 Select tb lSubject in the Navigation Pane

Step 2

Click in the Export group of the External Data tab

Step 3 Click Browse

In the Fi le Save dialog, ensure that the file will be sent to your network drive H:\

Page 64: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 58

Step 4 Give the filename Subjects

Set the File format to Excel (* .x lsx)

Click Save

Step 5 Leave the Export data wi th formatt ing checkbox clear

Complete the wizard

Task 3

Start Excel from the Start menu and open the new workbook file Subjects.xlsx - confirm that it now contains the same data as in the Access table

Task 4 Export the table tb lAuthor to create a new Word (.r t f) file

Step 1

Select tb lAuthor and click

(you may need to look for this in the menu)

Step 2

In specifying the destination, use to show the Fi le Save dialog

Step 3 Give the filename Export ing Authors.r t f

Set Save as type to Rich Text Format (*.rtf)

Set the network drive H:\

Click Save

Step 4 Complete the wizard

Task 5 Start Word from the Start menu and open the new txt file, to inspect the data

Step 1 Start Word

Open the new file Export ing Authors.r t f (in the Open dialog, set Fi les of Type to All Files)

Step 2 Look at the data that has been exported

Task 6 Close Excel and Word

Close Teaching Resources2.accdb but leave Access open

Page 65: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

59 IT Learning Programme

Exercise 5 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

Open the database Inventory Toy Library2.accdb

Look at the relationships diagram to see the tables and joins in this database

In this database, a group of volunteers are looking after a collection of toys, which may be borrowed by member families

When ready, close the relationships diagram

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 Create tab of the ribbon to start the wizard

Step 2 In the wizard, choose the table called tb lMemberFamil ies

Step 3 Choose these fields:

LastName, OtherLastName

Address1, Address2, Address3

PostCode

TelNum

Step 4 Do not add any grouping levels

Set a sort order based on LastName , Ascending

Step 5 In the Layouts, choose Columnar

Task 3 Name the report rptFamilyAddresses

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 rptFami lyAddresses

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

Page 66: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 60

Task 4 Use the wizard again to create a new report

List all the toys that each family has borrowed

Base this report on qryToysHeldByEach FamilyNow

Step 1

Click on the Create tab of the ribbon to start the wizard

Step 2 In the wizard, choose the query called qryToysHeldByEachFamilyNow

Step 3 Choose these fields:

LastName Address1 PostCode TelNum ToyMake ToyName NotesOnUse

Step 4 Choose to view the data by tb lMemberFamil ies

Do not add any grouping levels or sorting

Step 5 Choose a layout that seems suitable

Name the report rptToysHeld

Step 6 Examine the report, noticing how the information is presented

Close the report, leaving Inventory Toy Library2 open

Exercise 6 Creating mailing labels using the wizard (optional)

Use the wizard to set up mailing labels

Choose the fields required

Choose the appearance

Run the report and preview the data

Task 1

Continue work in the Inventory Toy Library2.accdb

Task 2 Start the Labels wizard, with tblMemberFamil ies

Step 1 In the Navigation pane, select tb lMemberFamil ies

No need to open the table now

Step 2

Choose on the Create tab

Page 67: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

61 IT Learning Programme

Task 3 Choose the standard labels to suit your supplies

Step 1 First choose Avery as the Manufacturer

Step 2 Then choose the Product number: C2244

Step 3 If no label is available to match your supplies, use

and enter the dimensions from your own sheets of labels

Task 4 Choose the text appearance

Task 5 Set up the fields wanted on the label

Step 1 On the Prototype label, choose the fields by selecting field names in the left list and clicking >

LastName

Address1

Address2

Address3

PostCode

Step 2 Press ENTER to move onto a new line in the label

Step 3 Type other characters as needed

Task 6 Finally, set a sort order if wanted, and give the report a name

Task 7 It is a good idea to preview the report before printing on real sheets of stickers

Exercise 7 Creating a report with headers and footers

Create a new report in Design View

Display the Page Header and Footer

Adjust the section sizes

Add a title

Task 1

Open Sales Invoices.accdb and look at the relationships diagram

Step 1 Close any database files that are open, using

on the Fi le menu

Step 2

Display the Open dialog e.g. using

Page 68: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 62

Step 3 Find and open Sales Invoices.accdb

Step 4

Click on the Database Tools tab, to display the relationships diagram

Step 5 Examine the tables and their fields, and the links between them

Close the diagram

Task 2 In this database, a department is keeping track of products that it has sold, with invoices and the individual items on each invoice

Look at the relationships diagram (found from the Database Tools tab) to see how the data is organised and related

Task 3 Create a new report in Design View

Step 1

In the Create tab click to create a new report in Design View

Step 2 A new report is shown, in Design View

Step 3

Click and on the menu (Arrange tab) if necessary, to show rulers and gridlines

Task 4 Ensure that the Page Header and Footer are displayed, but not the Report Header and Footer

Step 1 Read the grey divider lines, and identify the Detai l at the middle of the report

Step 2 Right-click the report and use the context menu to show the Page Header / Footer

Step 3 Do not show the Report Header / Footer at this stage

Task 5 Make the report wider, and the Detail section deeper

Step 1 Drag the right-hand edge of the Detail section, to make the report wider, up to about 15cm

Step 2 Drag the grey divider bar to make the Detail deeper, down to about 10cm

Task 6 Insert a title for the report

Step 1

Click on the Design tab

Page 69: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

63 IT Learning Programme

Step 2 Notice that new sections appear, for the Report Header and the Report Footer

A Title box is added in the Report Header

Step 3 Type Invoices for Regular Clients then click outside the title label when finished typing

Task 7 Save the report, naming it rpt InvoiceRegulars

(leave the report open for the next exercise)

Exercise 8 Adding text box controls and labels to a report

Add a bound text box control

Add several text box controls at once

Add a label and some graphic shapes

Edit label text

Compare the views of a report

Task 1

Continue work in Sales Invoices.accdb , in the report rpt InvoiceRegulars (created in the previous exercise)

Work in Design View

Task 2 Add a text box control, bound to the field Date in the table tb l Invoices

Step 1

If necessary, click to display the Field List

Drag this to a convenient position

Step 2 Drag the field name Date from the Field List (in the table tb l Invoices) onto the Detail section of the report

Step 3 Notice that a bound text box control is created and the report becomes bound to tb l Invoices

Task 3 Add a group of text box controls together, bound to the fields ClientName , SalesPersonName and Notes

Step 1 Click the field name ClientName , then hold SHIFT and click Notes , so that all three field names are selected

Step 2 Drag the 3 field names onto the report Detail

A set of controls is created

Step 3 Edit the label associated with the ClientName, to read Client’s full name

Page 70: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 64

Step 4 Improve the other labels if you wish

Task 4

For practice, add another label in the Detail

Add a rectangle using or a line using in the Footer

Task 5 Compare the different Views of the report

Step 1

Use on the Home tab to show the report in Layout View

Step 2 Be clear which boxes are displaying field data (bound to fields in the table) and which are just labels

Step 3 Look at the report in each view: Layout View, Design View, Report View and Print Preview

Step 4 Notice that the Report Layout Tools tabs appear on the ribbon

Step 5 Notice that in each view a (slightly) different collection of tools appears on the ribbon

Task 6 Close the report, saving it with the name rpt InvoiceRegulars

Exercise 9 Rearranging controls in a report

Resize a text box control in a report

Select a text box control and move it

Select an associated label and move it

Delete a control with its associated label

Run the report

Task 1 Open rptAl l Invoices in Design View

Step 1 Continue working in Sales Invoices.accdb

Step 2 Right-click rptAl l Invoices and choose Design View

Page 71: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

65 IT Learning Programme

Task 2 Make the text box ClientName a little shorter

Make the associated label in the Page Header shorter

Step 1 Click once on the ClientName text box (in the Detail section), to select it

Step 2 Drag a handle at the centre of one side, to make the control shorter by about 1cm

Step 3 Select the Client Name label (in the Page Header), to select it

Step 4 Drag a handle to make the label shorter, to match the text box

Task 3 Move the ClientName text box sideways

Move the label to match

Step 1 Select the ClientName text box

Drag the edge of the text box (mouse pointer is a 4-headed arrow) to move the box sideways by about ½cm

Step 2 Select the Client Name label

Drag the edge of the label to move the label sideways to match the text box

Task 4 Delete the InvoiceID control, and delete its label

Step 1 Click the InvoiceID control (in the Detail)

Press DELETE to delete the control

Step 2 Select the InvoiceID label (in the Page Header section) and press DELETE to delete the label

Task 5 Preview the report, then close it saving changes

Step 1

Use the View menu and to run the report and see a preview of the results

Notice the effect of the changes you have just made

Step 2 Close the report

When prompted, save the design changes

Page 72: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 66

Exercise 10 Control and report properties using buttons

Create a new report (using the report wizard)

Try some different themes

Change the font formatting of a control using buttons

Change the appearance of a control using buttons

Task 1 Create a new report based on tblInvoices , using the wizard

Step 1 Continue working in Sales Invoices.accdb

Close any tables, queries, forms, or reports that may be open

Step 2

Use to start the report wizard and create a new report

Step 3 Base the new report on tb l Invoices

Include all the fields

Choose any appearance that seems suitable to you

Step 4 Name the new report rpt InvoicesColours

The new report shows all the fields and all the records, with a rather plain theme

Task 2 Use the Theme Gallery to change the formatting

Step 1 View the report in Design View

Step 2

Click on the Design tab, to display a gallery of alternative themes

Select any one of the themes

Step 3 Notice how the font, colours, and borders of the whole report are affected

Task 3 In Design View, use buttons to change the font or font formatting for some text boxes

Step 1 View the report in Design View

Select the ClientName text box (in the Detail section)

Use on the Format tab, to set a different font such as Tahoma

Step 2

Select the SalesPersonName text box. Use to make this bold

Use other font formatting buttons to change the appearance of text on the report

Page 73: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

67 IT Learning Programme

Task 4 Centre the Date label

Change the text colours and fill colours for some text boxes

Step 1 Select the Date label (in the Page Header)

Click to centre the text in its box

Step 2

Select a label in the Page Header and use to choose a text colour

Do this for each label, choosing different colours

Step 3 Select the Notes text box

Use to set a pale blue fill

Task 5 Preview the report

Save the report as rpt InvoicesColours

Step 1

Click to run the report and preview the results

Step 2 Choose Save As on the File menu, and save the report with the name rpt InvoicesColours

Step 3 Leave the report open for the next exercise

Exercise 11 More properties of controls and reports

Change the fill colour of the report or the separate sections

Use the Property Sheet to view the properties of a control

Change the properties of controls using the Property Sheet

Change the properties of a section using the Property Sheet

Task 1 Continue work on rptInvoicesColours or rptAl l Invoices in Design View

Step 1 Continue working in Sales Invoices.accdb

Continue with rpt InvoicesColours (from the previous exercise) or open rptAl l Invoices

Step 2 Work in Design View

Task 2 Give the Detail section a pale green fill

Step 1 Select the Detail (by clicking its divider bar)

Step 2

Use to set a pale green fill

Page 74: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 68

Task 3 Display the Property Sheet and examine the properties of the Cl ientName text box

Select all the text boxes and use the Property Sheet (on its Format tab) to set their height to 1cm

Step 1

If necessary, click on the Design tab to display the Property Sheet

Step 2 Select the Cl ientName text box

Read the properties of the text box: some of the Format properties have been changed in the previous exercise, using toolbar buttons

Step 3 Hold CTRL and click on each text box in the Detail in turn, until they are all selected

Step 4 In the Format tab of the Property Sheet, delete the value given for Height , and type 1

As you move away from the Height box, all the selected text boxes are resized to 1cm

Task 4 Display the properties of the report

On the Data tab, set Order By to tb l Invoices .Date

Step 1 Select the report as a whole: either click the white box at the junction of the horizontal and vertical rulers, or use the drop-down at the top of the Property Sheet

Step 2 On the Data tab, click in Order By

Step 3 Edit (type) the value to read tblInvoices.Date

Task 5 Preview the report

Save the report as rpt InvoicesColours

Close the report

Step 1

Click to run the report and preview the results

Note that the records are now shown in date order

Step 2 Choose Save As on the File menu, and re-save or save the report with the name rpt InvoicesColours

Step 3 Close the report

Page 75: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

69 IT Learning Programme

Exercise 12 Working with a layout in a report

Understanding controls and labels in a layout

Selecting parts of a layout

Moving and resizing controls in a layout

Editing label text

Task 1 Create an instant report based on tblBusinessClients

Open it in Layout View

Step 1 Continue working in Sales Invoices.accdb

Close any tables, queries, forms, or reports that may be open

Step 2 Click once on tb lBusinessCl ients in the Navigation Pane

Click on the Create tab

Step 3 A new report is created, showing all the data in a default layout

Save it as rptBusinessClientsBigList

Step 4 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 5 Open it or switch to Layout View by right-clicking on the report name and choosing Layout View

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 the CustomerID column appears too wide for its contents

Step 2 Click on any one of the textboxes in the CustomerID 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 contents are neatly visible

Notice that all of the textboxes in this column are resized

Page 76: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 70

Step 4 Drag the bottom edge of the control to allow 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

Task 3 Move a control sideways to change the column order

Step 1 Click on one of the textboxes in the Department column

Step 2 Drag it to the left and drop it beside the Company Name column

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 tb lBusinessCl ients in the blue header of the report, to select it

Step 2 Click inside the label again to start editing the text

Change the text to read Current Clients

Step 3 When finished typing, click outside the label

Task 5 Preview the report

Save the report

Step 1 Switch to Print Preview to view your changes to the report

Step 2 Choose Fi le|Save to save the report changes made so far

Step 3 Close the report and close the database

Page 77: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

71 IT Learning Programme

Exercise 13 Working with a layout on a form (Optional)

Move, resize and rearrange controls in a layout

Convert separate controls into a Stacked layout

Change spacing within and around controls in a layout

Convert separate controls into a Tabular layout

Examine the effect of a layout on a form

Task 1 Open the database Inventory Toy Library2.accdb

You may recall that in this database, a group of volunteers are looking after a collection of toys, which may be borrowed by member families

If you are interested, look at the relationships diagram to see the tables and joins in this database

Task 2 Create an instant form based on tb lChi ldren

View the new form in Layout View

Examine the column of field controls which are in a layout

Step 1

Select tblChi ldren in the Navigation Pane

and click on the Create tab

Step 2 A new form is created, with default appearance, showing all the data in the chosen table

Step 3 Try out the form in Form View

In a form you can review or edit existing data and add new data

Step 4 Switch to Layout View

Step 5 Click on any of the field controls, and notice the handle that appears at the top left of the collection – the Instant Form tool has built the field controls into a layout

Task 3 Examine the effect of resizing or moving an item within a layout

Step 1 Drag the side of one text box horizontally, using a 2-headed arrow mouse pointer

Notice that the set of controls are resized together

Step 2 Drag the DateOfBir th box to the bottom of the layout

The controls are rearranged, but they stay lined up and evenly spaced

Step 3 Drag the handle to move the whole layout across the form

Page 78: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 72

Task 4 Experiment with changing the margins and padding in the layout

Step 1 Click the handle to select the whole layout

Step 2

Click on the Arrange tab, and choose Wide control padding

Step 3

Click and choose Wide margins – you will then need to resize the boxes to allow enough room

Task 5 Experiment with the buttons on the Arrange tab, for inserting rows and columns and moving items up and down

Task 6

Note that in Form Design View you can also select a layout and , leaving the familiar independent controls on the form

Task 7 Try out the form in Form View

Close the form, saving changes to the design

Task 8 Use the wizard to create a new form based on tb lMemberFamil ies

Step 1

Create a new form using the wizard on the Create tab

Step 2 Base the new form on tb lMemberFamil ies , and include all the fields

Step 3 Choose any appearance that you think suitable

Step 4 Save the new form as f rmMemberFamil ies

Step 5 Examine the form in Form View

Step 6 Work in Layout View

It contains a number of independent field controls

Task 9 Convert the 4 address-related field controls to a Stacked layout

Step 1 Select the controls Address 1,2,and 3 , and Postcode (hold CTRL for multiple selection)

Step 2

Click on the Arrange tab

Page 79: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

73 IT Learning Programme

Step 3 Try moving and resizing items to confirm that they are now organised into a Stacked Layout

Task 10 Convert the 2 name-related fields to a Table layout

Step 1 Select the LastName, OtherLastName and DateJoined controls carefully and convert them to a

Tabular Layout using

Step 2 Notice that the labels have been moved into the header

Try out the form in Form View, to see the effect of the changes

Task 11 Close and save the form

Exercise 14 Overall design of a report (optional)

Working in a report in Layout View

Inserting page numbers

Changing the paper size

Changing the orientation to landscape

Task 1 Open report rptToys in Layout View

Step 1 Continue working in Inventory Toy Library2.accdb

Close any tables, queries, forms, or reports that may be open

Step 2 Open report rptToys

Step 3 Switch to Layout View

Task 2 Insert a page number at the bottom of every page

Step 1

Click

Step 2 Choose Page N of M

Choose to position the page number in the bottom right of the report

Step 3 A new page number object appears in the Page Footer

Page 80: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 74

Step 4 Adjust the depth of the Page Footer so it is just deep enough to contain the page number

Task 3 Many of the following choices can be found in Design View, Layout View or Print Preview, so use whichever view is convenient

Task 4 In Print Preview, change the page size to A5 and the orientation to Landscape

Step 1

Choose

In the Page Setup 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 and notice how this affects the report

The contents of the report are not automatically rearranged when you change the orientation – that is a task for you

Task 5 Experiment with further layout changes

Close the report, discarding changes

Step 1 Experiment with other settings on the Page Setup ribbon tab or in the Page Setup dialog

Step 2

Click to close the report

When prompted, do not save the changes

Task 6 Close the toy library database, but leave Access open

Exercise 15 Sorting and grouping records in a report

Sorting in an existing report

Grouping in an existing report

Keep the records of one group together

Task 1

Continue working in the Sales Invoices.accdb

Open rptCustomers in Design View

Page 81: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

75 IT Learning Programme

Task 2 Use the Group , Sort and Total pane to change the order in which records appear - choose descending order of the company name

Step 1

Click to show the Group, Sort and Total pane

Step 2

Click

In the list, select the CompanyName field

Step 3 Set the sort order to descending by choosing

Task 3 Preview the revised report and save it as rptCustomersSorted

Confirm that records are now sorted alphabetically by company name

Task 4 View the report in Design View

In the Group, Sort and Total pane, remove any previous sorts – click at the right-hand end of the orange Sort bar

Save the report (again) as rptCustomersGrouped

Task 5 Set grouping on Region

Step 1

Click

Step 2 Choose Region from the list of fieldnames

Notice that a new section appears on the design grid, called Region Header

Task 6 Show a footer and a header for the Region group

Keep all the records of each group together on one page

Step 1

Click on the orange Group bar, to see more settings for this grouping

Step 2 Add a Footer for the group, as well as the Header which is already set

Step 3 Ensure that you have chosen to Keep whole group together on one page

Step 4

Click to hide the extra Group settings

Page 82: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

IT Learning Programme 76

Task 7 Move the Region control from the Detail into the Region Header

Step 1 Drag the Region control from the Detail onto the Region Header

Step 2 Draw a horizontal line in the Region Footer

This will separate the groups of records

Task 8 Preview the report and check the records are grouped correctly

Close the report, saving changes

Task 9 Close the database and close Access

Leave the computer at the desktop

Page 83: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

1

23/02/2016

IT Learning Programme

Databases:Reporting data using Access

Today’s arrangements

Your teacher is:

Your demonstrator is:

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 today’s course

Work at your own pace!

Divided into tasks and small steps

Be selective

Follow-up work

Continue with exercises after the session

Course Clinics at IT Learning Programme

Road map for “Databases: Reporting data”

Creating controls

Properties

Formatting objects

Ordering data

import dataexport data

Data to/from other

sources

Create reports

Presenting data and reviewing

Data is stored in tables

Getting Started

Page 84: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

2

23/02/2016

Getting started with Access

Start Access

In ITLP teaching rooms, use a desktop icon or Start menu etc.

Access version 2013 in teaching rooms

Trusting the file location (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:\

Data Management

Using data from an external source

Access, Excel, text file and others

Import, then make joins to existing tables

Import or Link?

Importing makes a duplicate copy in your database

Linking connects to data saved outside your database

Exporting data

One table at a time, or selected records

Data types include Access, Excel, text files

Data is copied to the new location

uses Word’s mailmerge tool

Page 85: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

3

23/02/2016

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 reportusing 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)

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

Page 86: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

4

23/02/2016

Databases:Reporting data using Access

Look at Exercises 1 to 6

Drinks and food in the refreshment area only, please

Demonstrator is:

Restart at 10:15

Working with Controls

4 views of a report

Previewing the data, as it will print out (with pagination)

Reviewing the data

Viewing sample data but not editing valuesRearranging the report

No data valuesDetailed design changes

Create a new report in Design View

Showing and hiding features

Gridlines - will not show on the report

Show header and footer

Drag dividing bars to resize

Create a new report in Layout View

Creating a blank report

Field data controls

Add a field – bound to the table or query

Add more fields

Move and resize field controls

Save the report (name prefix is rpt)

Manipulating a data control in Layout View

Click a control to select it:

Drag a control sideways to move

Drag an edge to resize (with others in the same field)

Page 87: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

5

23/02/2016

Working with multiple controls

Selecting multiple controls

Hold Ctrl key then click several objects

or Drag an enclosing rectangle

or Drag on a ruler

Arranging multiple controls

Overlapping objects have a stack order

Useful tools for positioning and aligning

Theme transforms the report

Quickly change the whole look of a report using Themes Gallery

Formatting an element of a report (1)

Edit text inside a label

Popular formats using buttons on the Format tab

Font formatting

Colours, lines and fills

Number, date formatting

Formatting an element of a report (2)

More formatting options in the Property Sheet

Insert a chart on a report

Databases:Reporting data using Access

Look at Exercises 7 to 11

Drinks and food in the refreshment area only, please

Restart at 11:15

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

Page 88: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

6

23/02/2016

Layouts

Working with layouts

A layout is a container for several objects

Set up automatically or convert existing controls

Move/resize controls together

Re-order items inside a stack

Add/delete a field

Margins and padding

Converting Stacked to Tabular layout

Overall Design of a Report

Report layout (optional)

Page Setup tab

Change paper size, orientation, margins etc.

Design tab

Page numbers in header/footer

Sorting records on a report

Sort order may have been set:

in the underlying table or query

or in the wizard

In Design View, use the Group, Sort and Total pane

Page 89: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

7

23/02/2016

Grouping data on a report

Records with the same value are collected together

Choose grouping in the wizard

Sub-headings label each group

Change settings in the Group, Sort and Total pane

Group by a field

Section header & footer are inserted

Move the control into the group header as a sub-heading

Keep the group together?

“Summarising” dataon a report

Summary calculations can be included, using the wizard

If the data is grouped

On the Sorting page, click

Choose fields

Choose summary values SUM, Average etc

More about databases

Further courses

Further work with Access:

Databases: User-friendly databases

Databases: Querying and analysing data

MySQL

Problems

Course Clinics

[email protected] or phone

Appointments 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

Databases:Reporting data using Access

Now look at Exercises 12 onwards

Finish at 12:15

Page 90: Databases: Reporting data using Access - University of Oxford...Databases: Reporting data using Access IT Learning Programme 2 A database application may be built – using forms,

Databases: Reporting data using Access

8

23/02/2016

This presentation is made available by Pamela Stanworthunder a Creative Commons licence:

Attribution-NonCommercial-ShareAlike

CC BY-NC-SA

[email protected]