MODULE 5 DATABASES. Content

Similar documents
ECDL Module 5 REFERENCE MANUAL

Introduction to Microsoft Access 2016

Complete Quick Reference Summary

SOFTWARE SKILLS BUILDERS

Microsoft Access XP Edition for ECDL Syllabus 4.5 (UK only)

Microsoft Access 2003 Edition for ECDL Syllabus 4.5 (UK only)

Introductory Exercises in Microsoft Access XP

Access 2003 Introduction to Report Design

ICDL & OOo BASE. Module Five. Databases

Database Design Practice Test JPSFBLA

Microsoft Access 2010

Database Tables Lookup Wizard Relationships Forms Subforms Queries Reports

TECHNOLOGY COMPETENCY ASSESSMENT MODULE Microsoft Access

Getting started with Ms Access Getting Started. Primary Key Composite Key Foreign Key

AUSTIN COMMUNITY COLLEGE CONTINUING EDUCATION. INTRODUCTION TO DATABASE/FILE MANAGEMENT (Access Introduction) (12 hours) ITSW 1053 COURSE SYLLABUS

Chapter 4: Single Table Form Lab

Level 6 Relational Database Unit 3 Relational Database Development Environment National Council for Vocational Awards C30147 RELATIONAL DATABASE

Veco User Guides. Grids, Views, and Grid Reports

MS Access Let s begin by looking at the toolbar and menu of Access.

Microsoft Access 2007 Module 2

Objective 1: Familiarize yourself with basic database terms and definitions. Objective 2: Familiarize yourself with the Access environment.

SEE GRADING CRITERIA AT THE BOTTOM. Database Tables Lookup Wizard Relationships Forms Queries Reports

button Double-click any tab on the Ribbon to minimize it. To expand, click the Expand the Ribbon button

Microsoft Access 5: Reports & Other Useful Functions

Contents. Creating Forms

Nutzen Sie die Dettmer-Seminarunterlagen für Access bei einmaligem Kauf über Jahre hinaus für Ihre eigenen Schulungen

MIS Cases: Decision Making With Application Software, Second Edition. Database Glossary

Table of Contents COURSE OVERVIEW... 5

Microsoft Access 2007 Module 1

Simply Personnel Screen Designer

When you pass Exam : Access 2010, you complete the requirements for the Microsoft Office Specialist (MOS) - Access 2010 certification.

Links to Activities ACTIVITY 3.1. Links to Activities ACTIVITY 3.

Links to Activities ACTIVITY 4.1. Links to Activities Links to Activities

Spreadsheet definition: Starting a New Excel Worksheet: Navigating Through an Excel Worksheet

ACCESS 2007 FOUNDATION

Intermediate Microsoft Access 2010

Microsoft Access 2010

Simple Invoicing Desktop Database with MS Access 2013/2016. David W. Gerbing School of Business Administration Portland State University

Section 3 Formatting

Microsoft Access II 1.) Opening a Saved Database Music Click the Options Enable this Content Click OK. *

Creating Reports in Access 2007 Table of Contents GUIDE TO DESIGNING REPORTS... 3 DECIDE HOW TO LAY OUT YOUR REPORT... 3 MAKE A SKETCH OF YOUR

Open. Select the database and click. Print. Set printing options using the dropdown menus, then click the

Microsoft Excel 2010 Basic

Microsoft How to Series

Let s create another simple report from one of our queries available: Author Age query.

Kenora Public Library. Computer Training. Introduction to Excel

ECDL Full Course Content

Creating and using reports

MICROSOFT WORD. Table of Contents. What is MSWord? Features LINC FIVE

WEEK NO. 12 MICROSOFT EXCEL 2007

SAMPLE ICDL 5.0. International Computer Driving Licence. Module 4 - Spreadsheets Using Microsoft Excel 2010

Publisher 2013 Foundation SAMPLE

Using Microsoft Excel

INTRODUCTION... 1 UNDERSTANDING CELLS... 2 CELL CONTENT... 4

Section 1 Getting Started

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

Corel Ventura 8 Introduction

DEVELOPING DATABASE APPLICATIONS (INTERMEDIATE MICROSOFT ACCESS, X405.5)

Working with Data in Microsoft Excel 2010

MICROSOFT ACCESS VERSION 2010 FOUNDATION

Microsoft Word: Steps To Success (The Bare Essentials)

Access 2000 MICROSOFT. Level One Basic. Version N2

ECDL Module 3 WORKBOOK. Word Processing. Microsoft Word XP Edition for ECDL Syllabus Four

Advanced Excel. Click Computer if required, then click Browse.

Table of Contents. Word. Using the mouse wheel 39 Moving the insertion point using the keyboard 40 Resume reading 41

Mark for Follow Up. Address Book. To Delete a Message: Select the message and press the Delete key. To Create a New Message:

ECDL Module 6 REFERENCE MANUAL

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information

Microsoft Access 2013

Microsoft Access 2013

Introduction to Microsoft Excel

Index. B backing up 76 7

Publisher 2016 Foundation SAMPLE

Computer Skills Checklist

Introducing Gupta Report Builder

Excel Module 7: Managing Data Using Tables

Microsoft Word 2011 Tutorial

Microsoft Word 2010 Basics

12 BASICS OF MS-EXCEL

As your databases continue to evolve, you will need to incorporate advanced queries and reports. This chapter addresses how to create and use action

NiceForm User Guide. English Edition. Rev Euro Plus d.o.o. & Niceware International LLC All rights reserved.

Changing Worksheet Views

With ClaroIdeas you can quickly and easily create idea maps using a combination of words, symbols and pictures.

Access 2013 Introduction to Forms and Reports

Introduction to Computer Applications. CISY 1225 Chapter 10. Zahoor Khan, PhD

Lesson Skill Matrix Skill Exam Objective Objective Number

Publisher 2010 Foundation. Publisher 2010 Foundation Level SAMPLE

For Microsoft Office XP or Student Workbook. TECHNOeBooks Project-based Computer Curriculum ebooks.

Word Tutorial 3. Creating a Multiple- Page Report COMPREHENSIVE

