ECDL Module 5 REFERENCE MANUAL Databases Microsoft Access XP Edition for ECDL Syllabus Four - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٢PAGE © 1995-2006 Cheltenham Courseware Ltd. Crescent House 24 Lansdown Crescent Lane Cheltenham Gloucestershire GL50 2LD, UK Tel: +44 (0)1242 227200 Fax: +44 (0)1242 253200 Email: info@cheltenhamcourseware.com Internet: http://www.cheltenhamcourseware.com All trademarks acknowledged. E&OE. © Cheltenham Courseware Ltd. 1995-2006 No part of this document may be copied without written permission from Cheltenham Courseware unless produced under the terms of a courseware site license agreement with Cheltenham Courseware. All reasonable precautions have been taken in the preparation of this document, including both technical and non-technical proofing. Cheltenham Courseware and all staff assume no responsibility for any errors or omissions. No warranties are made, expressed or implied with regard to these notes. Cheltenham Courseware shall not be responsible for any direct, incidental or consequential damages arising from the use of any material contained in this document. If you find any errors in these training modules, please inform Cheltenham Courseware. Whilst every effort is made to eradicate typing or technical mistakes, we apologise for any errors you may detect. All courses are updated on a regular basis, so your feedback is both valued by us and will help us to maintain the highest possible standards. Sample versions of courseware from Cheltenham Courseware (Normally supplied in Adobe Acrobat format) If the version of courseware that you are viewing is marked as NOT FOR TRAINING, SAMPLE, or similar, then it cannot be used as part of a training course, and is made available purely for content and style review. This is to give you the opportunity to preview our courseware, prior to making a purchasing decision. Sample versions may not be re-sold to a third party. For current license information Cheltenham Courseware reserves the right to alter the licensing conditions at any time, without prior notice. No terms or conditions will affect your rights as defined under UK law. Please see the site license agreement available at: www.cheltenhamcourseware.com/agreement PLEASE NOTE: Web sites listed or illustrated within this document are purely for illustrative purposes and their inclusion does not imply endorsement by the authors or suppliers of this document. No company or organisation has paid to have their web sites or other information included within this document. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٣PAGE ECDL Approved Courseware The ECDL Foundation has approved these training materials and requires that the following statement appears in all ECDL Foundation approved courseware. European Computer Driving Licence, ECDL, International Computer Driving Licence, ICDL, e-Citizen and related logos are trade marks of The European Computer Driving Licence Foundation Limited (“ECDL-F”) in Ireland and other countries. Cheltenham Courseware is an entity independent of ECDL-F and is not associated with ECDL-F in any manner. This courseware publication may be used to assist candidates to prepare for ECDL tests. Neither ECDL-F nor Cheltenham Courseware warrants that the use of this courseware publication will ensure passing of ECDL tests. This courseware publication has been independently reviewed and approved by ECDL-F as complying with the following standard: Technical compliance with the learning objectives of ECDL syllabus 4. Confirmation of this approval can be obtained by reviewing the Courseware Section of the website www.ecdl.com The material contained in this courseware publication has not been reviewed for technical accuracy and does not guarantee that candidates will pass ECDL tests. Any and all assessment items and/or performance-based exercises contained in this courseware publication relate solely to this publication and do not constitute or imply certification by ECDL-F in respect of ECDL tests or any other ECDL-F test. For details on sitting ECDL tests and other ECDL-F tests in your country, please contact your country's National ECDL/ICDL designated Licensee or visit ECDL-F’s web site at www.ecdl.com. Candidates using this courseware publication must be registered with the National Licensee, before undertaking ECDL tests. Without a valid registration, ECDL tests cannot be undertaken and no ECDL test certificate, nor any other form of recognition, can be given to a candidate. Registration should be undertaken with your country's National ECDL/ICDL designated Licensee at any Approved ECDL test certificate Test Centre. Syllabus 4 is the official syllabus of the ECDL certification programme at the date of approval of this courseware publication. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٤PAGE ECDL APPROVED COURSEWARE ..................................................................................................................... 3 USING THE APPLICATION .............................................................................................................................. 6 DATABASE CONCEPTS ....................................................................................................................................... 6 Understanding what a database is ........................................................................................................... 6 Understanding how a database is organised.......................................................................................... 6 Understanding what a primary key is ....................................................................................................... 8 Understanding what an index is................................................................................................................ 8 Understanding the purpose of relating tables in a database ................................................................ 8 Understanding the importance of setting rules to ensure relationships are valid .............................. 8 FIRST STEPS WITH DATABASES....................................................................................................................... 11 Opening and closing Microsoft Access .................................................................................................. 11 Opening an existing database................................................................................................................. 12 Creating a new database ......................................................................................................................... 12 Saving a database to a location on a drive ........................................................................................... 14 Using Help.................................................................................................................................................. 14 Closing a database ......................................................................................Error! Bookmark not defined. ADJUSTING SETTINGS ................................................................................ ERROR! BOOKMARK NOT DEFINED. Changing between view modes in a table, form or report......................Error! Bookmark not defined. Displaying or hiding toolbars ......................................................................Error! Bookmark not defined. TABLES ............................................................................................... ERROR! BOOKMARK NOT DEFINED. MAIN OPERATIONS ..................................................................................... ERROR! BOOKMARK NOT DEFINED. Creating and saving a table and specifying fields with their data types.............Error! Bookmark not defined. Adding and deleting records in a table......................................................Error! Bookmark not defined. Adding a field to an existing table ..............................................................Error! Bookmark not defined. Adding and modifying data in a record .....................................................Error! Bookmark not defined. Deleting data in a record .............................................................................Error! Bookmark not defined. Using the Undo command ..........................................................................Error! Bookmark not defined. Navigating between records within a table...............................................Error! Bookmark not defined. Deleting a table.............................................................................................Error! Bookmark not defined. Saving and closing a table..........................................................................Error! Bookmark not defined. DEFINING KEYS .......................................................................................... ERROR! BOOKMARK NOT DEFINED. Defining a primary key.................................................................................Error! Bookmark not defined. Indexing a field without duplications allowed ...........................................Error! Bookmark not defined. TABLE DESIGN/LAYOUT ............................................................................. ERROR! BOOKMARK NOT DEFINED. Changing field format attributes .................................................................Error! Bookmark not defined. Understanding consequences of changing field size attributes in a table .........Error! Bookmark not defined. Creating a simple validation rule for number, text, date/time or currency .........Error! Bookmark not defined. Changing the width of columns in a table.................................................Error! Bookmark not defined. Moving a column within a table ..................................................................Error! Bookmark not defined. TABLE RELATIONSHIPS .............................................................................. ERROR! BOOKMARK NOT DEFINED. Creating a one-to-one or one-to-many relationship between tables ....Error! Bookmark not defined. Deleting relationships between tables ......................................................Error! Bookmark not defined. Applying rule(s) to relationships.................................................................Error! Bookmark not defined. FORMS................................................................................................. ERROR! BOOKMARK NOT DEFINED. WORKING WITH FORMS ............................................................................. ERROR! BOOKMARK NOT DEFINED. Opening a form.............................................................................................Error! Bookmark not defined. Creating and saving a form.........................................................................Error! Bookmark not defined. Using a form to enter, modify or delete records ......................................Error! Bookmark not defined. Navigating through records.........................................................................Error! Bookmark not defined. Adding and modifying text Headers and Footers within a form.............Error! Bookmark not defined. Deleting a form .............................................................................................Error! Bookmark not defined. Saving and closing a form...........................................................................Error! Bookmark not defined. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٥PAGE RETRIEVE INFORMATION .............................................................. ERROR! BOOKMARK NOT DEFINED. MAIN OPERATIONS ..................................................................................... ERROR! BOOKMARK NOT DEFINED. Using the search command to find a specific word, number or date in a field..Error! Bookmark not defined. Applying a filter to a table or form ..............................................................Error! Bookmark not defined. Removing a filter from a table or form.......................................................Error! Bookmark not defined. QUERIES ..................................................................................................... ERROR! BOOKMARK NOT DEFINED. Creating and saving a single table query and a two-table query using specific search criteria ........................................................................................................................Error! Bookmark not defined. Adding criteria to a query using operators................................................Error! Bookmark not defined. Editing a query by adding or removing criteria ........................................Error! Bookmark not defined. Editing a query by adding, removing, moving, hiding and un-hiding fields........Error! Bookmark not defined. Running a query ...........................................................................................Error! Bookmark not defined. Deleting a query ...........................................................................................Error! Bookmark not defined. Saving and closing a query.........................................................................Error! Bookmark not defined. SORTING RECORDS ................................................................................... ERROR! BOOKMARK NOT DEFINED. Sorting data in a table, form or query, in ascending/descending and numeric/alphabetic order ........................................................................................................................Error! Bookmark not defined. REPORTS............................................................................................ ERROR! BOOKMARK NOT DEFINED. WORKING WITH REPORTS.......................................................................... ERROR! BOOKMARK NOT DEFINED. Creating and saving a report based on a table or query ........................Error! Bookmark not defined. Changing the arrangement of data fields and headings within report layout ....Error! Bookmark not defined. Grouping data under a specific heading (field) in a report in ascending or descending order Error! Bookmark not defined. Presenting specific fields in a grouped report at appropriate break points........Error! Bookmark not defined. Adding and modifying Headers and Footers in a report.........................Error! Bookmark not defined. Deleting a report...........................................................................................Error! Bookmark not defined. Saving and closing a report ........................................................................Error! Bookmark not defined. PREPARING OUTPUTS ................................................................... ERROR! BOOKMARK NOT DEFINED. PREPARING TO PRINT ................................................................................ ERROR! BOOKMARK NOT DEFINED. Previewing a table, form or report..............................................................Error! Bookmark not defined. Changing report orientation and paper size .............................................Error! Bookmark not defined. PRINT OPTIONS .......................................................................................... ERROR! BOOKMARK NOT DEFINED. Printing a page, selected record(s) or a complete table.........................Error! Bookmark not defined. Printing all records using form layout or specific pages using form layout........Error! Bookmark not defined. Printing the result of a query.......................................................................Error! Bookmark not defined. Printing specific page(s) of a report or a complete report ......................Error! Bookmark not defined. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٦PAGE Using the Application Database Concepts Understanding what a database is What is data? • • • • Data is made up of text, numbers, images and in some cases sounds which can be processed or stored by a computer. By itself data might not mean very much. In order to understand it, it needs to be interpreted (or processed) to become information. Information is the meaning given to data by the way in which it is interpreted. To illustrate the difference, Murray, 15000 and 10 mean little as data. But if we were able to interpret them as the name of a salesman, Murray, his annual basic salary of $15,000 and his commission rate of 10%, it would assume more meaning and could be called information. This is not necessarily the end of the story as this information could be included in another set of data and used to provide other information. Alternatively, the same data could be interpreted in another way. It is often helpful to think of data as the raw ingredients of a recipe which when processed and mixed in different amounts by differing techniques produce different results. What is a database? • A simple definition of a database is: A structured collection of related data about one or more subjects. In normal daily life we make frequent use of databases, and probably don’t realise it. Here are a number of simple examples: - The telephone directory - Bus or train timetable - Personal address book - Filing cabinet What is a relational database? • A simple relational database, such as Microsoft Access, is a database which is based on tables. Each column within a table defines the fields, while each row defines the records. Different related data can be held in separate tables. For instance information about suppliers can be held in one table, while information about products can be held in a separate table. Understanding how a database is organised FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٧PAGE What is a table? • A table holds data about a particular item, such as products or suppliers. What is a record? • A record is a collection of information which relates to a particular item within your database table. For instance a record in an address book may consist of the first and second name of a person, plus their phone number and address details. Each item within a record is called a field. What is a field? • Fields are the individual items which make up a record within your database. In the example of an address book database, first and second names of your contacts would both be field names, as would the telephone number. What is meant by 'Field data types'? • A field must have a specific data type format. We will see more about this later, but for now the illustration shows you the data types which are available within Microsoft Access, including Text, Number, Currency etc. What is meant by 'Field properties'? • Each field has a range of field properties associated with it. For instance the Field Size (set to 50 in the example shown), means that the field will hold a maximum of 50 characters. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٨PAGE Other properties include items such as data validation, which means that the sort of information which is being entered into a field makes sense! Understanding what a primary key is What is a primary key? • Primary keys uniquely identify each record in your table and provide the following advantages: - An index is automatically created for the primary key. This speeds up data retrieval and sorting. Also, the primary key is often used in establishing relationships. - Records in a form or Datasheet are displayed in primary key order. - Duplicate records are not allowed. Therefore all records are unique - A primary key can be made up of one or more fields. Understanding what an index is What is an index? • An index allows Microsoft Access to work faster when finding and sorting records. They work in a similar way to the way you would use an index in a traditional book, i.e. Access uses the index to find the location of the required data. Indexes can be created using a single field, or using multiple fields. Understanding the purpose of relating tables in a database Why relate tables? • When using Access you normally set up a number of tables, such as Customers, Products, Orders, Employees etc. The next stage is to define relationships between these tables so that the information within each table can be linked with the information in the other tables. Once these table relationships are defined we can create queries, forms and reports to display information which is actually spread across several tables. Understanding the importance of setting rules to ensure relationships are valid FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL٩PAGE Design and document your database! • It is extremely important to spend time designing your database as time spent here will often pay dividends later on in the process, as you know where you are going and what you are trying to do. How do you know if you’ve got there if you don’t know where you are going? Questions to ask yourself • When setting out on the difficult design stage of producing the database there are a number of questions which you should ask yourself or your user. What do I want?: You must first establish why you require your database and what you expect to get from it. It is most important to define your output needs first. Mistakes are often made because people try to decide what to put into their database before they know what they want from it. What have I got?: Knowing what you want then allows you to look critically at what data you have and make decisions as to how it should be structured in terms of fields and tables. What do I need to do?: This question asks you to look at any manipulation you need to carry out in order to achieve your information output: searches, sorts, and calculations. Define your needs • • In order to clarify your needs it is often useful to draw a simple diagram and/or write a short narrative. If the database is being designed for others, show them your sketch/narrative and use it to check your understanding of their requirements. Example: C.C.Toys is a retailer of toys for children of all ages. It buys its toys from a number of suppliers. It employs four staff. The store is laid out according to themes under a number of categories (e.g. Soft toys, Games Software etc.). Orders to suppliers can be for either single or multiple products. The illustration below shows the tables needed for C.C. Toys. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٠PAGE RI E PRODUCTS S ORDERS EMPLOYEES SU PP L IE RS CA TE G O C.C. Toys Basic design rules • If you stick to a set of rules when designing your database, it will make your life much easier when using the database! Make each record unique: Each table should be allocated a primary key. A primary key is simply a field or a combination of fields which makes a record unique. Give your table a primary key to ensure you have no duplicate records. Select the primary key yourself. If you let Access define the primary key, it will add a counter field at the beginning of each record. The counter will be incremented on every new record added to the table. Although this guarantees the uniqueness of the record, it does mean that two records could contain identical data (apart from the key itself). Make each field unique: If you have repeated the same kind of information in a table, you should put it into another table. Make fields functionally dependent: Each field in the record should relate to the subject of the record. If it doesn't, it's either redundant or it belongs in another table! Ensure each field is independent: You should be able to alter any one field in a record without affecting any of the others. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١١PAGE Ensure fields don’t contain calculated or derived data: As an example, you need only hold gross pay and deductions on a person's salary record. Net pay can be calculated when it is required, when printing the pay slip for instance. Ensure data is in its smallest logical parts: It might be useful, for instance, to keep customers' postcodes separate from the rest of their addresses so that you can analyze sales based on postal regions. First Steps with Databases Opening and closing Microsoft Access To start Access • • • Click on the Windows Start icon. Click on All Programs. Click on the Microsoft Access icon from within the submenu displayed. To close Microsoft Access • Click on the application's Close icon, at the top-right of the application window. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٢PAGE Opening an existing database To open a database • Click on the File drop down menu and select the Open command, the Open dialog box will be displayed. Select the database you wish to open and then click on the Open button. Creating a new database To create a new database • Click on the File drop down menu & select the New command. This allows you to open an existing database, or it gives you options for creating a new database. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٣PAGE • Blank Database: Allows you to create a new, blank database. New from template: Allows you to create a database using a pre-existing template, such as a template for creating an Expenses database (as illustrated). General Templates: Displays the Templates dialog box allowing to the select from a wide range of Access templates. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٤PAGE • Once you have selected the type of database you wish to create the File New Database dialog box will be displayed. • Enter a name for your new database into the File name box and click on the Create button. Saving a database to a location on a drive To save a database • Choose Save from the File menu OR click on the Save icon located on the toolbar. To save a database file to a diskette • There is no easy way within the Access application to save a database opened from the hard disk to a floppy disk. However, you may use the Windows Explorer to copy a file to your floppy disk. • • Start the Windows Explorer program. Select the database file on your hard disk which you wish to copy to a floppy disk. Right click on the file and select Send To 3 1/2" Floppy command. • Using Help FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٥PAGE What is the Microsoft Office Assistant? • By default this friendly little creature, will watch what you do and offer tips on how to work more productively. You can ask it questions in plain English! Occasionally the Office Assistant will display information on the screen. If you are unsure about how to use this product you should always read the help offered. You can choose to implement the tip, have it explained, or to ignore the tip. To display the Microsoft Office Assistant • Select the Show the Office Assistant command from the Help drop down menu. To hide the Microsoft Office Assistant • Right click on the Office Assistant and from the menu displayed, click on the Hide command. To disable the Microsoft Office Assistant • • Right click on the Office Assistant and from the menu displayed, click on the Options command. De-select the Use the Office Assistant option. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٦PAGE • Click on the OK button. To use "What is this" Help • Within many dialog boxes you will find a question mark symbol in the topright corner of the dialog box. For instance click on the Tools drop down menu, select the Options command and this will display the Options dialog box with this sort of help enabled. Not all dialog boxes have this feature. To use "What is this", click on the question mark and then click on the item in the dialog box which you do not understand. • In the example shown we have opened the Column Width dialog box and displayed the "What is this" help for the Standard Width check box. • You will also find ‘What’s This’ Help under the Help drop down menu, this works in the same way. FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com - ECDL MODULE 5 (USING OFFICE XP) - MANUAL١٧PAGE The Help drop down menu • Click on the Help drop down menu and select the command which you require. Remember that if you move the mouse arrow to the down arrow at the bottom of the menu, the menu will expand to show all available commands, as illustrated. Help Menu - Microsoft Access Help command • Click on Help drop down menu and select the Microsoft Access Help command. By default this will display the Microsoft Access Help window. • If the Office Assistant has been enabled selecting the Microsoft Access Help command will display the Office Assistant FOR USE AT THE LICENSED SITE(S) ONLY © Cheltenham Courseware Ltd. 1995-2006 www.cheltenhamcourseware.com