ACCESS. Laboratory Manual. Çankaya University Department of Computer Engineering

Microsoft Access XP (2002) Reports

ABOUT THIS COURSE... 3 ABOUT THIS MANUAL... 4 LESSON 1: MANAGING LISTS... 5

CONTENTS INTRODUCTION... 1 DATABASE CONCEPTS... 3

Create Forms 5. KEY TERMS Blank Form tool common filters filter filter by form Form Design button Form tool Form Wizard Themes LESSON SKILL MATRIX

MS-Access : Objective Questions (MCQs) Set 1

Report Designer Report Types Table Report Multi-Column Report Label Report Parameterized Report Cross-Tab Report Drill-Down Report Chart with Static

Access 2003 Introduction

User Guide. Web Intelligence Rich Client. Business Objects 4.1

Enforce Referential. dialog box, click to mark the. Enforce Referential. Integrity, Cascade Update Related Fields, and. Cascade Delete Related

KEY TERMS chart chart body Chart Wizard client object legend PDF XPS

Transcription:

MODULE 5 DATABASES Module Goals Module 5 - Databases, requires candidates to understand some of the basic concepts of databases demonstrate the ability to use a database on a personal computer. Candidates acquire the skill to create and modify tables, queries, forms and reports and prepare printed outputs. They will also be able to relate tables and will develop competency in retrieving and manipulating information from existing databases using the query and sort tools. Content 5.1 Using the Application... 1 5.1.1 Database Concepts...1 Fields...1 Data Type...1 Field Properties...1 Tables...1 Forms...1 Queries...1 Reports...2 Primary Key...2 Index...2 Relating Tables...2 Relationship Rules...2 5.1.2 First Steps with Databases...2 Open a Database Application...2 Open an Existing Database when Access is Run...4 Open an Existing Database...4 Create a New Database...4 Save a Database onto a Hard Disk or Diskette...4 Close the Database...5 Use Help Functions...5 5.1.3 Adjust Basic Settings...5 Change Viewing Modes...5 Display / Hide Toolbars...6 5.2 Tables... 6 5.2.1 Main Operations...6 Design and Plan a Database...6 Create a Table...6 Field Name...7 Data Type...7 Description...7 Field Properties...7 Exercise 5.1...8 Enter Data into a Table...8 Exercise 5.2...8 Modify Data...8 Delete Data in a Table...9 Add Records to the Database...9 Delete Records in a Database...9 Navigate throughout a Table...9 Delete a Table...10 Module 5

Close a Table...10 5.2.2 Define Keys...10 Define a Primary Key...10 Assign a Field a Primary Key...10 Set up an Index...10 5.2.3 Table Design / Layout...11 Field Format Attributes...11 Modify Field Size...11 Modify Number Format...11 Modify Date Format...11 Consequence of Changing Field Size Attributes...12 Validation Rule...12 Move a Column within a Table...12 Change Column Widths...12 Sort a Table...13 Exercise 5.3...13 5.2.4 Table Relationships...14 One-To-One Relationship...14 One-To-Many Relationships...15 Delete a Relationship...16 Relationship Rules...16 5.3 Forms... 16 5.3.1 Working with Forms...16 Open a Form...16 Create a Form...17 Create a Form using the AutoForm Facility...19 Enter Data into Database using a Form...19 Modify Data in a Database using a Form...19 Delete Records using a Form...19 Form Navigation...19 Exercise 5.4...20 5.3.2 Modify Form Layout...20 Format Text...21 Change Background Colours in a Form Layout...21 Import an Image or Graphic into a Form...21 Add a Header to a Form...22 Add a Footer to a Form...23 Change Arrangement of Objects within a Form...23 Delete a Form...23 Save and Close a Form...23 Exercise 5.5...23 5.4 Retrieving Information... 24 5.4.1 Main Operations...24 Find a Record...24 Apply a Filter...24 Remove a Filter...24 Filter by Form...24 Remove Filter by Form...25 5.4.2 Queries...25 Create a Simple Query...25 Save a Query...26 Run a Query...27 Delete a Query...27 Create a Query with Multiple Criteria...27 Using AND and OR to Affect Query Results...28 Find Duplicates Query...28 Exercise 5.6...29 Module 5

Add Fields to a Query...29 Remove Fields from a Query...29 Hide Fields in a Query...30 5.4.3 Sort Records...30 Sort Data based on a Query...30 Sort Data based on Common Logical Operators...30 Sort a Table...31 Sort a Form...31 Exercise 5.7...31 5.5 Reports... 32 5.5.1 Working with Reports...32 Create a Report...32 Modify a Report...35 Align Fields and Format Text in Header and Detail Sections...35 Delete a Control...35 Create and Customise Headers and Footers...35 Group Data in Reports using the Wizard...36 Group Data in a Report...37 Delete a Report...37 Exercise 5.8...38 Exercise 5.9...38 5.6 Prepare Outputs... 38 5.6.1 Prepare to Print...38 Preview...38 Change Report Orientation...38 Change Paper Size...38 Print Table Options...39 Print from Form...39 Print Result of a Query...39 Print a Report...39 5.7 Extra Exercises... 40 Disclaimer: Please note that all assessments in this module of the workbook are designed solely for practice of the skills explained in this module. They are not ECDL certification test items and should not be construed as such. Module 5

5 DATABASE 5.1 USING THE APPLICATION 5.1.1 Database Concepts An Access database is a collection of data related to a particular topic / purpose, e.g. customer data. Information in a database is organised into Fields such as customer name. A group of related fields, such as all the information on a particular customer, is called a Record. A collection of related records is called a Table. A database, specifically a relational database, is a collection of one or more related tables that can share information. Fields Fields within a database have associated properties and data types. Data Type Data types are attributes that determine what kind of data a field can have. Data types are selected from a drop-down list and include: Text - which includes text or a combination of text and numbers that do not require calculations. This data type can be up to 255 characters. Memo includes lengthy text or a combination of text and numbers. Number this data type consists of numeric data to be used in calculations. Date/Time for date and time values. Currency for currency values. AutoNumber this is a unique sequential number that Access assigns to each new record; it cannot be edited. Yes/No for fields that will contain only one of two values Yes or No. Hyperlinks stores hyperlink addresses. Lookup Wizard - creates a field that displays either a Lookup List or a Value List, which makes data entry simpler. A Lookup list displays values looked up from an existing table or query while a Value list displays a fixed set of values that are entered when the field is created. Field Properties For each data type, field properties can be set. These determine the format, size and other characteristics of the data that affect its appearance and accuracy. There are four main components to an Access database that we will become familiar with, i.e. Tables, Forms, Queries and Reports. Tables Tables are the basic storage structures where all data is stored in columns and rows. Forms Forms are created from tables and display either the entire table or selected fields on a single page. Thus in a form each record is viewed on a separate page. Queries Queries are used to search for specific data contained in the table and then present the selected fields and records in a table format. Module 5 Page 1

Reports Reports are used to present data from a table or query on paper for printing. Primary Key The power of a database system comes from its ability to quickly find and bring together information stored in separate tables. In order to do this, each table should include a field that uniquely identifies each record stored in the table. This information is called the primary key of the table. Once you designate a primary key for a table, to ensure uniqueness, Microsoft Access will prevent any duplicate values from being entered in the primary key fields. Index An index can refer to the ordering and the uniqueness of values. When linking tables, indexes are used to ensure links work correctly. Linking tables is beyond the scope of this module. They help speed up queries which will be discussed later in this module but slow down data entry as indexes need to be updated each time data is entered. Indexes are set when designing the table. Relating Tables When using Access a number of tables, such as Customers, Products, Orders, Employees, etc. are used. A relationship between these tables must be established. Once tables are linked, queries, reports and forms can be created to display or print information that is spread across multiple tables. Relationship Rules Unique field: It is necessary to have one field in every table that can uniquely identify each record. This field is called the primary key. It is usually some kind of identification number, as they will not repeat, e.g. RSI number, as no two people will have the same RSI number. Fields like name and surname are not suitable as primary keys because people in a database may have the same name. Fields functionally dependent: Each field in the record should relate to the subject of the record. If not, it is redundant and belongs in another table. Ensure each field is independent: It should be possible to alter any one field in a record without affecting any of the others. Ensure fields do not contain calculated or derived data: For example, only hold gross pay and deductions on a person s salary record as net pay can be calculated when required. Data in its smallest logical part: Break information into their smallest parts so that specific queries can be generated, e.g. separate County Galway into a prefix field (County) and a county field (Galway). 5.1.2 First Steps with Databases Open a Database Application Microsoft Access can be started in several different ways depending on the set up of your personal computer. The Start, Programs menu will contain a Microsoft Access option. There may be a shortcut to Microsoft Access on your Desktop or the Microsoft Office Toolbar will have an Access icon. Access Shortcut MS Office Toolbar Module 5 Page 2

When Access starts, the user is requested to: Create a Blank Database Access Database Wizards Open an existing Database Click on the radio button beside Open an existing file and select the database file to open or alternatively: Click on the radio button beside Blank Access Database. Click on OK and the File New Database window will be displayed. Type in a suitable name for the database and save it in a suitable location. (In an ECDL test you may be asked to save the file on a floppy disk). Click on Create. When creating a database, a name is assigned to it from the outset. Once the file is created, the user can then create the tables that contain the data. The Database window opens displaying the new empty database with the Create Table options displayed: Menu Bar Database Toolbar Database Window The Database window is where all the elements of the database come together. A database may have many tables, queries, forms, reports, macros and modules and it is the Database window that organises these components into specific sections. By clicking on the Table tab at the top left of the window, all the tables in the database will be displayed. Module 5 Page 3

Open an Existing Database when Access is Run When Microsoft Access is launched, you are immediately presented with the Microsoft Access screen with a number of options as outlined above. Click on the radio button Open an Existing Database. Select the database to be opened from the list available. Click on Open. Open an Existing Database The File, Open command can also be used to open an existing database. Another alternative is to use the Open file icon from the toolbar. Create a New Database When Access is started, the user is requested to: Create a Blank Database, Access Database Wizards or Open an Existing Database. Click on the radio button beside Blank Access Database. Click on OK and the File New Database window will be displayed. Type in a suitable name for the database and save it in a suitable location. (In an ECDL test you may be asked to save the file on a floppy disk). Click on Create. When creating a database, a name is assigned to it from the outset. Once the file is created, the user can then create the tables that contain the data. Save a Database onto a Hard Disk or Diskette With the active database on the screen, click on the File menu and the Export option. Select the database into which to export the table and click on Save All. In the Save In text box, click on the drop-down arrow and select the required drive and folder. This can be 3½ Floppy (A) if it is required to save the database to a floppy disk. Click on Save All. Module 5 Page 4

Close the Database When the database is active on the screen, click on the File menu. Click on the Close option to close the specific database file. Click on the Exit option to exit out of Microsoft Access. Use Help Functions Access has a very comprehensive Help facility. The Help menu or the Office Assistant can be used to obtain help. Click on the Help menu and the Office Assistant will be displayed. Type in a question and press Search. Click Microsoft Access Help on the Help menu. If the Assistant is turned on, it appears. If the Assistant is turned off, the Help window appears. To scroll through a table of contents for Help, click the Contents tab. This is very comprehensive and covers most topics in Access. Doubleclick on the book icon beside the option to display further details. When an icon with a question mark is shown, click on it for details on that topic. In the example to the right, the topic Working with Data has several sub-topics. The sub-topics with the book icon have further sub-topics. The topics with the question mark icon have details on that topic. To type a question in the Help window, click the Answer Wizard tab. The Index tab allows you to type in a word or string of words. A list of related topics are displayed. Double-click on the required topic. To see a ScreenTip for a menu command, toolbar button, or screen region, click What's This? on the Help menu and then click the item you want information about. 5.1.3 Adjust Basic Settings Change Viewing Modes When in the Database window, tables, queries, forms, reports, etc., can be viewed by clicking on the appropriate icon to the right of the Database window. Clicking View, Database Objects can also activate these views, and the corresponding view from here selected. Module 5 Page 5

Tables, queries, etc., within the database can be viewed as Large icons, Small icons, List or Details. The standard view is List as evident from the menu on the right. Clicking the required button on the toolbar can access these options also. Display / Hide Toolbars Clicking on the View menu Toolbars option to list the toolbars that are available in Access. There are only two, the Database and Web toolbars. Clicking on a toolbar will display or hide it. Selecting the Customise option displays all available command buttons. These buttons can be dragged onto the toolbar and be available for future use. Click on Close in the Customise screen when complete. 5.2 TABLES 5.2.1 Main Operations Design and Plan a Database Before information is entered into a database, the goal and purpose of the database should first be identified and a plan of how data is stored in it decided. The planning stage involves deciding how many tables the database will involve and what data will be stored in each table. Although the table can be modified at any stage, up-front planning makes the process easier. In planning a database, the following guidelines should be considered: Determine the purpose of the database and give it a meaningful name. Determine the results or outputs from the information stored in a database. Collect all the information that will be used to produce the results. Sketch the structure of the table including each field s data type. Create a Table Select the Table tab in the Database window. Double-click on the Create Table in Design View option or alternatively click on the New button and select the option Design View. Module 5 Page 6

The Table Design Grid appears where field names, data types, descriptions and field properties are entered. Field Name A field name can contain up to 64 characters and include letters, numbers, spaces and some special characters. Data Type Data types are attributes that determine what kind of data a field can have. Data types are selected from a drop-down list and include: Text - which includes text or a combination of text and numbers that do not require calculations. This data type can be up to 255 characters. Memo includes lengthy text or a combination of text and numbers. Number this data type consists of numeric data to be used in calculations. Date/Time for date and time values. Currency for currency values. AutoNumber this is a unique sequential number that Access assigns to each new record; it cannot be edited. Yes/No for fields that will contain only one of two values Yes or No. Hyperlinks stores hyperlink addresses. Lookup Wizard - creates a field that displays either a Lookup List or a Value List, which makes data entry simpler. A Lookup List displays values looked up from an existing table or query while a Value List displays a fixed set of values that are entered when the field is created. Description An optional description can be entered for each field. The description, if added, appears in the status bar when a field is selected for data entry or editing. Field Properties For each data type, field properties can be set. These determine the format, size and other characteristics of the data that affect its appearance and accuracy. When the table design is complete, click on the File, Save option or the Save icon on the toolbar. The Save dialog box is displayed. Give the table an appropriate name and click on OK. Access will then prompt the user to set a primary key. Click on No. Click on the File menu. Choose the option Close. Module 5 Page 7

Exercise 5.1 1. Create a database called Employees. 2. Insert the following field names and attributes in the table: Name Text Address Text Date of Birth Date Salary Currency 3. Save the table calling it Personnel Details. 4. Do not set a primary key. 5. Close the database. Enter Data into a Table Click on the table and click on Open to enter data into the table. Click on the New Record button or click into the first field in the first record and type in data. Press the Tab or Enter key to advance to the next field. Continue to enter data in all fields for each record. Click on Save when complete. Exercise 5.2 1. Open the database called Employees. 2. Enter the following records into the table called Personnel Details. Name Address Date of Birth Salary John Martin Avoca Avenue 12/08/68 25000 Mary Smith Bray Heights 05/01/72 22500 Ann Kavanagh Mansion Estate 08/09/77 20000 3. Save the table and close it. Modify Data Open the table that contains the records to be edited. The table is displayed in the Datasheet view. Click on the record to be edited, click into the required field and type in the new details. First Previous Next Last New Module 5 Page 8

Press the Tab or Enter key to advance to the next field. Continue to edit data in all fields for each record. Click on the Save button on the toolbar to save changes. Delete Data in a Table Click into the field to be edited. Press Delete key or Backspace key. If data was incorrectly deleted, it can be undone by clicking on the Undo button on the toolbar. Add Records to the Database With the table open, click on the New Record button at the bottom of the table or on the toolbar or click on Insert, New Record. Enter new record details. Delete Records in a Database Click on the Record Selector next to the record that is to be deleted. Click on the Edit menu. Click on the option Delete Record or Delete icon on the toolbar. Access will confirm to the user that a record is being deleted and needs confirmation as to whether to continue. Once a record is deleted it is not possible to recover it again. Navigate throughout a Table At the bottom of the table in Datasheet view, there are a number of buttons used for navigating through a table. Edit Record New Record Go to First Record Go to Previous Record Go to Next Record Go to Last Record Module 5 Page 9

Delete a Table In the Database window, click on the table to be deleted and press the Delete key or the Delete icon on the toolbar. A message is displayed confirming the deletion and click on OK if you wish to proceed with the deletion. Close a Table Click on the Table icon and click on the Close command or alternatively click on the Close Window button on the top right of the window. If changes were made to the layout of the table, you will be prompted to save the table. 5.2.2 Define Keys Define a Primary Key The power of a database system comes from its ability to quickly find and bring together information stored in separate tables. In order to do this, each table should include a field that uniquely identifies each record stored in the table. This information is called the primary key of the table. Once you designate a primary key for a table, to ensure uniqueness, Microsoft Access will prevent any duplicate values from being entered in the primary key fields. Assign a Field a Primary Key In the Design view, select the required field. Click on the Primary Key icon on the toolbar. Set up an Index An index in this context refers to the ordering and the uniqueness of values. When linking tables, indexes are used to ensure links work correctly. Linking tables is beyond the scope of this module. They help speed up queries which will be discussed later in this module but slow down data entry as indexes need to be updated each time data is entered. Indexes are set when designing the table. Open the table in Design view by clicking on the Table name and Design in the Database window or if the table is displayed, click on the View, Design View command or click on the Design icon on the toolbar. Click on the field that is to be indexed and in the Field Properties section, click on the drop-down arrow beside Indexed (on the General tab). A field can be indexed with: Module 5 Page 10

Duplicates allowed used in the case of a person s name, where there may be more than one occurrence of the same name. Select Yes (Duplicates OK). Duplicates not allowed used in the case of a personal ID or PRSI number where more than one occurrence is not allowed. Select Yes (No Duplicates). Close out of the table s Design view and Save it when prompted. 5.2.3 Table Design / Layout Field Format Attributes Open the table in Design view by selecting the table and clicking the Design icon. Click on the field to be modified and edit its attributes by either changing its data type or its field properties. Modify Field Size Click in the Field Size section of the dialog box and type in the required size, i.e. the number of characters that the user will enter into this field. Modify Number Format Click on a field that has its data type set to Number. Click in the Format section of its field properties and from the drop-down arrow to the right of the Format option, select the desired format option. Modify Date Format In Design view, click on a field whose data type is set to Date/Time and click on the drop-down arrow to the right of the Format option and selected the desired format. Module 5 Page 11

Consequence of Changing Field Size Attributes If the field size is too small, the field will not accept the data as you type it in the table. Click to select Click and drag to new location Validation Rule In the table s Design view, select a field to apply a validation to it, e.g. the Date/Time field. In the Field Properties section, click on the Validation Rule text box and enter criteria such as >=01/01/2000 which requires that dates prior to the 01/01/2000 will not be accepted by this field. Alternatively, click on the Expression Builder icon for help with creating validation rules. Use the logical operators and type in the date as displayed below. Click on OK when complete. Move a Column within a Table Click on the Title of the field to be moved. Click on it a second time and drag it to the new location. Change Column Widths When a table is created, Access begins by making all the columns the same width. This may result in some of the data being hidden. Click on the dividing line between a title and the one to its right. The shape of the cursor changes to a double-sided arrow. Drag the cursor left or right until the column is the right size. Before changing column widths After changing column widths Module 5 Page 12

Sort a Table Select the table to sort and click on Open. Click into the field that is to be sorted. Click on the Sort Ascending or Sort Descending icon on the toolbar. Exercise 5.3 1. Open the database Employees. 2. Open the table Personnel Details. 3. Add the following records: Name Address Date of Birth Salary Joe Slevin Main Street 23/07/65 21500 Grainne Brophy Whitethorn Grove 05/05/75 24250 Maire Moran Riverview 09/11/73 23400 4. Change the column widths so that all field details can be viewed. 5. Sort the table in ascending order on the Name field. 6. Move the Date of Birth column after Salary column. 7. Joe Slevin has moved from Main Street to Blackhorse Ave - modify this record to recall the change. 8. Ann Kavanagh is no longer with the company delete this record. 9. Marie Moran s salary has been increased by 1000 - edit this record. 10. Save the table and exit Access. Module 5 Page 13

5.2.4 Table Relationships One-To-One Relationship Click on the Tools menu and select Relationships.or click on the Relationship icon on the toolbar. If the Show Table dialog box is not displayed, click on the Show Table icon on the Relationship toolbar. Select the table to add from the list of tables displayed. Use the CTRL key to add more than one table or the Shift key to select a block of tables. Click on Add and Close. The Relationship window resembles the screen below: To create the relationship link from a field in one table to a field in another table, simply drag the field from the first table and drop it on top of the field in the second table. The Edit Relationships dialog box will be displayed showing the link between the two different tables, in this case the Employee Number field. Module 5 Page 14

Click on Create and a line appears in the Relationship window representing the link between the two tables. One-To-Many Relationships Click on the Relationship icon, the Show Table icon and select the tables. Click on Add and Close. In the example illustrated below, we wish to create a relationship between the Department Code field in the Department Codes and Human Resource tables. The Department Code field in the Department Codes table is unique but in the Human Resource table, a repetitive Department Code can be entered, as some employees will be in same departments. Therefore there is a need to create a One-To-Many Relationship Drag the field Department Code from the Department Code table to the Department Code field in the Human Resources table. Join type will display as One-To-Many and click the option to Enforce Referential Integrity to ensure that changes made in Department Code table are replicated in the Human Resources table. Module 5 Page 15

Click Create to display the relationship. Delete a Relationship In the Relationship window, click on the Relationship line that you wish to delete. Press the Delete key. In the dialog box displayed, click on Yes to permanently delete the relationship. Relationship Rules When you create a relationship or double-click on an existing relationship in the Relationship window, the Edit Relationship dialog box is displayed. Relationship rules can be applied by clicking on Enforce Referential Integrity check box. This ensures that relationships between records in related tables are valid. It means that the user will not be able to accidentally modify related data. Cascade Update Related Fields means that if you change the primary key in the record of a primary table, Access will update the corresponding fields in related records with the new value. Cascade Delete Related Records means that if a primary record is deleted, the corresponding records in related tables will be deleted. 5.3 FORMS 5.3.1 Working with Forms Open a Form Click on the Forms icon on the left of the Database window and select the form you wish to open. Click on the Open icon from the toolbar. Module 5 Page 16

Create a Form In the Database window, click on the Forms tab and double-click on Create Form by using Wizard. Alternatively, click on New and the New Forms dialog box is displayed. Select the option Form Wizard. Select the table on which the form will be based. Click on OK and the dialog box below is displayed which lists all the fields in the selected table. Module 5 Page 17

Add a single field Add all fields Remove a single field Remove all fields Select the field required in the form from the available fields list and click the Add Single Field button. Continue to select and add until all required fields are selected. Click on Next to display the Layout dialog box. Select the required layout from the four available options: Columnar, Tabular, Datasheet and Justified. Click on Next and the Form Style dialog box is displayed. Select the required style from the list of available options. As you click on each style, a preview is displayed on the left-hand side. Click on Next. The final dialog box suggests the table name as a title for the form but this can be changed if required. Click Finish and the form opens displaying the fields and data for the first record in the table. Module 5 Page 18

Create a Form using the AutoForm Facility Forms can also be created using the AutoForm facility. This option creates a form either in a Columnar, Tabular or Datasheet layout depending on the AutoForm option selected. The user is not required to make any decisions, except to select the table or query on which the AutoForm is to be based. Enter Data into Database using a Form Click on the New Record button on the Form View toolbar to display a new blank record. Enter information into the first field. Press the Tab key to advance to the next field and enter information into it. Continue to enter data for the record, pressing Tab to move from field to field. Modify Data in a Database using a Form Use the Record Navigation keys to display the record that you wish to alter. Modify as required. Delete Records using a Form Display the form for the record that you wish to delete. Click on the Delete Record icon. Click Yes if you wish to permanently delete the record. Form Navigation The Form Navigation bar is located at the bottom of the form: Go to First Record Go to Previous Record Go to Next Record Module 5 Page 19

Go to Last Record Enter new Record Exercise 5.4 1. Open the Employees database. 2. Generate a simple form from the Personnel Details table and call it Details. 3. Enter the following records into the table using the form: Name Address Date of Birth Salary Mary Mannion Broadstone 26/10/77 18000 Stephen Ryan Rosbeg Woods 12/08/80 18250 4. Close the form. 5. Open the table to see the extra records. 5.3.2 Modify Form Layout A form can be modified easily by changing the location of the fields, adding or deleting fields, adding graphics, changing the colour of the background, text and field data, etc. A form is modified in Design view. Form design is divided into three sections: Form Header appears at the beginning of each screen form and can contain a title or logo. Detail section displays the fields for each record. Form Footer appears at the bottom of each screen and can contain totals, instructions or command buttons. Each element on a form is called a Control. A control consists of the field label and the data it contains which is the field value text box. The appearance and properties associated with a control can be changed. Field Label Form Design View While in the Database window, select the Form tab. Select the required form and click on the Design icon and the Form Design screen is displayed. The form s background changes to a grid, which helps keep fields aligned horizontally and vertically An extra toolbar, called Toolbox, which contains extra buttons that may be used to modify the design, may also be displayed. If not click on the Toolbox icon on the toolbar to display it. Value text box Module 5 Page 20

Format Text Both the field label and value text box are formatted to display in font style MS Sans Serif, font size 8. This can be formatted to any other style or size by selecting options from the Font Style and Font Size icons on the toolbar. Text can also be emboldened or italicised using the corresponding icons on the toolbar. Different colours can also be applied to text by selecting the label and then selecting the colour from the Text Colour icon on the toolbar. To Change the Font Style and Font Size of a Field Label Select the field label and click on the drop-down arrow beside the Font Style box to select another style. Click on the drop-down arrow beside the Size box and select a larger size. To Change the Font Style and Font Size of all Field Labels and Value Text boxes Select the field label, hold the Shift key down and select all other field label and value text boxes. Click on the drop-down arrow beside the Font Style box to select another style. Click on the drop-down arrow beside the Size box and select a larger size. To Change the Font Colour and Embolden a Label Select the label. Select a colour from the drop-down arrow on the Font Colour icon. Click on the Bold icon. Change Background Colours in a Form Layout Click on the Title bar labelled Detail. Select a colour from the drop-down list on the Fill/Back Colour icon. Import an Image or Graphic into a Form Click on the form and then click on the Insert menu and select Picture. Locate the image or graphic from its required location, click on it and then click on OK to insert into the form (use the View button to display a preview of the image). The image may have to be resized or moved within the form. This is achieved by selecting the image and when the mouse shape appears as a flat-hand, move the image to the required location. Position the mouse on the corner of the image and when the mouse is a double-sided arrow, drag to re-size The image properties must be amended so that the picture can be seen in the form. Select the picture and click on the Properties icon on the toolbar. On the Format tab, click in the Picture Size Mode box and select the option Zoom, which adjusts the size of the image to the required size. Close the Properties screen. Module 5 Page 21

Image when resized and before size mode is set. Image after size mode is set to Zoom. Add a Header to a Form Position the mouse between the Header and Detail bars in the form. When the mouse changes shape, drag it down to increase the Header area. Click on the Label button on the Toolbox toolbar. Click into the Header area and hold down the mouse and drag to draw a text box. Click into the box and type an appropriate header for the form. Format the header as you format text (see above). Design View Click on the View menu and Form View to display the form or alternatively click on the View button. Form View Module 5 Page 22

Add a Footer to a Form A footer is added to a form in the same way as a header is added to a form. In Form Design view, drag the mouse below the footer area to display the footer. Click on the Label icon on the Toolbox toolbar. Click into the Footer area and hold down the mouse and drag to draw a text box. Click into the box and type an appropriate footer for the form. Format the footer as you formatted text (see above). Change Arrangement of Objects within a Form Select the field by clicking the control for that field. Black squares called handles appear around the perimeter of the selected control. If the field label control is selected then only the label is selected, but if the field value text box is clicked then the field label is also selected. When the pointer changes shape, drag the control to its new location. Continue to select and drag each of the controls as required. Handles Delete a Form From the Database window, select the form to delete and click on the Delete icon on the toolbar. Click Yes to permanently delete the form. Save and Close a Form From the File menu, click on Save option. From File menu, click on Close. Exercise 5.5 1. Open the form called Details in Design view. 2. Position the Salary field to the right of the Date of Birth field. 3. Put in a header formatted in Arial, 12pt, Red and Bold. 4. Change the colour of all the Value text boxes to blue and font size 10. 5. Change the background colour in the Header area to Blue and in the Detail area to Red. 6. View the form. 7. Save and close the form. Module 5 Page 23

5.4 RETRIEVING INFORMATION 5.4.1 Main Operations Find a Record Open a table within the database. Click on the Edit menu and select the option Find. Alternatively, click on the Find icon on the toolbar. Enter the data in the Find What text box. Click the drop-down arrow in the Look In box and ensure that the whole table is accessed for the data. All records can be searched for a whole field, part of a field or the start of a field. Wildcards can be used when searching for data. Wildcards are symbols used as substitutes for characters in text: * represents any group of characters.? stands for any single character. # stands for a single digit. For example, to find any name beginning with S, type s* in the Find What text box. Apply a Filter Filters are simple queries but they only apply to open tables or forms. They are best used for temporarily altering the view of the data in a table such as filtering out records not required, viewing records that meet complex criteria, sorting records on content of several fields, etc. Filter by Selection in a Table Open a database table. Click into the cell containing the item that you wish to filter on. Click on the Filter by Selection icon on the toolbar to display the filtered data as below. Data is filtered on the County field as Dublin. Remove a Filter Click on the Remove Filter icon on the toolbar. Filter by Form In the Database Table view, click into the field that you want to filter out data. Click on the Filter by Form icon. Module 5 Page 24

The table is redisplayed with a drop-down arrow beside the field that is to be filtered and the status bar contains two tabs a Look for tab and an Or tab. Select the required county from the drop-down field. If more that one option is required, click on the Or tab (a second Or tab will appear) and reselect another county on which to filter data. Click on the Apply Filter icon to display all related records. Remove Filter by Form Click on the Remove Filter icon on the toolbar. 5.4.2 Queries Create a Simple Query A query is used to search through a database to locate a particular record or records that conforms to specified criteria. These are collected into a special kind of table called a Dynaset. Queries are developed by using the Query Wizard or by directly specifying requested fields and query criteria in the Query Design view. The resulting query datasheet is not a duplication of the data that resides in the original table s datasheet but rather a logical view of the data. If changes are made in the query datasheet, the data in the underlying table is updated automatically. In the Database window, click on the Query tab. Double-click on Create Query in Design View or alternatively click on New and the New Query dialog box is displayed. Module 5 Page 25

Select the option Design View. Click on OK. The Show Table dialog box is displayed showing the tables available on which a query can be performed. Select the required table from the list. Click on Add. Click on Close to close this Show Table window. The Select Query window displays the field names belonging to the selected table in the upper part of the window and the lower half, called the query grid, is used to specify the fields to display and for what records they are to be displayed. Point and drag each field name required from the table list into a separate column in the query grid. Click in the Criteria box under the field name and type in the data on which the query is to base its selection. Table Field Names Query Grid Click on the View menu and select Datasheet to perform the query or select it from the toolbar. Alternatively, click on the Run icon from the toolbar. A Dynaset consisting of all qualifying records is displayed. Save a Query Click on the File menu. Click the option Save and give the query an appropriate name. Click on OK. Click on File menu. Click on Close. Module 5 Page 26

Run a Query From the Query Design view, click on the Run icon on the toolbar. From the Database window, click on Queries and the required query from the previously created queries and click Open. Delete a Query From the Database window, click on Queries and the required query from the previously created queries and click the Delete icon. Click on Yes to permanently delete the query. Create a Query with Multiple Criteria The criteria specified for a query can be as simple as a list of customer names or as complex as a list of all customers over the age of 40, who live in Dublin and Galway. By using expressions, combinations of field names and arithmetic operators, the numbers of records returned by a query can be restricted. The arithmetic operators used in criteria when creating queries include: greater than; < less than; = equals; >= greater than or equal to; <=less than or equal to; <> not equal to. Click into the criteria row under the required field and enter the value required to apply criteria, e.g. to find all customers who are Dublin based would entail entering the text Dublin under the field city on the criteria row in the query grid. Click on the Run icon to display all Dublin based customers. On returning to Query Design view, notice the quotation marks that Access inserts around the text Dublin. This query can be further expanded to display all Dublin based customers who contacted the office during the year 2000. Display the Query Design view and under the Date field in the criteria row, enter Between 1/1/2000 and 1/1/2001. Click the Run icon and Access will display in Datasheet format all customers living in Dublin that contacted the office between the 1 st January 2000 and 1 st January 2001. On returning to the Query Design view, notice the hash symbol (#) Access inserts around each date. Module 5 Page 27

The wildcard * can also be used to find variations of text entered. If D* is entered into the criteria row under the City field, all records will be displayed for customers living in a city that begins with the letter D, e.g. Derry, Dublin, Dundalk, etc. Between 1/1/2000 and 1/1/2001 will select specific records falling within this range of dates. Alternatively the operators >=1/1/2000 and <1/1/2001 would give the same result. In (Dublin, Galway) will select only those records that meet this criteria. To query numerical fields, use the operators >,>=,<,<= in the criteria row under the required field. Using AND and OR to Affect Query Results The AND criteria requires that both criteria be true for a record to be selected. The OR criteria only requires one of the other criteria to be true in order for the record to be selected. A combination of the above can be used in a query grid by typing directly into the criteria line in the grid. Records can be queried based on more than one criterion. In the above example, all Dublin or Galway based customers who contacted the office after the 1/1/2001 will be displayed on running the query. Find Duplicates Query A Find Duplicates query determines if there are duplicate records in a table or which records in a table share the same value. In the Database window, click on Queries and click on New. Click on the Find Duplicates Query Wizard from the New Query dialog box. Click on OK. Select the table on which to base the query from the available list. Click on Next. Module 5 Page 28

Select the fields that might have duplicates and click on Next. Select the fields to view if duplications are located and click on Next. Give the query an appropriate name. Click on Finish and the results of the Find Duplicate Query are displayed. Exercise 5.6 1. Open the database Employees. 2. Create a query on the Personnel Details table listing all those whose salary is greater than 22000. 3. Run the query and save the result as Salary greater than 22000. Add Fields to a Query In the Query Design view, click on the field name and drag onto the query grid to add that field to a query. Alternatively, double-click on the field name and it will automatically be inserted onto the grid. If the table is not displayed, click on the Show Table icon on the toolbar. Remove Fields from a Query Position the mouse over the field to be removed from the query grid. When the mouse changes shape to a black arrow pointing down, click on the Delete key or alternatively remove the tick from the show box as displayed below. Module 5 Page 29

Hide Fields in a Query In Query Design view displaying the query grid, remove the tick in the checkbox beneath the field to hide. The screen below shows the field Employee Number, which will not now be displayed when you run the query. 5.4.3 Sort Records Sort Data based on a Query In the query design grid, click into the Show box to display records in the Dynaset matching the specified criteria. Removing the tick mark in the Show box will not display that field in the Dynaset but will apply the criteria. To sort data in ascending or descending order in a query, click on the drop-down arrow in the Sort row of the field to be sorted and select either the Ascending or Descending option. Sort Order Show removed Sort Data based on Common Logical Operators In the query design grid on the sort row of the field that has a criteria set, select the sort option required. If you do not wish to show the records on which the query is based, remove the tick from the Show box. If you do not want to display records, remove the tick from Show box. Displays records where the city is Galway or the date is after the 12/5/2000. Records are sorted LastName in Ascending sequence while the City field is not displayed in the result. Module 5 Page 30

Sort a Table Select the table to sort and click on Open. Click into the field that is to be sorted. Click on the Sort Ascending or Sort Descending icon on the toolbar. Sort a Form Open the form. Click into the field that is to be sorted. Click on the Sort Ascending or Sort Descending icon on the toolbar. Exercise 5.7 1. Create a query displaying all those born between 1972 and 1975. Do not show the address field in this query. 2. Sort the query according to Salary in descending order. 3. Save the query as 1972 to 1975. Module 5 Page 31

5.5 REPORTS 5.5.1 Working with Reports Create a Report In the Database window, click on Reports. Double-click on Create report by using Wizard or alternatively, click on New. Click on the Report Wizard option. Choose the table or query where the report data will come from by clicking the drop-down list arrow and selecting required table/query. Click on OK. Select the fields required in the report from those available by clicking the field name and the Add Single Field button or the Add All Fields button to include all available fields in the report. Click Next and the Grouping dialog box is displayed. Click Next for a simple ungrouped report or select the field on which the report is to be grouped. Module 5 Page 32

The report can be sorted in a specific order by selecting the required field name from the dropdown list of field names. Click Next to select the required layout and page orientation from this dialog box. Click Next to select a suitable report style from the available options. Module 5 Page 33

Click Next and give the report a suitable name. Click Finish. Access compiles the report and displays it in the Print Preview window. Module 5 Page 34

Modify a Report Modifications to the formatting of a report such as bolding column headings or changing the alignment of fields in a column can be made in the Report Design window. The Report Design window is divided into designated areas called sections in which controls and formatting specifications are placed. Report Header - appears only at the top of the first page of the report and usually contains the report name or company logo. Page Header - appears at the top of every page (but below the report header on the first page) and usually contains the field labels. Group Header - appears at the top of each group of records ( Group is replaced by the field name). Detail - appears once for every record in the underlying datasheet and usually contains bound field text boxes. Group Footer - appears at the end of each group of records and usually contains summary information on the group of records such as total values, etc. Page Footer - appears at the end of each page and usually contains the current date and page number. Report Footer - appears at the end of the last page of the report. A Toolbox toolbar is also displayed in the Design View window. This contains tools that will be used in modifying a report. Align Fields and Format Text in Header and Detail Sections Press and hold down the Shift key and click on each of the control headings in the Page Header section of the Report Design window. Click Centre button on the Formatting toolbar. Click the Font Size drop-down arrow to increase the font size from the default size 8. Hold the Shift key down while clicking on each of the controls in the Detail section. Release the Shift key and click the Centre button. Delete a Control Click on the control to select it. Press Delete and the control is deleted. Create and Customise Headers and Footers In the Report Design view, click the Label tool on the Toolbox toolbar. Click in the Report Header section and type in an appropriate header for the report. Module 5 Page 35

Select the control and apply suitable formatting to the text such as increase font size, bold and font colour. Design View Click on the View menu and select Print Preview or alternatively click on the Preview icon. Print Preview Click the Label tool into the Report Footer section and type a descriptive footer. Select the control and apply suitable formatting as for the header. Click on the Print Preview icon to preview. Group Data in Reports using the Wizard When generating a report initially using the Report Wizard, a dialog box enquires if a grouped report is required. If fields are to be grouped within a report, select the fields from this dialog box. Click on the Summary Options button. Module 5 Page 36

Select the required function and if a Detail and Summary report is required. This will display subtotals at the end of each grouped field. Click OK and follow the wizard options as for a Simple Report. Group Data in a Report In Design view, select the Sorting and Grouping command from the View menu. Click within the Field / Expression column and select the field to apply grouping to. By default the field will be sorted into ascending order. To change this, click within the Sort Order column and choose Descending from the menu. Click on the Close icon in the top right of the dialog box to apply the grouping and sorting options. Switch back to Print Preview to see results. Delete a Report From the Database window, select the report to delete and click on the Delete icon from the toolbar. Click Yes to permanently delete the report. Module 5 Page 37

Exercise 5.8 1. Generate a report based on the Personnel Details table in the Employees database. 2. Sort the report in ascending order on the name field. 3. Preview the report. 4. Save the report as Employee Details. Exercise 5.9 1. Generate a grouped report, grouped on the Salary field. Do not show the address field in this report. 2. Preview the report and save it as Salary. 3. Modify this report and insert a header - Employees Salaries. 4. Format the header using the font style Arial, Size 16 and colour Blue. 5. Preview the report and save it. 5.6 PREPARE OUTPUTS 5.6.1 Prepare to Print Preview Select the object to preview, e.g. table, form, query or report. Click on the File menu and Print Preview. Change Report Orientation Select the report. Click on the File menu and Page Setup. From the Page tab, select the required Orientation. Change Paper Size Select the report. Click on the File menu and Page Setup. From the Page tab, select the required paper size in the Paper section. Module 5 Page 38

Print Table Options Open the table and select the required records. From the File menu, select the Print option and in the Print Range section, specify to print All or the number of pages to print or the selected records. Print from Form Open the required form. From the File menu, select the Print option and in the Print Range section, specify to print All or the number of pages to print or the selected record. Print Result of a Query Display the query that you want to print from. Click on the Print icon to print the entire query result. If only part of the query is required then select the File menu and the Print command. Within the displayed dialog box, select what you want to print. Print a Report Open the required report. From the File menu, select the Print option and within the Print Range section, specify to print All or the number of pages to print or the selected record. Module 5 Page 39