VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION ....

233
WWP Learning and Development Page i MICROSOFT ACCESS VERSION 2010 FOUNDATION

Transcript of VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION ....

Page 1: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development Page i

MICROSOFT ACCESS VERSION 2010 FOUNDATION

Page 2: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Contents

WWP Learning and Development LTD

CONTENTS CONTENTS .................................................................................................................................................................. II

LESSON 1 – EXPLORING ACCESS .................................................................................................................................. 1

DATABASES OVERVIEW ......................................................................................................................................................... 2 OPENING AN EXISTING DATABASE .......................................................................................................................................... 4 CONVERTING EXISTING DATABASES ......................................................................................................................................... 5 THE ACCESS WINDOW ......................................................................................................................................................... 6 USING DATABASE OBJECTS.................................................................................................................................................... 7 USING THE OBJECT WINDOW ................................................................................................................................................ 7 DIALOG BOXES AND TASK PANES ............................................................................................................................................ 9 WORKING WITH NAVIGATION PANE ....................................................................................................................................... 9 EXITING ACCESS ................................................................................................................................................................ 12 SECURITY WARNINGS ......................................................................................................................................................... 12 EXERCISE ......................................................................................................................................................................... 14

Exploring Access ....................................................................................................................................................... 14

LESSON 2 - CREATING DATABASE TABLES .................................................................................................................. 15

OVERVIEW ....................................................................................................................................................................... 16 PLANNING DATABASE TABLES .............................................................................................................................................. 18 METHODS FOR CREATING TABLES ........................................................................................................................................ 19 CREATING TABLES IN DESIGN VIEW ....................................................................................................................................... 20 DATA TYPES ..................................................................................................................................................................... 22 EDITING TABLE STRUCTURE IN DESIGN VIEW .......................................................................................................................... 24 SETTING A PRIMARY KEY .................................................................................................................................................... 25

Exercise .................................................................................................................................................................... 26 Creating Tables........................................................................................................................................................................ 26

LESSON 3 - WORKING WITH DATA IN TABLES ............................................................................................................ 27

INTRODUCTION ................................................................................................................................................................. 28 NAVIGATING FIELDS IN TABLES ............................................................................................................................................ 28 ADDING RECORDS ............................................................................................................................................................. 29 SELECTING ENTIRE RECORDS ................................................................................................................................................ 30 EDITING RECORDS ............................................................................................................................................................. 30 SAVING RECORDS .............................................................................................................................................................. 31 DELETING RECORDS ........................................................................................................................................................... 32

Exercise .................................................................................................................................................................... 33 Working with Tables ............................................................................................................................................................... 33

LESSON 4 - SETTING FIELD PROPERTIES ..................................................................................................................... 34

INTRODUCTION ................................................................................................................................................................. 35 LIMITING FIELD SIZE ........................................................................................................................................................... 36 SETTING NUMBER FORMATS ............................................................................................................................................... 38 SETTING DATE/TIME FORMATS ............................................................................................................................................ 39 SETTING YES/NO FORMATS ................................................................................................................................................. 40 SETTING DEFAULT VALUES .................................................................................................................................................. 41 VALIDATION RULES ............................................................................................................................................................ 42 CREATING AN INPUT MASK – WIZARD .................................................................................................................................. 44 CREATING AN INPUT MASK – MANUALLY .............................................................................................................................. 46 CREATING A CUSTOM INPUT MASK ...................................................................................................................................... 47 CREATE A LOOKUP LIST USING THE LOOKUP WIZARD ............................................................................................................... 48 MODIFYING LOOKUP PROPERTIES ......................................................................................................................................... 54 SETTING A SMART TAG FOR A FIELD ...................................................................................................................................... 57

Exercise .................................................................................................................................................................... 59 Setting Field Properties ........................................................................................................................................................... 59

Page 3: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Contents

WWP Learning and Development LTD

LESSON 5 – VIEWING & FORMATTING DATASHEETS .................................................................................................. 61

INSERTING COLUMNS ......................................................................................................................................................... 62 MOVING A COLUMN ......................................................................................................................................................... 63 CHANGING A COLUMN NAME ............................................................................................................................................. 63 DELETING A COLUMN ........................................................................................................................................................ 64 ADJUSTING ROW HEIGHT .................................................................................................................................................... 65 CHANGING THE COLUMN WIDTH ......................................................................................................................................... 66 FORMATTING A DATASHEET ................................................................................................................................................ 68 CHANGING A FONT ATTRIBUTE ............................................................................................................................................ 69 HIDING COLUMNS ............................................................................................................................................................. 70 UNHIDING COLUMNS ......................................................................................................................................................... 71 FREEZING A COLUMN ......................................................................................................................................................... 72 UNFREEZING A COLUMN .................................................................................................................................................... 73 ADDING A TOTALS ROW TO A TABLE ..................................................................................................................................... 74

Exercise .................................................................................................................................................................... 77 Viewing and Formatting Datasheets ....................................................................................................................................... 77

LESSON 6 - ORGANISING TABLE DATA ....................................................................................................................... 78

SORTING RECORDS ............................................................................................................................................................ 79 MULTIPLE LEVEL SORTING ................................................................................................................................................... 79 CLEARING A SORT ORDER ................................................................................................................................................... 80 FINDING SPECIFIC RECORDS ................................................................................................................................................. 81 FINDING RECORDS USING WILDCARDS .................................................................................................................................. 82 CARRYING OUT AN INSTANT SEARCH ..................................................................................................................................... 83 USING REPLACE ................................................................................................................................................................ 83 THE FIELD FILTER LIST ........................................................................................................................................................ 84 USING FILTER BY SELECTION ................................................................................................................................................ 86 FILTERING BY FORM........................................................................................................................................................... 87

Exercise .................................................................................................................................................................... 90 Organising Table Data ............................................................................................................................................................. 90

LESSON 7 - USING SIMPLE QUERIES ........................................................................................................................... 91

INTRODUCTION ................................................................................................................................................................. 92 THE QUERY WIZARD .......................................................................................................................................................... 92 CREATING A QUERY IN DESIGN VIEW .................................................................................................................................... 94 OPENING A QUERY ............................................................................................................................................................ 95 RUNNING A QUERY ........................................................................................................................................................... 96 ADDING A TABLE TO A QUERY ............................................................................................................................................ 97 JOIN TYPES IN A QUERY ...................................................................................................................................................... 98

Exercise .................................................................................................................................................................. 101 Using Simple Queries ............................................................................................................................................................ 101

LESSON 8 - MODIFYING QUERY RESULTS ................................................................................................................. 102

SORTING A QUERY .......................................................................................................................................................... 103 ADDING SIMPLE CRITERIA TO A QUERY ............................................................................................................................... 104 HIDING A FIELD IN A QUERY ............................................................................................................................................. 105 ADDING NEW RECORDS AND EDITING DATA IN A QUERY ........................................................................................................ 106 PRINTING A QUERY ......................................................................................................................................................... 106

Exercise .................................................................................................................................................................. 108 Modifying Query Results ....................................................................................................................................................... 108

LESSON 9 - CREATING BASIC FORMS ........................................................................................................................ 109

OVERVIEW ..................................................................................................................................................................... 110 USING FORM TOOLS TO CREATE A FORM ............................................................................................................................. 110 USING THE FORM WIZARD ............................................................................................................................................... 114 NAVIGATING RECORDS IN A FORM ...................................................................................................................................... 118 PRINTING RECORDS IN A FORM ......................................................................................................................................... 118 WORKING WITH DATA IN A FORM ...................................................................................................................................... 120

Page 4: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Contents

WWP Learning and Development LTD

Exercise .................................................................................................................................................................. 123 Creating Basic Forms ............................................................................................................................................................. 123

LESSON 10 - EDITING FORMS AND REPORTS IN LAYOUTS ........................................................................................ 124

OVERVIEW ..................................................................................................................................................................... 125 MOVING AND SIZING CONTROLS ON A LAYOUT ..................................................................................................................... 126 ADDING AND DELETING CONTROLS ON A LAYOUT .................................................................................................................. 128 CREATING A TABULAR LAYOUT ........................................................................................................................................... 129

Exercise .................................................................................................................................................................. 131 Manipulating Forms in Layout View ...................................................................................................................................... 131

LESSON 11 - EDITING FORMS AND REPORTS IN DESIGN VIEW ................................................................................. 132

INTRODUCTION ............................................................................................................................................................... 133 THE RULER ..................................................................................................................................................................... 134 THE SNAP TO GRID FEATURE ............................................................................................................................................. 135 DISPLAYING THE FIELD LIST ............................................................................................................................................... 135 ADDING A FIELD ............................................................................................................................................................. 136 MOVING PART OF A PAIRED CONTROL................................................................................................................................ 137 ALIGNING CONTROLS ....................................................................................................................................................... 138 SPACING CONTROLS ......................................................................................................................................................... 139 ADDING A LABEL CONTROL................................................................................................................................................ 140 ADDING AN IMAGE .......................................................................................................................................................... 141 LINES AND RECTANGLES ................................................................................................................................................... 143 EDITING A LABEL ............................................................................................................................................................. 144 USING MULTIPLE UNDO/REDO IN DESIGN VIEW ................................................................................................................... 144

Exercise .................................................................................................................................................................. 146 Using Design View ................................................................................................................................................................. 146

LESSON 12 - CREATING BASIC REPORTS ................................................................................................................... 147

INTRODUCTION ............................................................................................................................................................... 148 USING REPORT TOOLS TO CREATE A REPORT ........................................................................................................................ 148 USING THE REPORT WIZARD ............................................................................................................................................. 149 VIEWING REPORTS .......................................................................................................................................................... 154 PRINTING A REPORT ........................................................................................................................................................ 156 GROUPING AND SUMMARISING REPORT DATA ..................................................................................................................... 157

Exercise .................................................................................................................................................................. 165 Creating Basic Reports .......................................................................................................................................................... 165

LESSON 13 - FORMATTING CONTROLS IN FORMS AND REPORTS ............................................................................. 166

INTRODUCTION ............................................................................................................................................................... 167 CHANGING THE FONT ...................................................................................................................................................... 167 CHANGING THE CHARACTER FORMAT ................................................................................................................................. 168 CHANGING THE FONT COLOUR .......................................................................................................................................... 169 CHANGING BACKGROUND COLOURS ................................................................................................................................... 170 FORMATTING LINES AND BORDERS (SHAPE OUTLINE) ............................................................................................................ 171 APPLYING SPECIAL EFFECTS ............................................................................................................................................... 172 USING THE FORMAT PAINTER ............................................................................................................................................ 172 USING THEMES ............................................................................................................................................................... 173 RUNNING THE SPELL CHECKER ........................................................................................................................................... 174 SETTING AUTOCORRECT OPTIONS ...................................................................................................................................... 175 ADDING AUTOCORRECT ENTRIES ........................................................................................................................................ 176

Exercise .................................................................................................................................................................. 178 Formatting Controls .............................................................................................................................................................. 178

LESSON 14 - WORKING WITH HELP .......................................................................................................................... 179

SEARCHING FOR GENERAL HELP ......................................................................................................................................... 180 ACCESSING HELP ON SPECIFIC TOPICS.................................................................................................................................. 181 SCREENTIPS ................................................................................................................................................................... 182

Exercise .................................................................................................................................................................. 184

Page 5: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Contents

WWP Learning and Development LTD

Using Help ............................................................................................................................................................................. 184

LESSON 15 - CREATING RELATIONSHIPS ................................................................................................................... 185

INTRODUCTION ............................................................................................................................................................... 186 CREATING A RELATIONSHIP BETWEEN TABLES....................................................................................................................... 187 SETTING REFERENTIAL INTEGRITY ........................................................................................................................................ 188 VIEWING SUBDATASHEETS ................................................................................................................................................ 189 DELETING A RELATIONSHIP ............................................................................................................................................... 192

Exercise .................................................................................................................................................................. 194 Creating Relationships .......................................................................................................................................................... 194

LESSON 16 - USING OPERATORS IN QUERIES ........................................................................................................... 195

INTRODUCTION ............................................................................................................................................................... 196 USING AN AND CONDITION ............................................................................................................................................. 197 USING AN OR CONDITION ................................................................................................................................................ 198 USING THE BETWEEN AND OPERATOR ................................................................................................................................ 199 USING THE EXPRESSION BUILDER ....................................................................................................................................... 200 USING A WILDCARD CHARACTER........................................................................................................................................ 202

Exercise .................................................................................................................................................................. 204 Using Operators in Queries ................................................................................................................................................... 204

LESSON 17 - ADVANCED QUERIES ............................................................................................................................ 205

SET TOP VALUES IN A QUERY ............................................................................................................................................. 206 CREATING A CALCULATED FIELD ......................................................................................................................................... 207 FORMATTING A CALCULATED FIELD .................................................................................................................................... 208 CREATING A FUNCTION QUERY .......................................................................................................................................... 209 CREATING A PARAMETER QUERY........................................................................................................................................ 210 CREATING A CONCATENATION IN A QUERY .......................................................................................................................... 211 ADDING A CALCULATED FIELD TO A TABLE ............................................................................................................................ 212

Exercise .................................................................................................................................................................. 214 Designing Advanced Queries................................................................................................................................................. 214

APPENDIX A - USING THE LABEL WIZARD ................................................................................................................ 215

APPENDIX B - EXCHANGING DATA WITH EXCEL ....................................................................................................... 219

INDEX ...................................................................................................................................................................... 225

Page 6: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Training Page 1

LESSON 1 – EXPLORING ACCESS

In this lesson, you will learn how to:

• Understand concepts of databases

• Open an existing database

• Convert existing databases

• Use the Access window

• Use database objects and the object window

• Use dialog boxes and task panes

• Work with the Navigation Pane

• Exit Access

• Understand security warnings

Page 7: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 2

DATABASES OVERVIEW

Introduction A database is any collection of information organised into a group. For example, a telephone book is a non-computerised database of information. It is organised in alphabetical order and includes information such as names, addresses, and telephone numbers. Other examples of non-computerised databases include address books and inventory lists.

Electronic databases can be maintained on a computer. Computerised databases allow you to manipulate large amounts of data quickly and easily. They simplify tasks such as searching for specific data, organising and sorting data, and making corrections or changes to data.

In Access 2010, the database information is stored in data tables. Every data table has a structure that provides for the collection, organisation, storage, and retrieval of data. These tables of information are contained in a database file. Each database file can have numerous data tables.

An Access table

A data table consists of fields and records. Fields are categories of information. For example, in an address table, you may maintain names, addresses, towns and cities, counties and post codes. Each of these categories is a field in the address database.

The set of fields containing the data for a single entry is called a record. For example, Charles Hardy, 12 High St., Bridgnorth, Salop, BN3 0SS is a record in the address data table. Each piece of information in the record is stored in a field and is referred to as a field value. Salop is the field value for the County field in this particular record. An address table would most likely consist of a number of records, and the data values for each record would be stored in the appropriate fields.

Access is a relational database application. A relational database contains a large amount of data that is split into numerous tables; each table should include only the information pertinent to one subject, such as Customer, Orders, or Products. As a result, each table is smaller; more manageable; and, in turn, more efficient. These tables can then be joined together to make them related. When tables are related, you can access information from any field in any related table, eliminating the need to add the same information to more than one table. You can create reports, forms, and queries from data stored in any related table.

Page 8: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 3

Additionally, Office.com (part of the Microsoft website: http://office.microsoft.com/en-gb/) provides an online link to resources you can use to create better databases, such a projects and templates.

More links on Office.com take you to pages where you can take advantage of technical resources, hints and tips, training and free product enhancements for all Microsoft Office programs.

Procedure 1. To launch Access, click the Start button. 2. If Access is listed, click the icon. 3. Otherwise, move the mouse cursor to All Programs 4. Move to Microsoft Office. 5. In the list, click on Microsoft Access 2010. The opening screen of Access is

displayed.

All programs Microsoft Office menu

Page 9: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 4

Access 2010 opening screen

OPENING AN EXISTING DATABASE

Discussion When you want to work with an Access database, you must first load the database file into memory. This process enables you to open all the tables and/or other objects within that database.

If you want to protect the original version of a database from modifications, you can use the Open dialog box to open a copy of the database or the database as read-only. Only one Access database can be open at any time.

Procedure 1. To open a database from the Access 2010 opening screen, select the file in the

Recent pane.

2. If the file is not visible, click Open . 3. In the Open dialog box, locate the file you want to open. 4. Select the file. 5. Click the Open button.

The Open dialog box (Windows 7) Open button menu

Page 10: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 5

CONVERTING EXISTING DATABASES

Discussion When you open a database that was created in Access 2000, 2002(XP) or 2003, it is held at that version and new 2010 features that cannot be displayed by or converted into the previous versions are disabled on the Ribbon.

Database created in older version of Access displayed on the Title Bar

Disabled commands on the Table tab

You can still work with an older database in Access 2010, and when you save changes and close it, it will retain its original format. It’s only some of the new features that you won’t be able to use.

There are no issues with opening and using a database created in Access 2007.

If you wish to make use of the new 2010 features in an Access 2000, 2002(XP) or 2003 database, you need to upgrade it to the Access 2010 file format. Beware doing this if you are sharing the database with colleagues who are still using the older version of Access. Once a database has been upgraded to the new version, it can no longer be opened in the older version.

If you open a database that was created in a version earlier than 2000, a dialog box is displayed advising you to upgrade it. If you proceed without upgrading it, you will not be able to make any design changes or create new objects, eg. queries, forms and reports.

Procedure 1. To convert an Access 2000, 2002(XP) or 2003 database to version 2010, first open the

database you wish to convert.

2. Select the File tab .

Page 11: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 6

3. Click Save & Publish . 4. Under Save Database As: select Access Database (*.accdb).

5. Click the Save As button . 6. In the File name: box, type a name for the file. 7. The Save as type: will already have been set to Microsoft Access Database

(*.accdb). 8. Click Save. A message box informs you that the database, having been converted,

can no longer be used with earlier versions of Access. 9. Click OK.

THE ACCESS WINDOW

Procedure When you open a database, the Access window is displayed with a Navigation pane at the left showing the database objects; the default setting displays tables only. The main area displays the content of the database object which is being used at the time.

Across the top of the screen are the Quick Access Toolbar, the Title Bar and the Ribbon. Each of the Ribbon tabs display a series of groups containing commands.

Ribbon

Status Bar

Current object (Table, Query, Form, etc.)

Quick Access Toolbar

Navigation Pane

Title Bar

Groups

Tabs

Page 12: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 7

USING DATABASE OBJECTS

Discussion An Access database file can contain objects such as tables, queries, forms, reports, macros, and modules. Database objects are created to input, edit, retrieve, display, and print data. You can include up to six different object types in an Access database. A description of each of these object types is listed in the following table:

Object Type Object Purpose

Table This object type defines the structure of an Access database. Tables display multiple records in rows and columns. Information in these records can be entered, edited, stored, and retrieved.

Query A way of requesting selected information from a table. When you run a query, a selected set of records, called a dynaset, appears. You can then edit or print the dynaset.

Form A screen display you can create to show selected fields in a record. Forms allow you to enter, view, and edit data. You can use a form as an alternative to displaying data in rows and columns.

Report A design for printed data. Reports can include lists and mailing labels, as well as database reports. Reports can also perform mathematical operations and calculate summaries.

Macro A stored set of Access commands that can be repeated as a unit to automate database functions.

Module This object type stores Visual Basic for Applications Edition programming code that can be used to further customise and enhance database functions.

USING THE OBJECT WINDOW

Discussion By default, Access 2010 displays objects (tables, queries, forms, etc.) in tabs along the top of the work area.

Database objects displayed as “tabbed documents”

If the window is too small to display all the tabs, a “Scroll to next tab” arrow appears at the

right .

To close an object, click the Close “<object”> button at the right of the tabs .

Page 13: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 8

If, however, you have opened a database that was created or has been converted from a pre-2007 version of Access, any open objects will open in their own window and “stack” on top of each other.

Database objects displayed as “overlapping windows”

If you want to work with overlapping windows, you may find it easier to resize or move the window(s). You can use the sizing button at the top right of a window to resize it, or the mouse cursor to resize and move the windows around the screen.

Maximising a window Restoring a window Resizing a window

Tip

You can change between tabbed windows and overlapping windows using Access Options. Select the File tab, click Options, select the Current Database pane and make your selection under Document window options.

Page 14: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 9

DIALOG BOXES AND TASK PANES

Discussion Task Panes and Dialog Boxes are separate windows that display to provide you with additional tools and functionality. Some open automatically when you carry out a tasks or give a command by clicking a button on the Ribbon.

For example:

The Find & Replace dialog box appears when you click the Find button .

……or the Clipboard task pane that appears when you click the Clipboard “Dialog Launcher” on the Ribbon .

WORKING WITH NAVIGATION PANE

Discussion As well as allowing you to open the various objects stored in a database, the Navigation Pane also allows you to carry out some basic tasks on the objects themselves. Depending on the object type, you can open, design, cut and copy, rename, hide, and delete it.

Page 15: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 10

Commands available for a table

By default, the Navigation Pane displays just the database tables but by clicking the View

button , you can use built-in sort orders, groupings and filters to display the database objects in a variety of combinations. A few examples are given below:

Tables only Grouped by all Access Grouped by all objects with objects tables group expanded

You can hide and unhide the Navigation Pane by clicking the Shutter Bar Open/Close button.

Page 16: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 11

More options on how the Navigation Bar displays its objects can be accessed by right-clicking its Title Bar. This offers commands for viewing the objects (Details, Icon, List); opening the Navigation Options… dialog box; and adding a Search Bar for quickly finding objects by name.

Customising the Navigation Pane view

Using the Navigation Pane Search Bar

The Navigation Pane Options dialog box

Procedure 1. In the Navigation Pane, double click on an object to open it for use or, right click

the required object and select Open in the shortcut menu. 2. To carry out tasks on an object, right click the object and select an action from the

shortcut menu. Commands available will depend on the object. 3. To group, sort and filter the way that objects are displayed in the Navigation Pane,

click the View button on its Title Bar or right click the Title Bar and select from the shortcut menu.

4. To hide the Navigation Pane, click the Shutter Bar Open/Close button .

5. To unhide the Navigation Pane, click the Shutter Bar Open/Close button .

Page 17: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 12

EXITING ACCESS

Discussion In order to be efficient, you should close any objects you are not using before exiting Access. You can have several objects open at once, but multiple objects use more system resources. Changes to databases are saved automatically when you close the Database window.

In addition, when you have finished using Access, you should exit the application properly, since Access performs necessary housekeeping before it closes. If a database object has been modified, but not saved, an Access dialog box prompts you to save the changes before exiting.

You can also close an object or database by clicking the Close button on the applicable window title bar.

Procedure 1. To exit Access, first ensure all objects have been closed. 2. Click the Close button in the top right of the application window.

Or

3. Select the File tab and then click the Exit button.

SECURITY WARNINGS

Discussion When you open a database on your computer for the first time, you will be prompted with a security alert. The security alert takes the form of a yellow bar that opens below the Ribbon. To enable macros in the database, click the Enable Content button. Once you have enables

Page 18: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 13

the content, Access regards treats the database as “trusted” and will not prompt you again to enable content.

If you are unsure whether to enable the content or not, take advice from your IT deparment. It is usually possible to carry out most database tasks without enabling the content.

Procedure To enable macros when you open a database, click the Enable Content button in the Security Warning below the Ribbon.

Page 19: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 1 – Exploring Access

WWP Learning and Development LTD Page 14

EXERCISE Exploring Access

1. Start Access, if necessary. 2. Open Train01. 3. Select the Queries, Forms, and Reports object types to view the objects in each;

then, reselect the Tables object type. 4. Open the Client table. 5. Display the Table Tools - Fields tab. 6. Display the Home tab. 7. Close the Client table. 8. Open the Client form. 9. Close the Navigation Pane. 10. Open the Navigation Pane. 11. Close the Client form 12. Close the database.

Page 20: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 15

LESSON 2 - CREATING DATABASE TABLES

In this lesson, you will learn how to:

• Plan database tables

• Create tables

• Use Design View

• Add field names

• Assign data types

• Add a field description

• Set a primary key

• Edit table structure

Page 21: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 16

OVERVIEW

Discussion When you create a database in Access, you are creating a container for related tables, forms, queries, reports and other database objects. You can create a new database manually or with the help of a database template.

If you create a new database manually, you must then create your own tables, queries, and other objects. This method provides the most flexibility and because you are creating all the objects from scratch, it is easier to understand how the database fits together and the purpose of each object.

A database template provides predefined fields, tables, queries, and other objects. Many templates are Microsoft created while others are uploaded to Office.com by members of the Microsoft Community.

Access database templates are very well designed but can be quite complex and contain advanced objects making it difficult for an inexperienced Access user to understand, use and customise. They can be, however, an excellent way of learning about database design and offer good examples for ideas and techniques to try on your own databases.

Starting a new database

Procedure To create a blank database

1. Launch Access or, if you are already working on a database, select the File tab and

click New . 2. Blank Database is selected by default. 3. At the right under Blank Database, type a name for the new database in the File

Name: box.

Custom templates created by yourself

Blank databases

Recently used templates

Microsoft templates loaded on your computer when Office was installed

Downloadable templates on Office.Com (Microsoft website)

Page 22: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 17

4. To change the location of the file from the default, click Browse for a location to put your database (next to the File Name: box), navigate to the new location, and then click OK.

5. Click Create.

To create a database using a template

1. Launch Access or, if you are already working on a database, select the File tab and

click New . 2. Several sets of templates are available: Some are built into Access - Sample

Templates ; others can be downloaded from the Microsoft website -

Office.com , and others may be custom templates that

you have created and saved yourself - My Templates . 3. If you select a folder of Sample Templates (eg. Events or Faculty) or a folder of

Office.com templates (eg. Education of Finance), you can return to see the whole collection using the Back or Home buttons at the top of the pane.

Education templates on Office.com

Page 23: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 18

4. Select the template that you want to use. The template icon appears in the pane on the right, just above the File Name: box.

5. Access suggests a file name for your database in the File Name: box — you can

change the file name if you want. To save the database in a different folder from the one displayed below the file name box, click , browse to the folder in which you want to save it, and then click OK. Optionally, you can create and link your database to a SharePoint Foundation site. NB: Although they both use SharePoint, a desktop database linked to a SharePoint site is not the same as a web database using Access Services. To use a desktop database, you must have Access installed. A web database can be used with a web browser.

6. Click Create.

PLANNING DATABASE TABLES

Discussion In Access, there are five steps to designing a table. The first step is to develop a thorough understanding of the system, including all the data to be entered and all the reports, statistics, labels, and other output you want to generate. This process serves two purposes. First, these forms and reports are invaluable when you begin detailing exactly what information you want stored in each table. Second, once you have collected a set of these forms, you can make sure that every item of information on your reports is either included in your database or can be derived from data in your database.

The second step is to determine how many tables you need and what information to store in each table. Once you have gained an overview of the system, you are ready to begin designing your database. The most important decision you must make before you begin creating tables is how many tables you want the database to include.

Page 24: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 19

The third step is to design the tables by selecting the fields you want to include, the type of data you want to store in each field, and the size of the fields. Once you have developed an overview of your application and a list of tables, you can make a preliminary list of fields, based on the categories of information that each table will include. You can refine the list by considering the following:

• if the data is to be sorted or selected, it should be in a separate field;

• if the data is to be calculated from other fields, you do not need to store it in its own field;

• if the table is to be linked to another table, both tables should contain common fields.

The fourth step is to create the table structures by defining the name, data type, and size of the fields.

The fifth and final step is to enter sample data. This step is important because it helps you determine whether or not the table fields are the correct size and if all the necessary fields have been included. You can then modify the tables as necessary.

METHODS FOR CREATING TABLES

Discussion Once you have created a database file, it will be necessary to create the tables that will store the database data.

A new table can be created by:

• Typing data directly into the table

• Using Design view

• Using “Application Parts” (most of these also create queries and forms - not recommended for beginners)

• Using SharePoint Lists (Not covered in this course)

• Importing from another database, program or a text file.

If you have just created a new database, Access automatically opens a blank Datasheet View for you to start designing your first table. If that is the case, follow steps 3 to 8 below only.

Page 25: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 20

Procedure (typing data directly) 1. Select the Create tab on the Ribbon.

2. Click the Table command in the Tables group . 3. Click the heading “Click to Add” and select the field type. A list of field types and

their use is given under Data Types on page 22.

4. Type a name for the field. 5. Press the [Return] key, or the [Tab] key to move to the next field. 6. Continue until you have entered the types and names of all your fields.

7. Click the Save button on the Quick Access Toolbar or, click the Close button

at the top right of the table and click Yes to the message.

8. Enter a name for the new table.

9. Click OK. 10. Click the Close button in the Table window if you are not going to enter data at

this time.

CREATING TABLES IN DESIGN VIEW

Discussion Most objects in Access can be displayed in Design view. This allows you to manipulate the underlying structure of the tables, queries, forms, and reports.

Page 26: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 21

In order to create a new table in Design View, you must first define the fields which will form the table structure, before you can enter any data.

The Table Design pane

In Design view, the fields are specified in rows where you can insert, edit, and delete according to your requirements. You can also specify, or alter, the data type for each field. A Table Tools > Design contextual tab will appear at the right of the Ribbon when in Table Design view.

The Design view window is split into three panes. The upper pane displays a grid where you enter the field names, data types, and field descriptions.

The lower pane displays the properties of the selected field. A property is a characteristic of a field, such as the number of characters a field can contain. Access automatically assigns default field properties, which you can modify as desired.

The third pane, at the right of the screen, displays properties for the table as a whole, for example, the default sort order, whether a filter is applied or a global validation rule. These properties are used in advanced table design and little will be lost to the basic user if the table

is hidden (click its Close button ).

Procedure 1. Select the Create tab.

2. Click the Table Design button in the Tables group. 3. Click in a Field Name cell and type the field name you want. 4. Click in the Data Type cell. 5. Select the data type you want (see table below). 6. If necessary, click in the Description cell and type a note or comment for the field. 7. To add another field, click in the Field Name column of the next row down. 8. Continue adding new fields as required.

Page 27: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 22

9. Click the Save button on the Quick Access Toolbar or, click the Close button

at the top right of the table design view and click Yes to the message.

10. If the following message appears, click No and refer to Setting a Primary Key on

page 25.

11. Enter a name for the new table.

12. Click OK. 13. Click the Close button in the Table Design pane.

DATA TYPES

Discussion The field data type tells Access what kind of values you plan to store in a field and how much storage space to set aside for the field. Although you can change a data type after a field contains data, doing so may erase some or all of the information in the field.

The following table describes the available data types in Access 2010:

Data Type Description

Text Text is the default data type; a text field can contain any combination of letters, numbers, punctuation marks, and spaces. The default width is 50 characters and the maximum length is 255 characters.

Memo A memo field is similar to a text field, except that a memo field can contain up to 65,535 characters. You can use memo fields for notes or long descriptions in a database.

Number A number field can contain only numeric characters, a comma (used as a thousands separator), a period (used as a decimal point), and a hyphen (used as a negative number sign). You should use a number field only when you want to perform calculations using the field values.

Date/Time The Date/Time data type is used for dates and/or times. Access automatically validates all entries to ensure that they are valid dates and/or times. For example, Access will not allow you to enter 31/2/99

Page 28: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 23

because February does not have 31 days. Date/Time fields are useful in performing calculations on dates and times.

Currency The Currency data type is similar to the Number data type and can be used in calculations. However, the values in a currency field can have a maximum of four decimal places and automatically appear with dollar signs and thousands separators (commas). You should use currency fields whenever possible because they use fixed point calculation, which is faster than the floating point calculation used in number fields.

AutoNumber The AutoNumber data type allows Access to automatically assign a unique number (consecutively from 1) to each record in the database. You cannot manually enter a value into an AutoNumbered field or change a number Access has assigned to a record. You use this data type when you want a unique identification number for each record.

Yes/No A Yes/No data type is used to signify one of two conditions, Yes or No. You use a yes/no field when only two possibilities (i.e., True or False) exist for a field value.

OLE object The OLE object data type allows you to either embed an object created in another Windows application or create a link to such an object. You use an OLE object data type for graphics, spreadsheets, or sound files.

Hyperlink A Hyperlink data type is used to store a link to anywhere you choose. The link could go to an Internet page, a Word document on an intranet, or even a form in the current database. A hyperlink field can contain a description, an address, and a sub-address [separated by number signs (#)], as well as up to 2,048 characters; only the address, however, is mandatory.

Attachment You can attach images, spreadsheet files, documents, charts, and other types of supported files to the records in your database, much like you attach files to e-mail messages. You can also view and edit attached files, depending on how the database designer sets up the Attachment field. Attachment fields provide greater flexibility than OLE Object fields, and they use storage space more efficiently because they don't create a bitmap image of the original file.

Lookup Wizard The Lookup Wizard data type allows you to create a lookup field. A lookup field displays a list of values that are either stored in another table or created by you. A lookup field allows you to choose values from a list during data entry, thereby reducing repetitive typing and eliminating typing errors.

Calculated A field capable of holding an expression that returns a value. For example, a table containing an Income field, could have a calculated field created alongside it calculating tax payable (see page 212).

Page 29: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 24

EDITING TABLE STRUCTURE IN DESIGN VIEW

Discussion Irrespective of how a table has initially been created, there will come a time when edits such as adding, moving and deleting fields needs to be done.

Procedure 1. Right-click the table in the Navigation Pane. 2. Select Design View in the shortcut menu.

3. To add a new field to the table:

a. Click anywhere along the row where you want to add the new field.

b. Click Insert Rows in the Tools group of the Ribbon . 4. To move a row.

a. Click the record selector (the small grey button at the left of the row) for the row

that you want to move . b. Point at the record selector and click and drag up or down until a thin, black

line appears between the rows that you want to move the selected row to

. 5. To delete a row.

a. Click anywhere along the row of the field that you want to delete.

b. Click Delete Rows in the Tools group of the Ribbon .

6. Click the Save button on the Quick Access Toolbar or, click the Close button

at the top right of the table design view and click Yes to the message.

Page 30: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 25

Tip If you have a table open already, you can open Design View by selecting the Home tab, clicking the View button in the Views group and selecting Design View.

SETTING A PRIMARY KEY

Discussion Access works most efficiently if you specify a primary key for each table. The primary key is a field (or group of fields) that uniquely identifies each record in the table.

There are several advantages to setting a primary key. First, the primary key is automatically indexed, which makes information retrieval faster. Second, when you open a table, the records are automatically sorted in order by the primary key. Finally, a primary key prevents the entry of duplicate data because Access does not allow duplicates in the primary key field. You cannot choose a memo, OLE, or hyperlink field as the primary key.

When you create a new table by typing in data (see page 20), Access automatically assigns a primary key to the ID field and gives the field and AutoNumber data type.

When you create a table in Design view, you can specify which field to assign the primary key yourself.

Procedure 1. To specify a primary key for a table, first open the table in Design View. 2. Select the Table Tools > Design tab.

3. Click the record selector of the field that you wish to make the primary key. If you want to use more than one field to form the primary key, hold down the [Ctrl] key while clicking on any additional row selector for each field.

4. In the Tools group, click the Primary Key button .

5. The row selector of that field now displays a primary key symbol . 6. To remove the primary key from a field, select the field that you wish to remove

the primary key from. 7. In the Tools group, click the Primary Key button. 8. Save the table design and close the view.

Page 31: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 2 – Creating Database Tables

WWP Learning and Development LTD Page 26

EXERCISE CREATING TABLES

1. Create a blank database named Training and save it to the student data folder. 2. Close the default new table without entering and data and create a new table in

Design view. 3. Add the following fields and their corresponding data types to the table:

Field Name Data Type ProjectID Text ClientID Text CourseName Text StartDate Date/Time EndDate Date/Time TrainerInitials Text Cost Number

4. Enter the following description for the ProjectID field: Enter the ProjectID

assigned by Marketing.. 5. Set the ProjectID field as the primary key. 6. Save the table as Project. 7. Close the Design view window. 8. Create a new table in Datasheet view (Create tab – Tables group – Table button). 9. Enter the following data and field names (you will have to enter the data for each

column before you can add the field name).

10. Save the table as Payments. 11. Close the table. 12. Close the database.

Page 32: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 27

LESSON 3 - WORKING WITH DATA IN TABLES

In this lesson, you will learn how to:

• Navigate fields in tables

• Add records

• Select records

• Edit records

• Save records

• Delete records

Page 33: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 3 – Working with Data in Tables

WWP Learning and Development LTD Page 28

INTRODUCTION

Discussion When you open a table, it appears in Datasheet view by default. Datasheet view is useful when you want to enter, edit, or delete records.

In Datasheet view, the table data is arranged in rows and columns, with the columns representing the table fields and the rows the individual records. Multiple records appear in the table. The small, grey box at the far left of each row is the record selector; blue highlighting along a row indicates that the record is selected.

An Access Table

NAVIGATING FIELDS IN TABLES

Discussion In Datasheet view, you can use the mouse or the keyboard to move through the fields and records. As you enter or edit data, you can use the [Tab] or [Enter] keys to move from field to field. You can also use the [Right] and [Left] arrow keys to navigate across fields. These keys are helpful because they allow you to keep your hands on the keyboard at all times, rather than having to switch back and forth from the keyboard to the mouse. However, the mouse is useful if you want to skip certain fields. You simply click in the field where you want to enter or edit data.

The [Up] and [Down] arrow keys allow you to move from record to record. In addition, the navigation toolbar at the bottom of the datasheet allows you to select the first, last, next, or previous record, as well as specify a particular record you want to view. The [Page Up] and [Page Down] keys scroll to the previous or next page of records, respectively.

Using the [Home] key will move the selection to the beginning of a row, while use of the [End] key will move the selection to the end of the row.

Page 34: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 3 – Working with Data in Tables

WWP Learning and Development LTD Page 29

Pressing [Ctrl + Home] keys will move the selection to the first cell of the first row, while [Ctrl + End] keys will move the selection to the last cell of the last row.

If there are more records in a table than can be displayed in Datasheet view, a vertical scroll bar appears. You can use this scroll bar to view additional records.

Access also provides a navigation toolbar at the bottom of the datasheet that can be used to select the first, last, next, or previous record in the datasheet, as well as to specify a particular record you want to view. You go to a specific record by entering a number in the record number box and pressing Enter.

The table Navigation Bar

ADDING RECORDS

Discussion A blank row follows the last record in an existing table. This blank row, the new record row,

displays an asterisk ( ) in the record selector. As soon as you begin entering data into the

new record row, the asterisk in the record selector changes to a pencil ( ) to indicate that the record is being entered or edited, and Access creates another new record row below it.

If there is no data in the table, only the new record row appears. When you enter data into a row, the amount of characters you can enter is limited by the size of the field. The field size, however, can actually be larger than the column width in Datasheet view; if the field size is larger than the column width, the text scrolls as you type.

After you have typed the desired information into a field, you can press the [Enter] or [Tab] key to save the record and move the insertion point to the next field. To cancel a new record before it is saved, press the [Esc] key twice.

You can also use the New Record button in the Records group or in the Navigation

Bar at the bottom of the Datasheet to add a new record .

Procedure 1. To add a record to a table, first open the table in Datasheet view. 2. Click in the first field of the new record row. 3. Type the desired data. 4. Press the [Enter] key. 5. Enter the data in the remaining fields, pressing the [Enter] key after each entry. 6. Close the Datasheet view.

Page 35: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 3 – Working with Data in Tables

WWP Learning and Development LTD Page 30

SELECTING ENTIRE RECORDS

Discussion When you select any field in a record, that record becomes the active record. The record selector to the left of the record is coloured orange to indicate that it is the active record. You can then edit any field in the record as desired.

Selecting a record is different than making a record active. To select a record, you must select the entire row. Access colour the entire row blue. Selecting a record is useful when you want to delete or copy it.

Procedure 1. Open the table where you want to select a record. 2. Click the record selector at the left of the record.

EDITING RECORDS

Discussion You can edit records at any time. You cannot edit an AutoNumber field, however, because Access automatically generates the data in it.

When you use the keyboard to access a field (by pressing [Enter] or [Tab]), the entire field is selected, and you can replace all data simply by typing new data. This is select mode. Access also allows you to edit individual characters within a field. To do this, you must switch to edit mode. In edit mode, the insertion point appears in the field. You can click in a field with the mouse or press [F2] to access edit mode.

Field data in select mode Field data in edit mode

While you are editing a record, a pencil symbol appears in its record selector. The following table describes various keystrokes you can use to edit records.

Keystroke Description

[Up] Selects the same field in the previous record.

[Down] Selects the same field in the next record.

[Right] In select mode, selects the next field; in edit mode, moves one character to the right.

Record selector

Selected record

Page 36: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 3 – Working with Data in Tables

WWP Learning and Development LTD Page 31

Keystroke Description

[Left] In select mode, selects the previous field; in edit mode, moves one character to the left.

[F2] Toggles between select and edit modes.

[Ctrl+Enter] Inserts a new line character in a field.

[Ctrl+’] Inserts the data from the corresponding field in the previous record.

[Ctrl+Alt+Spacebar] Replaces the data with the default data, if available.

[Ctrl+Shift+:] In select mode, replaces the field data with the current time.

[Ctrl+;] In select mode, replaces the field data with the current date.

Procedure 1. To select and/or edit cell contents, first select the cell contents you want to edit by:

a. Double-clicking on a word b. Clicking and dragging to select multiple words c. Clicking just inside the border of a table cell to select its entire contents; the

mouse pointer changes to a chunky white cross when in the correct position.

d. Point to the border of a table cell and then drag to select multiple cells in

Datasheet view.

2. Once text is selected;

a. To replace text, type your text. b. To delete text, press the [Backspace] key, or the [Delete] key.

SAVING RECORDS

Discussion Access automatically saves a new record or changes made to an existing record as soon as you move to the next record, but you can also save a record manually. This option is useful if a record has numerous fields and you want to save the changes made to a field without leaving the record.

Access also saves records automatically when you close a table, but you can also press the Save button in the Records group, or press [Shift+Enter] key combination to save a record.

Page 37: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 3 – Working with Data in Tables

WWP Learning and Development LTD Page 32

Procedure

While adding or editing a record, click the Save button in the Records group of the Home tab.

DELETING RECORDS

Discussion When you no longer need a record, you can delete it. Deleting records saves disk space and keeps your tables smaller and more manageable. After you have deleted a record, you cannot undo the deletion.

Procedure 1. Select the record to be deleted (click the record selector to highlight the entire row). 2. Click the Delete button in the Records group of the Home tab. 3. Click Delete Record.

4. In the Message box, click Yes to confirm the deletion.

Or

1. Select the record to be deleted (click the record selector to highlight the entire row). 2. Press the [Delete] key on the keyboard. 3. In the Message box, click Yes to confirm the deletion.

Tip You can copy records from one table into another by selecting them as described earlier in this lesson, invoking a Copy command and then selected the entire new record row and invoking a Paste command.

Tip You can selext multiple adjacent records to delete by clicking and dragging down or up over the record selectors.

Page 38: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 3 – Working with Data in Tables

WWP Learning and Development LTD Page 33

EXERCISE WORKING WITH TABLES

1. Open Train04.accdb 2. Open the Project table in Datasheet view. 3. Add the following records to the table:

Project ID Client ID Course Name Start Date End Date Trainer Initials Cost

1001 ABBOTT EXCEL 5/1/12 5/1/12 JA 75

1002 AQUA WINDOWS 9/1/12 9/1/12 EA 75

1003 CONCORD WORD 16/1/12 17/1/12 DF 200

4. Close the Project table. 5. Open the Project2 table in Datasheet view. 6. In the second record (#1002), change the start date to 10/1/11 and the end date to

11/1/11. 7. Save the record. 8. Delete the fourth record (#1004). 9. Close the table and then close the database.

Page 39: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 34

LESSON 4 - SETTING FIELD PROPERTIES

In this lesson, you will learn how to:

• Use field properties

• Limit field size

• Set number formats

• Set date/time formats

• Set yes/no formats

• Set default values

• Set validation rules

• Create an input mask - wizard

• Create an input mask manually

• Create a custom input mask

• Create a lookup list

• Modify lookup properties

• Set Smart Tag properties

Page 40: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 35

INTRODUCTION

Discussion Access provides different data types which cover a wide variety of data. Once you have selected a data type for your fields, you can work with the field properties for that data type.

Field properties control the way the field stores, handles, and displays data. Since forms and reports you create use the fields in your tables, setting field properties in the early stages of building a database can save you time later on.

You normally set or change field properties in Design View but many can also be changed when viewing a table in datasheet view, by using the Table Tools > Fields tab.

The properties available for a field depend on the data type assigned to the selected field. A brief description of the selected property appears in the Field Properties pane in the Design view. You can press the [F1] key for help with the selected property.

Some of the property types you can set are listed in the following table.

Property type Description

Field Size Limits a Text field to a specific number of characters; limits a Number field to a specific type of number

Format Controls the way values appear in Datasheet view

Decimal places Available for Number and Currency fields only, determines how many decimal places will appear in the field; this property type has no effect on Number fields using the General format

Input Mask Creates a pattern for data entered into the field (such as adding hyphens within a telephone number)

Caption Creates a label other than the field name; the caption will appear in the table and on forms and reports

Default Value Specifies the value you want to appear in the selected field in all new records

Validation Rule Forces data entered into the selected field to meet a specified requirement

Validation Text Creates an error message to appear when the data entered violates a validation rule

Required Specifies that the field cannot be left empty

Allow Zero Length Determines whether or not you can enter quotation marks (“ ”) in a Text, Memo or Hyperlink field to indicate that there is no data for that field

Indexed Speeds up retrieval of data in a field; all primary key fields are automatically indexed

Unicode Compression Indicate whether you want Access to save space if only plain text is entered

Page 41: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 36

IME Mode Input Method Editor – setting applies only if you are using East Asian languages.

IME Sentence Mode Settings apply to the Japanese language only.

Smart Tags Adds additional functionality to the field that you’d normally have to open another programme to do.

Text Align Aligns the data in a field the the left, centre, right or distribjuted (spread across the data cell).

LIMITING FIELD SIZE

Discussion Setting a field size limits the number of characters or the type of characters you can enter into a field. After typing the maximum number of characters allowed, further keystrokes are not permitted. The Field Size property is available only for Text, Number, and AutoNumber data types; all other data types have default sizes that are set automatically.

For a Text field, the field size is the maximum number of characters you want to allow in the field, up to the maximum of 255 characters allowed by Access. The default field size for Number fields is Long Integer, which is also the largest field size. You should use the smallest possible field size whenever possible, however, so that the database uses less storage space and can be processed more quickly. You may lose existing data if you decrease the size of a field. In addition, you cannot undo design changes after you have saved the table.

For a Number field, you can select one of the following Field Size options:

Field Size Size Range Decimal Places Byte 0 to 255 (no fractions) None; data is rounded Integer -32768 to 32767 (no fractions) None; data is rounded Long Integer -2,147,483,648 to 2,147,483,647 (no

fractions) None; data is rounded

Single -3.4x1038 to 3.4x1038 Up to 7 Double -1.797x10308 to 1.797x10308 Up to 15 Replication ID Globally unique identifier. Not available Decimal -1028-1 through to 1028-1

28

For an AutoNumber field, only the Long Integer and Replication ID options are available.

Procedure Datasheet view

1. Open the table in Datasheet view. 2. Click anywhere in the field column that you want to change the properties for. 3. Select the Fields tab under Table Tools.

Page 42: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 37

4. Select available commands in the Properties group, eg. Name and Caption, Default

Value, Field Size, etc.

5. Change settings as necessary. 6. If available, select formatting options in the Formatting group or select the Format:

drop down list.

7. Tick or untick the Required, Unique and/or Indexed check boxes in the Field

Validation group.

8. Click the Validation command button. 9. If required, set rules for restricting data entry into the field or record.

10. Click the Save button on the Quick Access Toolbar. 11. If necessary, close the Table.

Procedure Using Design View

1. In the Navigation Pane, right click the table that you want to change field properties for.

2. Select Design View in the shortcut menu.

Page 43: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 38

3. Click the field you want to change. 4. In the Field Properties General pane, click the field property box you want to

change. 5. Type or select the value you want. 6. Click the Save button on the Quick Access Toolbar. 7. If necessary, click the Close button in the Table window.

SETTING NUMBER FORMATS

Discussion If a field has a Number or Currency data type, Access provides a list of predefined formats to display the data values in the Datasheet or Design view.

In Design view, you can also create your own format using formatting symbols applicable to numeric values and currency.

The Format property affects how data appears in Datasheet view, not how it is stored in the table nor how it is used in calculations.

If a Number data type field is formatted with 0 decimal places, for example, a value of 1.5 would appear as 2 in the datasheet; if the value is multiplied by 2 in a calculation, however, the answer would be 3, not 4.

The available formats for fields with Number data types are listed in the following table:

Format Description

General Number Displays a number exactly as it is entered; this is the default format

Currency Displays a dollar sign, a thousands separator, and two decimal places; the defaults for this format are determined by the system settings

Euro Displays a euro sign, a thousands separator, and two decimal places; the defaults for this format are determined by the system settings

Fixed Displays at least one digit and is rounded to the default number of decimal places; the defaults for this format are determined by the system settings

Page 44: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 39

Standard Displays a thousands separator and is rounded to the default number of decimal places; the defaults for this format are determined by the system settings

Percent Multiplies the number by 100, displays a percent sign (%), and is rounded to the default number of decimal places; the defaults for this format are determined by the system settings

Scientific Expresses numbers in standard scientific notation (as multiples of exponents of 10)

Procedure 1. Open the table containing the field you want to change the number format

property for. 2. Click in the Number or Currency field (column) that you want to change the

property for. 3. Select the Fields tab under Table Tools. 4. Click the Format: drop down list in the Formatting group.

5. Select a required format (see table above). 6. Save the changes.

SETTING DATE/TIME FORMATS

Discussion You can also change the format of a Date/Time field to change the way the date or time appears in the table. The available formats for Date/Time fields are listed in the following table:

Format Description

General Date The default format; if the value is only a date, no time appears; if the value is only a time, no date appears

Long Date The day and month names are spelled out (e.g., Tuesday, July 4, 1995)

Medium Date The month name is abbreviated, and the name of the day is omitted (e.g., 04-Jul-95)

Short Date The date appears as numbers separated by slashes (e.g., 7/4/95)

Long Time The time is displayed as hours, minutes, and seconds, separated by colons, and followed by an AM or PM indicator (e.g., 6:30:15 PM)

Page 45: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 40

Medium Time The time is displayed the same as in the Long Time format, except that no seconds appear (e.g., 06:15 PM)

Short Time The time is displayed as hours and minutes, separated by a colon, in 24-hour clock format (e.g., 18:30)

Procedure 1. Open the table containing the field you want to change the date/time format

property for. 2. Click in the Date/Time field (column) that you want to change the property for. 3. Select the Fields tab under Table Tools. 4. Click the Format: drop down list in the Formatting group.

5. Select a required format (see table above). 6. Save the changes.

SETTING YES/NO FORMATS

Discussion A Yes/No field is limited to either a positive or a negative response and can be displayed as a text box, a check box, or a combo box. You select the display of the field on the Lookup page in the Field Properties pane.

If the Yes/No field displays its values in a text box, you can select one of three Yes/No data type formats; True/False, Yes/No, and On/Off.

When a Yes/No field displays a check box, a selected check box indicates a positive response and a deselected check box indicates a negative response. The check box is the default setting for a Yes/No field.

Procedure 1. Open the table containing the field you want to change the yes/no format property

for. 2. Click in the Yes/No field (column) that you want to change the property for. 3. Select the Fields tab under Table Tools. 4. Click the Format: drop down list in the Formatting group.

Page 46: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 41

5. Select a required format. 6. Save the changes.

SETTING DEFAULT VALUES

Discussion When you set a default value for a field, that value automatically appears in the field for all new records. You can, however, modify the default field value as needed when entering a new record. Adding a default value to a field does not change any existing data.

You can set a default value by entering the desired value or expression in the Default Value box. An expression consists of operators (i.e. =, +, -, *, /) and/or values.

If you create a default value for a Text field, the default text must be enclosed in quotation marks (" "); for example, "Net 30". Values for Date fields must be enclosed in number signs (#); for example, #15/03/2012#. If you do not enter the number signs, however, Access will automatically enter them.

Default values are set in the Default Value section of the General page of the Field Properties.

Procedure 1. Open the table containing the field you want to add a default value for. 2. Click in the field (column) that you want to add a default value for. 3. Select the Fields tab under Table Tools. 4. Click the Default Value command in the Properties group. 5. Enter the default value in the Enter an Expression to return the default value of

the field: box. 6. Click OK. 7. Save the changes.

Entering a default value in the Expression Builder

Page 47: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 42

VALIDATION RULES

Discussion Databases can contain incorrect information due to data entry errors. One method of controlling the accuracy of data is to impose restrictions on the values entered into a field.

You can impose restrictions on data entered into your table by creating validation rules in the Validation Rule box of one or more fields. When you enter data into a new record or modify data in an existing record, Access checks each field for existing validation rules. If an entry does not meet the conditions of the corresponding validation rule, a warning box notifies you of the error.

When you set a validation rule, you can also set the Validation Text property to specify your own error alert text that you want to appear in the warning box.

Setting a validation rule is different from setting the data type or field size properties. Access uses data type and field size properties to determine that the correct type of data is being entered whereas validation rules are more specific in their restrictions.

Procedure 1. Open the table that you want to set a field validation rule for. 2. Click in the field (column) that you want to add the rule for. 3. Select the Fields tab under Table Tools. 4. Click the Validation command in the Field Validation group. 5. Select Field Validation Rule.

Page 48: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 43

6. Enter a conditional expression in the Enter an Expression to return the default value of the field: box. The conditional expression must evaluate to true in order for the data to be allowed. For example, the expression <=8 (less than or equal to 8) will only allow values less than 8 to be entered into the field; the expression > #31/12/2011# will only allow dates after 31 December 2011 to be entered.

7. Click OK in the Expression Builder dialog box. 8. Save the changes.

To add your own Validation Text

1. Click in the field (column) that you want to add your own field validation message for.

2. Select the Fields tab under Table Tools. 3. Click the Validation command in the Field Validation group. 4. Select Field Validation Message.

5. Enter your message text in the Enter Validation Message box.

6. Click OK. 7. Save the changes.

Removing a field validation rule

1. Open the table that you want to remove a field validation rule for. 2. Click in the field (column) that you want to remove the rule for. 3. Select the Fields tab under Table Tools. 4. Click the Validation command in the Field Validation group. 5. Select Field Validation Rule.

Page 49: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 44

6. Delete the conditional expression in the Enter an Expression to return the default

value of the field: box. 7. Click OK in the Expression Builder dialog box. 8. Save the changes.

CREATING AN INPUT MASK – WIZARD

Discussion Input masks control how data is entered into a table, as well as the format in which it is stored. You can use an input mask to control how many characters are entered into a field; define each individual character as numeric, text, or either; and specify each individual character as mandatory or optional, as well as add literal characters to format the entry. Since the input mask controls the values users can enter into a field, it often makes data entry easier.

You can create an input mask by entering the criteria directly into the Input Mask box. However, it is often easier to use the Input Mask Wizard to set the property for you. The Input Mask Wizard offers several predefined input masks for items such as dates and times, Post codes, telephone numbers, etc. In addition, you can modify any predefined input mask to meet your needs.

Procedure 1. In the Navigation Pane, right click the table that you want to add an input mask to. 2. Select Design View. 3. Select the field you want an input mask for. 4. In the Field Properties pane, click in the Input Mask box.

5. Click the Build button . 6. Select the desired option from the Input Mask list.

Page 50: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 45

7. Click Next to continue.

8. If you want to display a different placeholder, click the Placeholder list arrow, and

select the placeholder you want. 9. Enter values to test the final version of your input mask and then click on Next to

continue.

10. Indicate which method to store the data. 11. Click the Finish button.

Page 51: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 46

CREATING AN INPUT MASK – MANUALLY

Discussion An input mask controls what values you can enter in a field, as well as how the data will appear. Although it is usually easier to use the Input Mask Wizard, you may need to create an input mask that is not included in the list of predefined masks in the Input Mask Wizard. Access allows you to create an input mask by entering criteria directly into the Input Mask box.

When you create an input mask manually, you use special characters to define it. These special characters act as placeholders, controlling the type of character that can be entered into each position, as well as which characters are required.

The Input Mask property can be set in Design view of any table, query, or form. Most of the time, you will want to apply an input mask to a field in table Design view, because it will then be automatically applied to the field in queries, forms, and reports.

The Input Mask Wizard can only be used for Text and Date/Time fields. You must manually enter an input mask for Number and Currency fields.

The following table defines some of the special characters that can be used in an input mask. To define a literal character, enter any character other than one of those shown in the table. If you want to define a character listed in the table as a literal character, you must precede that character with a backslash (\).

Character Description

0 A required numeric entry (0-9); plus and minus signs are not allowed

9 An optional numeric entry (0-9) or space; plus and minus signs not allowed

# An optional numeric (0-9) entry or space; plus and minus signs allowed

L A required alphabetic entry (A-Z)

? An optional alphabetic entry (A-Z)

A A required alphabetic (A-Z) or numeric (0-9) entry

a An optional alphabetic (A-Z) or numeric (0-9) entry

& Any character or space; entry required

C Any character or space; entry optional

< Causes all characters that follow to be converted to lowercase

< Causes all characters that follow to be converted to uppercase

! Enters the input mask from right to left, instead of from left to right

\ Causes the character that follows to be displayed as a literal character

Page 52: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 47

Procedure 1. In the Navigation Pane, right click the table that you want to add an input mask to. 2. Select Design View. 3. Select the field you want an input mask for. 4. In the Field Properties pane, click in the Input Mask box. 5. Type the desired input mask (refer to the table above). 6. Save the changes and close Design View, if necessary.

CREATING A CUSTOM INPUT MASK

Discussion The Input Mask Wizard provides a list of predefined input masks. If you frequently use an input mask that is not included with the predefined masks in the Input Mask Wizard, you may want to create a custom input mask. You may want to use an input mask, for example, to ensure that product numbers are always correctly entered.

You can create and save a custom input mask in the Input Mask Wizard, where it is available to tables and forms at any time. In this way, you will only need to create a custom input mask once.

Input masks are saved to your user profile, not to the individual database file. If you create a new mask, or modify a default one using the Customize Input Mask Wizard dialog box, the changes are permanently saved to your system settings and can be used on any Access database.

Procedure 1. In the Navigation Pane, right click the table that you want to add an input mask to. 2. Select Design View. 3. Select the field you want an input mask for. 4. In the Field Properties pane, click in the Input Mask box.

5. Click the Build button .

6. Click the Edit List button .

7. Click the New button in the Navigation Bar at bottom of dialog box.

8. Type the desired description for the custom input mask.

Page 53: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 48

9. Click in the Input Mask box. 10. Type the custom input mask (see table above). 11. Click in the Placeholder box. 12. Type the placeholder you want. 13. Click in the Sample Data box. 14. Type some sample data. 15. Click in the Mask Type: box and select accordingly. 16. Click the Close button. 17. In the Input Mask list, select the custom input mask.

18. Click Finish. 19. Save the changes and close Design View, if necessary.

Tip To delete custom masks, carry out a Windows search in your profile for a file named ACWZUSR12.ACCDU and delete it.

CREATE A LOOKUP LIST USING THE LOOKUP WIZARD

Discussion You can increase data accuracy by adding a lookup field to a table. The user can then select the desired value from the lookup list, rather than having to type it. The values in a lookup list are usually stored in a field in a different table. If the desired data is not stored elsewhere, you can type the lookup list values.

The Lookup Wizard creates a combo box for the lookup list; a combo box field displays a drop-down list that displays all of the available data values. You can select whether the lookup limits input to values only in the lookup list or, whether users can type other value too. Additionally, a lookup can be set up to accept multiple values.

Page 54: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 49

Single value lookup Multiple value lookup

A lookup list can contain multiple columns. If you are typing a new list of values, you can designate the number of columns desired and then type the desired values into each column. In addition, you can add a second field to a lookup list. For example, if you are creating a lookup list in the Customer table, you can add both the Initials and the Last Name fields from the Reps table to the lookup list.

Multiple column lookups

Procedure Creating a lookup with typed-in values

1. In the Navigation Pane, right click the table that you want to add an input mask to. 2. Select Design View. 3. Click the Data Type drop down list for the field you want to create a lookup for.

4. Select Lookup Wizard….

5. Select the I will type in the values that I want option.

Page 55: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 50

6. Click the Next button. 7. Enter the desired number of lookup columns. 8. Select the box below the Col1 heading. 9. Type the first desired lookup value. 10. Enter additional lookup values as desired.

11. Click the Next button. 12. Select the column that contains the values you want to store or use (this will

usually be Col1).

13. Click the Next button. 14. Accept or change the Label (field name). 15. Tick the Limit to List check box if you wish to restrain data entry to items in the list

only. 16. Tick the Allow Multiple Values check box, if required.

17. Click the Finish button.

Page 56: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 51

18. Save the changes and close Design View, if necessary. NB. If you select Allow Multiple Values, you cannot later change this setting.

Allowing a lookup to accept multiple values also sets the Limit to List option to TRUE and disables the check box.

Creating a lookup using another table or query

1. In the Navigation Pane, right click the table that you want to add an input mask to. 2. Select Design View. 3. Click the Data Type drop down list for the field you want to create a lookup for.

4. Select Lookup Wizard…. 5. Select the I want the lookup field to get the values from another table or query

option.

6. Click the Next button. 7. Select the table or query containing the values for the lookup.

Page 57: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 52

8. Click Next. 9. Select the first field that you want to display in the lookup.

10. Click the button. 11. Select additional fields as described in 9 & 10 above.

12. Click Next. 13. Select the sort order for the lookup.

14. Click the Next button. 15. Adjust the width of the columns by clicking and dragging the grey column

separators at the top of the grid.

Page 58: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 53

16. Click the Next button. 17. Select the column that contains the values you want to store or use (this will

usually be the ID field).

18. Click Next. 19. Accept or change the Label (field name). 20. Tick the Allow Multiple Values check box, if required.

21. Click the Finish button. 22. Click Yes to the message about creating relationships 23. Save the changes and close Design View, if necessary.

NB. If you specify a lookup to Allow Multiple Values, this setting cannot later be changed.

Page 59: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 54

MODIFYING LOOKUP PROPERTIES

Discussion If a lookup has been created by typing in values, you can use the Modify Lookups command on the Fields tab under Table Tools to modify the values displayed in the list.

If, however, the lookup was created by getting values from a table or query, you can only modify the list in table Design View.

Lookup properties where a table or query has been used

There is usually no need to edit the Display Control; Row Source Type and Row Source properties. Other properties are as follows:

Property Description

Bound Column The property indicates which lookup column is used to store field values. For instance, if the lookup list consists of two columns, and column 1 is the bound column, the data in column 1 will be stored in the lookup field.

Column Count Specifies the number of columns to show in the lookup list

Column Heads Displays a row at the top of the lookup list giving names for the columns

Column Widths The width of each column in a multiple column list.

List Rows Maximum number of rows displayed in the list before a scroll bar is displayed

List Width The width of the entire list

Page 60: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 55

Limit to List Field only accepts items in list

Allow Multiple Values User can select more than one item in the list. This produced a list with check boxes next to each item and multiple entries are shown in data cell separated by commas.

Allow Value List Edits Allows editing of the listed items

List Items Edit form Specifies which form to open to edit list items

Show Only Row Source Values

List only shows items that match the row source property

Procedure Modifying a lookup created from a table or query

1. Open the required table in Design view. 2. Click the field whose lookup list is to be modified. 3. In the Field Properties pane, select the Lookup tab. 4. Select the property you want to modify. 5. Change the property as required (refer to table above). 6. Save the changes and close Design view, if necessary.

Modifying a lookup created from typed-in values

1. Open the table containing the lookup field that you want to modify. 2. Click in the field (column) that you want to modify. 3. Select the Fields tab under Table Tools.

4. Click the Modify Lookups command in the Properties group. 5. Edit the values list by adding, removing or editing text, rows or columns and

adjusting column widths.

6. Click the Next button. 7. Select the column that contains the values you want to store or use (this will

usually be Col1).

Page 61: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 56

8. Click the Next button. 9. Accept or change the Label (field name). 10. Tick the Limit to List check box if you wish to restrain data entry to items in the list

only. 11. Tick the Allow Multiple Values check box, if required.

12. Click the Finish button. 13. Save the changes and close Design View, if necessary. NB. If you specify a lookup to Allow Multiple Values, this setting cannot later be

changed. The Limit to List and Allow Multiple Values check boxes will be greyed out if you repeat the process above.

Even if you change the Allow Multiple Values lookup property in the table Design View, the following message will appear when you attempt to save the changes.

Page 62: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 57

And if you try to revert the field back to a standard Text Box field (one where you type in the data yourself) by changing the Display Control lookup property back to Text Box, the following message will appear.

Work on the principle: “once a multiple value lookup field….. always a multiple value lookup field!”

SETTING A SMART TAG FOR A FIELD

Discussion You can save time by using smart tags to perform actions in Access that you'd usually open other programs to perform . Data cells in tables containing smart tags are indicated by a small, purple triangle in the bottom right-hand corner of the cell. Upon selecting such a cell the Smart Tag Actions button appears. Click the button to see a menu of actions that are possible with the smart tag.

A name field displaying smart tag symbols and actions menu

You add a smart tag to a field or control by setting the SmartTags property.

Page 63: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 58

Five smart tag options available in Access

Access comes with five built-in smart tags. You may find additional smart tags created by Microsoft, by third-party companies, or by Information Technology (IT) professionals, who may design smart tags and actions for the specific products or services that you work with.

Smart Tag Possible Actions

Person name

Send Mail Schedule a Meeting Open Contacts Add to Contacts

Date Schedule a Meeting Show my Calendar

Financial symbol Stock quote on MSN MoneyCentral Company report on MSN MoneyCentral Recent news on MSN MoneyCentral

Instant messaging contacts Contact card Phone Add to Contacts

Procedure 1. In the Navigation Pane, right click the table that you want to add a Smart Tag to. 2. Select Design View. 3. Select the field you want a Smart Tag for. 4. In the Field Properties pane, click in the Smart Tag box.

5. Click the ellipsis button. 6. Select the required Smart Tag type; you can select more than one. 7. Click OK. 8. Save the table design and close

Page 64: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 59

EXERCISE SETTING FIELD PROPERTIES

1. Open Train16. 2. Open the Payment table in Design view. 3. Set the Format property for the Payment Date field to Short Date. 4. Set the Format property for the Amount Paid field to Currency. 5. Set a validation rule for the Amount Paid field, so that it can only contain values

greater than ten dollars. Then, enter the following validation text: The amount paid must be greater than ten dollars.

6. Set the Format property for the Recorded field to Yes/No. 7. Set a default value of “CHEQUE” for the Type of Payment field. 8. Switch to Datasheet view, saving the changes. Select Yes to all message boxes.

Notice the formats of the Payment Date and Amount Paid fields. Scroll to the new record row; notice that the default value of CHEQUE appears in the Type of Payment field. Create a new record with a Project ID of 11, a Payment Date of 1/4/11, and an Amount Paid of 5. Select OK when prompted with the validation text and replace the 5 with 25 in the Amount Paid field. Then, close the Payment table.

9. Open the Reps table in Design view. 10. Select the Initials field and create the following input mask: >LL. (This mask will

require the data to be 2 letters and will automatically format them as upper-case.) 11. Switch to Datasheet view, saving the changes. Then, add the following new record:

Initials pj (type in lower case) (Notice that Access automatically capitalizes the entry in the Initials field.)

12. Switch to Design view and use the Input Mask Wizard to apply the Phone Number mask to the Home Phone field.

13. Switch to Datasheet view, saving the changes. 14. Tab to the Home Phone field, type 123456789000, and press [Enter]; notice that the

phone number is automatically formatted according to the input mask. Close the Reps table.

15. Open the Project table in Design view. Create a new text field below the Trainer Initials field; name it Sales Rep and make it a lookup field. (Hint: Select Lookup Wizard from the Data Type list.) Select the option to type in the values. Then, type the following values for the lookup column: PJ, RJ, KM, and SH. Finish the Lookup Wizard.

16. Switch to Datasheet view, saving the changes. Add the following values to the Sales Rep column for the first four records: Project ID Sales Rep 1 RJ 2 SH 3 PJ 4 KM

17. Switch back to Design view. Add a new sales rep to the Sales Rep value list by typing ;"JW" after the last entry in the Row Source box. Then, change the value in

Page 65: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 4 – Setting Field Properties

WWP Learning and Development LTD Page 60

the List Rows box to 5 and the Show Only Row Source Values to Yes. (Hint: Use the Lookup tab in Properties.)

18. Switch to Datasheet view, saving the changes. Select the first empty Sales Rep field (in the Project ID 5 row) and select JW from the drop-down list.

19. Close the Project table. 20. Close the database file.

Page 66: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 61

LESSON 5 – VIEWING & FORMATTING DATASHEETS

In this lesson, you will learn how to:

• Insert columns

• Move a column

• Change a column name

• Delete a column Change the row height

• Change the column width

• Change a font attribute

• Change a cell effect

• Select a column

• Hide a column

• Unhide a column

• Freeze a column

• Unfreeze a column

• Adding a Totals row to a table

Page 67: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 62

INSERTING COLUMNS

Discussion Although you can control better how to insert new fields into a table by using Design View (see Editing Table Structure in Design View on page 24), you can also insert one or more columns directly into the datasheet. Inserting a column automatically adds a new field to the table.

Columns are inserted to the left of the currently selected column; consequently, you can position a new field in the desired location. Although Access sets a default field width and provides a default field name, you can select the data type for the field and later change any of the settings as desired. After adding a column, you should change the default field name to one that clearly identifies its contents. You can insert a column by right-clicking any column heading and selecting the Insert Field command or use the Add & Delete group of commands on the Fields tab under Table Tools.

Procedure 1. Open the required table in datasheet view. 2. Right click the heading of the column to the right of where you want the new field

inserted. 3. Select Insert Field. 4. To name the inserted column, double-click the heading and type the name for that

field. This method can also be used to rename an existing column. 5. Press [Enter].

Alternatively

1. Open the required table in datasheet view. 2. Click anywhere in the column to the left of where you want the new field inserted. 3. Select the Fields tab under Table Tools. 4. Click the required field type button (eg. Text, Number, Currency) in the Add &

Delete group. 5. Type a name for the field. 6. Press [Enter].

Page 68: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 63

MOVING A COLUMN

Discussion You can move one or more columns in Datasheet view. For example, you can reposition columns to view data more easily or organise the datasheet logically.

You can move a single column or multiple, adjacent columns. Before you can move a column or multiple columns, however, you must first select them.

Moving columns does not change the order of the fields in the table design.

To undo a column move, you must close the table without saving the changes. You cannot use the Undo feature to undo a column move.

Moving a column in a datasheet

Procedure 1. To move a column, first click the column heading for the column that you want to

move and release the mouse button. 2. Hold down the mouse button on the field heading and drag the column to its new

position. 3. A thick, black, vertical line indicates the position while dragging and the mouse

pointer changes to a shape. 4. When the new position is reached, release the mouse button.

CHANGING A COLUMN NAME

Discussion Changing a column name also renames the field. Beware of changing field names as it could affect other objects (forms, reports, macros) in the database and stop them working.

Procedure 1. Double click the column heading on the datasheet that you want to rename.

Page 69: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 64

2. Type a new name for the column. 3. Press [Enter].

Tip

If renaming a field, ensure that the Name AutoCorrect Options are enabled in Access Options (File tab > Options > Current Database pane). This will ensure that the field is automatically renamed in any other database objects using that field.

Although this option is turned on as a default in new Access 2010 databases, it wasn’t in some earlier versions. If the database that you are working on , therefore, was created in one of these older verisons, it will have inherited the off option.

DELETING A COLUMN

Discussion Although you can control better how to delete fields from a table by using Design (see Editing Table Structure in Design View on page 24), you can also delete them in Datasheet view. When a column is deleted, the columns to the right of it automatically adjust to take up the space.

You cannot delete a field that has a relationship to another table unless you first delete the relationship. All data contained in a deleted column is permanently deleted, and you cannot undo the deletion. Always make a copy of the database file as a backup before making any major edits to tables’ structure.

Page 70: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 65

Procedure 1. Open the table containing the column (field) that you want to delete. 2. Select the Fields tab under Table Tools. 3. Click in the column you wish to delete.

4. In the Add & Delete group, click the Delete command . You can also use the right mouse button to click the column heading and select Delete Field

from the shortcut menu. 5. Confirm the deletion by clicking Yes in the message box.

ADJUSTING ROW HEIGHT

Discussion When a table is displayed in Datasheet view, the default row height is approx. 14 points. You can change the row height to allow long field entries to wrap. This option allows you to display more of the data in a long field entry.

Adjusting a row height by clicking and dragging

Changing the height of a single row changes the height of every row in the table.

You cannot use the Undo feature to undo a change in the row height. To undo a row height change, you must close the table without saving the changes.

Procedure 1. Open the table in Datasheet view. 2. Move the mouse cursor to a horizontal line separating two row selectors.

3. The cursor changes to a two-headed arrow with a bar in the middle . 4. Hold down the mouse button and drag the cursor down to increase the height of

the row.

Page 71: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 66

5. Release the mouse button. 6. The rows are all resized and some rows wrap to the next line.

Or

1. Right click on any row selector. 2. From the shortcut menu, select Row Height… 3. In the Row Height: box, enter a height (in points) for the height of the rows or tick

the Standard Height check box.

4. Click OK.

Or

1. Select the Home tab. 2. Click the More▼ command in the Records group.

3. Click Row Height…. 4. In the Row Height: box, enter a height (in points) for the height of the rows or tick

the Standard Height check box. 5. Click OK.

CHANGING THE COLUMN WIDTH

Discussion In Database view, the standard column width is approx. 11 characters. If a field contains a long entry, you can change the column width to display more of the field entry.

You can change the column width by clicking and dragging or by selecting commands on the Ribbon or the shortcut menu. If you double-click the column separator line to the right of any column header, the width of that column automatically adjusts to display the longest entry in the column.

Page 72: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 67

Adjusting a column width by clicking and dragging

You cannot use the Undo feature to undo changes in column width. To undo a column width change, you must close the table without saving the changes.

Procedure 1. Open the table in Datasheet view. 2. Move the mouse cursor to a vertical line separating two column names. The cursor

changes to a two-headed arrow with a bar in the middle . 3. Hold down the mouse button and drag the cursor left or right to increase or

decrease the width of the column to the left. 4. Release the mouse button.

Or

1. Select the Home tab. 2. Click the More▼ command in the Records group.

3. Click Field Width…. 4. In the Column Width: box, enter a width (in characters) for the width of the

column or tick the Standard Height check box.

Page 73: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 68

Click OK or click the Best Fit button and the column will adjust according to the content.

Or

1. Open the table you wish to alter a column width for. 2. Right click the column heading. 3. Select Field Width… in the shortcut menu. 4. In the Column Width box, type a value or tick the Standard Width check box. Click OK or click the Best Fit button and the column will adjust according to the content.

FORMATTING A DATASHEET

Discussion The default gridlines in datasheet view are black, vertical and horizontal with no special effects. You can alter the gridlines for a datasheet to change their position, style and colour as well as adding background colours or special effects (raised, sunken) to the cells themselves.

You cannot use the Undo feature to undo changes to datasheet formatting. To undo a formatting change, you must close the table without saving the changes.

Formatted Datasheet

Procedure 1. Open the table you wish to format in Datasheet view. 2. Select the Home tab.

Page 74: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 69

3. Click the dialog launcher in bottom right corner of the Text Formatting group.

4. Choose options for your gridlines and cell backgrounds. 5. Click OK.

Tip

You can also change the background colour of cells using commands on the Text Formatting group on the Home tab of the Ribbon.

Click the Background Color button to colour the odd numbered rows of the datasheet, and click the Alternate Row Color

button to colour the even numbered rows.

Additionally, click the Gridlines command to add and remove gridlines between the rows and columns if the datasheet.

CHANGING A FONT ATTRIBUTE

Discussion You can change datasheet font attributes. The font attributes affect the appearance of the data and column headings. You can change the font type, style, and size, as well as add or remove font effects.

You cannot change the font attributes for single pieces of text or individual cells. Any changes made will affect the entire datasheet.

You cannot use the Undo feature to undo changes to datasheet formatting. To undo a formatting change, you must close the table without saving the changes.

Page 75: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 70

Procedure 1. Open the table whose font attributes you want to change. 2. Select the Home tab. 3. In the Text Formatting group, click the font attribute(s) you want to change.

HIDING COLUMNS

Discussion If you do not regularly view or edit one or more table fields, you can hide their corresponding table columns. Hiding columns can make your datasheet narrower and easier to view.

Before you can hide table columns, you must select them. You select a column by clicking its column heading (also called field selector).To select multiple adjacent columns, drag across the headers of the columns you want to select.

Selecting multiple columns in a table

Right-clicking a column heading selects the column and simultaneously displays the column shortcut menu at the same time. The shortcut menu provides access to common column commands, such as hiding columns. You can also access the Hide Fields command in the More command in the Records group of the Home tab.

Page 76: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 71

Procedure 1. Right click the heading of the column you wish to hide. 2. Select Hide Fields in the shortcut menu. 3. The column is hidden from view.

Alternatively

1. Click in the column you want to hide. 2. Select the Home tab. 3. Click the More command. 4. Select Hide Fields.

Tip You can use the above procedure to hide multiple columns. Just select the columns that you wish to hide first.

UNHIDING COLUMNS

Discussion You can redisplay hidden columns. The Unhide Columns dialog box lists all the columns in the table, with a check box to the left of each column name.

The check box is deselected for hidden columns. You can select the check box to redisplay a hidden column.

Page 77: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 72

You can also use the Unhide Columns dialog box to hide multiple, non-adjacent columns.

Procedure 1. Right click on any column heading. 2. Select Unhide Fields… from the shortcut menu. 3. Tick the check box for the hidden column. 4. Click Close.

Or

1. Select the Home tab. 2. Click the More command. 3. Select Unhide Fields. 4. Tick the check box for the hidden column. 5. Click Close.

FREEZING A COLUMN

Discussion If you have a table with multiple fields, all of the columns may not display on screen at the same time. You can scroll to the right to view additional columns; however, you may not be able to see the columns at the far left, which may display necessary information, such as the record identification.

You can freeze columns in Datasheet view. Freezing one or more columns allows you to see the information in the frozen columns no matter how many columns you scroll to the right.

If you freeze a column other than the first column, however, the frozen column moves to the far left position in the datasheet.

Page 78: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 73

Procedure 1. Open the required table in Datasheet view. 2. Select the column(s) you want to freeze. 3. Right click anywhere in the selected headers. 4. Select Freeze Fields in the shortcut menu. 5. The frozen column(s) is/are transferred to the left. You can now scroll back and

forth without the column(s) at the left moving.

Or

1. Click in the column you want to hide or, select multiple columns. 2. Select the Home tab. 3. Click the More command. 4. Select Freeze Fields. 5. The frozen column(s) is/are transferred to the left. You can now scroll back and

forth without the column(s) at the left moving.

UNFREEZING A COLUMN

Discussion Frozen columns can be returned to scrolling with the rest of the table. The unfrozen column(s), however, does/do not return to its/their original position but remain(s) at the left.

Procedure 1. Right click in any column header. 2. Select Unfreeze All Fields in the shortcut menu.

Or

1. Select the Home tab. 2. Click the More command. 3. Select Unfreeze All Fields.

Page 79: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 74

ADDING A TOTALS ROW TO A TABLE

Discussion You can add a Totals row at the bottom of a datasheet to simplify the process of summing a column of data. You can also use the Totals row for other calculations such as averages, counting the number of items in a column, and finding the minimum or maximum value in a column of data.

The Totals row creates aggregate functions. These perform calculations on columns of data and return a single result. You use aggregate functions when you need to calculate a single value, such as a sum or an average for a column. The Totals row remains visible at the bottom of the screen as you scroll up and down the datasheet.

Table displaying Totals row at bottom

The aggregate functions available for a column depend on the column field’s data type. Aggregate functions that the Totals row can perform are:

Page 80: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 75

Function Description Use with the data type(s)

Average Calculates the average value (arithmetic mean) for a column. The column must contain numeric, currency, or date/time data. The function ignores null values.

Number, Decimal, Currency, Date/Time

Count Counts the number of items in a column.

All data types except complex repeating scalar data, such as a column of multivalued lists.

Maximum Returns the item with the highest value. For text data, the highest value is the last alphabetic value; and Access ignores case. The function ignores null values.

Number, Decimal, Currency, Date/Time

Minimum Returns the item with the lowest value. For text data, the lowest value is the first alphabetic value; and Access ignores case. The function ignores null values.

Number, Decimal, Currency, Date/Time

Standard Deviation

Measures how widely values are dispersed from an average value (a mean).

Number, Decimal, Currency

Sum Adds the items in a column. Works only on numeric and currency data.

Number, Decimal, Currency

Variance Measures the statistical variance of all values in the column. You can use this function only on numeric and currency data. If the table contains less than two rows, Access returns a null value.

Number, Decimal, Currency

Procedure 1. Open the table for which you want to add a Totals row. 2. Select the Home tab. 3. Click Totals in the Records group.

4. A Totals row appears at the bottom of the screen. 5. In the Total row, click in the field that you want to add an aggregate function to. 6. Click the drop-down arrow at the left. 7. Select the required function. Options available will depend on the field’s data type

(see table above).

Page 81: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 76

8. To remove the Totals row, repeat items 2 and 3 of this procedure; the Totals command acts as a toggle control.

Aggregate options for Aggregate options for a Currency a Text field or Number field

Page 82: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 5 – Viewing and Formatting Datasheets

WWP Learning and Development LTD Page 77

EXERCISE VIEWING AND FORMATTING DATASHEETS

1. Open Train05. 2. Open the Payments table in datasheet view. 3. Insert a new field to the left of Trainer Initials. 4. Enter a value of 02/02/2012 for the first record. 5. Rename the field Payment Due By. 6. Open the Client table in Datasheet view. 7. Increase the row height by approximately 50%. 8. Change the font to Arial Narrow and the font size to 12. 9. Widen the Name and Address columns so that all data in them appears. 10. Change the cell effect to Sunken. 11. Move the Client ID column to the right of the Name column. 12. Hide the Client ID column. 13. Unhide the Client ID column. 14. Delete the Payment Due By field created earlier. 15. Close all open tables without saving the changes. 16. Close the database.

Page 83: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 78

LESSON 6 - ORGANISING TABLE DATA

In this lesson, you will learn how to:

• Sort records

• Find specific records

• Find records using wildcards

• Carry out an Instant Search

• Use Replace

• Use the field filter list

• Use “Filter by Selection”

• Use “Filter By Form”

Page 84: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 79

SORTING RECORDS

Discussion When you display a table in Datasheet view, Access displays the records in order by their primary key. You may want to edit or print records in a different order (eg. by last name, post code, or amount due).

You can sort records in either ascending or descending order. Ascending order sorts numerically from 0 to 9 and then alphabetically from A to Z. Descending order sorts numerically from 9 to 0 and then alphabetically from Z to A. The Sort and Filter group provides buttons for both ascending and descending sorts.

Procedure 1. Click anywhere in the column you wish to sort by. 2. If necessary, select the Home tab. 3. Click the Ascending or Descending button in the Sort and Filter group. 4. The records are then sorted accordingly.

MULTIPLE LEVEL SORTING

Discussion There will be times when it is necessary to sort record by more than one field, for example, you may wish to sort a table of customers by:

• County, then by

• City, then by

• Customer Name

This is achieved by using the Advanced Filter/Sort tool. When using this tool, a separate tab, or window, appears where the conditions for the sort are entered. When the sort is applied, the tab, or window, containing the sort conditions stays open so that it can quickly be re-used for another or similar sort.

Page 85: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 80

Procedure 1. Open the table that you want to sort. 2. If necessary, select the Home tab. 3. Click the Advanced button in the Sort and Filter group. 4. Click Advanced Filter/Sort…. 5. In the grid at the bottom of the window, click in the Field: box of the first column

at the left. 6. Click the drop down arrow and select the field that you want to sort by first. 7. Click in the Sort: box of the same column. 8. Click the drop down arrow and select the order for the sort (ascending or

descending). 9. Click in the Field: box of the second column from the left. 10. Click the drop down arrow and select the field that you want to sort by second. 11. Click in the Sort: box of the same column. 12. Click the drop down arrow and select the order for the sort (ascending or

descending). 13. Continue adding into columns from left to right, fields and sort orders as

necessary.

14. Click the Toggle Filter command in the Sort and Filter group on the Ribbon.

Defining a multiple field sort

CLEARING A SORT ORDER

Discussion Although you can repeat the procedures above to clear a custom sort order and restore the table to sorting by primary key, it can be quicker to use the Remove Sort command.

Page 86: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 81

Procedure 1. Select the Home tab. 2. Click the Remove Sort command in the Sort & Filter group.

Alternatively, you can close the table without saving the changes when prompted.

FINDING SPECIFIC RECORDS

Discussion The Find feature allows you to locate records quickly. You can search for records that contain a unique value in a certain field, or you can find all records that have a common value in a field. Access scans the selected field, beginning with the current record, and highlights the first instance of the search text it finds. You can repeat the search to find additional records containing the same data.

In the Find and Replace dialog box, you can select options to control how Access searches for matching records. You can use the Look In list to search the current column or the entire table. The options on the Match list allow you to specify whether to match any part of the field, the whole field, or only the start of the field.

The Find and Replace dialog box remains open during a search. If needed, you can move the dialog box out of the way to view the search as it progresses.

Procedure 1. To find specific records in a table, first open the table you wish to search. 2. Select the Home tab. 3. Click in the field you wish to search. 4. Click the Find button in the Find group. 5. Type the text you want to find in either uppercase or lowercase letters. If you want

to make the search case sensitive, tick the Match Case check box at the bottom of the dialog box.

Page 87: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 82

6. Click the Look in: list arrow to specify whether Find should search the current field or the entire table/document.

7. Click the Match list arrow and indicate whether you want the text you typed to match all or part of the field.

8. Click the Find Next button as many times as necessary to view all records containing the specified text.

9. When all the records have been found, a message box is displayed.

10. Click the OK button. 11. When finished, click the Close or Cancel button.

Tip

The Search as Formatted check box generally applies to currency and date/time fields. If the check box is enabled and you search for the date 01/03/2012, the data will NOT be found if the field is formatted to a long date style (eg. 1 March 2012). You MUST enter the Find text exactly as it appears in the column, ie. 1 March 2012.

Similarly, if a field has been formatted to a currency style and you search for 120.25, the data will not be found if it appears as £120.25 in the column.

It may be safer, therefore, to untick the check box to carry out a more flexible search for the data that is unrestricted by the formatting style used.

FINDING RECORDS USING WILDCARDS

Discussion You can use wildcards when searching for data. Wildcards are characters that represent other characters. They allow you to find records, even if you are not sure how the entry appears in the field.

Wildcards also allow you to find records that share a common entry within a field, but not necessarily the entire field entry.

You can use the following wildcards in a find:

Wildcard Description

*

Represents any number of characters. It can be used anywhere in the search text. For example, North* will find all entries beginning with the word North; *Sports will find all entries ending with the word Sports; and *Sports* will find all entries containing the word Sports.

? Represents only one character; for example, Sm?th will find Smith, Smyth, etc.

Page 88: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 83

[ ] Finds any character enclosed in the set; for example, b[ai]t will find bat and bit, but not bet and but.

! Finds any character except the ones enclosed in the set; for example, b[!ai]t will find bet and but, but not bat or bit.

- Finds any character in a range in a set; for example, b[u-w]t finds but, bvt, and bwt.

# Represents only one digit; for example, 1980# finds 19801, 19802, 19803, etc.

CARRYING OUT AN INSTANT SEARCH

Discussion Access 2010 includes an Instant Search feature designed to quickly find any piece of data in a table “as-you-type.”

The Instant Search box is located on the Status Bar to the right of the Navigation Buttons.

The instant search feature searches the entire table for the search text in any part of a field. It will highlight the first instance of the search text starting at the beginning of the table, but by pressing [Enter] on the keyboard it will move down the table highlighting other instances. If you press [Enter] and no further data is highlighted, it is because there are no further instances of the search text.

You can use only use the asterisk ( * ) and question mark ( ? ) wildcard characters in an Instant Search.

Instant Search is not case or formatting sensitive.

Procedure 1. Open the table that you want to search.

2. Click into the Search box to the right of the Navigation Buttons . 3. Type the required search text. Access will instantly highlight the first match. 4. Press [Enter] to find more instances of the search text.

USING REPLACE

Discussion The Replace feature allows you to quickly locate and replace data in a field. This feature is especially useful if the same information must be changed in several records. Access scans the selected field, beginning with the current record, and selects the first instance of the search text it finds.

Page 89: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 84

You can replace each instance of the search text separately by clicking the Find Next button and then clicking Replace. On clicking Replace, the next instance of the search text is found. If you do not want to replace a particular instance of the search text, you just click the Find Next button to move to the next one.

Selecting the Replace All button in the Find and Replace dialog box replaces all data that matches the search text. Make sure that you want to replace all data before you use the Replace All button because you may not be able to retrieve the data once it has been replaced.

Procedure 1. Open the table in Datasheet view. 2. Click the insertion point anywhere in the column you want to search. 3. Click the Home tab. 4. Click the Replace button. 5. Type the text you want to find. 6. Press the [Tab] key. 7. Click the Find Next button. 8. Click the Replace button. 9. Click the Replace All button. 10. In the Message box, click the OK button to confirm the replacement(s).

11. Click the Close or Cancel button.

THE FIELD FILTER LIST

Discussion Filtering data allows you to view only those records with which you want to work by hiding the records you do not want to see. For example, you can filter data in a customers table so that only the records of those customers located in a specific town or city appear.

Page 90: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 85

When a filter is in effect, the (Filtered) indicator appears on the status bar.

… and a small funnel icon appears alongside the filter drop-down arrow in the column

heading .

The easiest way to extract specific data from a field is to use the Filter feature. This takes the form of small, black drop-down arrows at the right of each column heading (except Attachment and Hyperlink field types). By clicking one of these arrows, a list appears for that field offering options for selecting and setting filter criteria. The list can also be used for sorting the field.

Applying a filter

Initially, the filter list displays unique, exact matches for the field. By ticking or unticking check boxes to the left of each item, you can include or exclude them from the results when you click OK.

Depending on the field chosen, additional conditional criteria can be set by selecting the <Data Type> Filters ► command. This displays a sub menu from where you can specify more precise, custom criteria to filter by.

NB. Yes/No fields do not offer additional criteria and display No as 0 and Yes as -1.

Example of conditional criteria filters available for number and text fields

You can also display the filter list by clicking in a column and clicking the Filter command in the Sort & Filter group.

Page 91: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 86

Additionally, you can simultaneously filter on more than one field to create AND conditions, eg. filter all records where the Publisher is Harper Collins and the CoverType is P.

A filter can be removed by clicking the Toggle Filter command or displaying the filter list and selecting Clear filter from <field name> command.

Procedure 1. Open the table that you want to filter. 2. Click the drop-down arrow at the right of the column heading that you want to

filter data from. 3. Untick and/or tick check boxes next to the items listed. 4. Click OK. 5. To filter using additional conditional criteria, hold the mouse pointer over the

<field data type> Filters command (eg. Text Filters, Number Filters, Date Filters, etc.).

6. Select an option from the side menu. 7. Complete additional information as required. 8. Click OK.

Examples of Text and Number field types criteria

Example of Date field type criteria

USING FILTER BY SELECTION

Discussion A quick and easy way to filter data in Access is to use the Selection feature. This feature requires you first to select (click into) a cell containing data for filtering. The command then gives you popular criteria options to select from.

Page 92: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 87

The filter remains in effect until you remove it, though it can be activated and de-activated by clicking on the Toggle Filter button.

Whenever you have completely finished with a filter you should clear it, otherwise it may remain active whenever you try to apply another filter. All filters are cleared by clicking the Advanced command in the Sort & Filter group and then clicking the Clear All Filters option.

Procedure 1. Open the table you wish to filter. 2. Select any cell containing the data by which you want to filter. 3. Select the Home tab. 4. Click the Selection button in the Sort & Filter group. 5. Choose a criteria option. 6. Remove the filter by clicking the Toggle Filter button. 7. Re-activate the filter, if necessary, by clicking the Toggle Filter button again.

FILTERING BY FORM

Discussion Although now superseded by the field filter list (see page 84) you can use the Filter By Form feature to filter data. The Filter By Form feature displays a blank record in the Filter by Form window. You enter the data by which you want to filter in the corresponding field. When the filter is applied, only those records with matching data appear; all the other records are hidden.

Page 93: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 88

The Filter by Form feature allows you to filter by more than one field. This feature is especially useful when you are filtering a large database with many fields and/or records.

All fields in the Filter By Form window have a lookup list that displays existing field data so that you can easily choose the data by which you want to filter. These lookup lists are useful because you do not have to remember exactly how the data was entered into the field.

You can use the Filter By Form window to add OR criteria to a filter. This is used where you want to extract from the table, two separate sets of records, for example: display all records where the Publisher field equals Bantam or Harper Collins.

You can combine Or conditions with AND conditions to create complex criteria such as: display records where the Publisher is Bantam AND the Price is greater than 10 OR the Publisher is Harper Collins AND the Price is over 20.

Procedure 1. Open the table you want to apply the filter to. 2. Select the Home tab. 3. Click the Advanced command in the Sort & Filter group.

4. Clear all other filters by clicking the Clear All Filters command. 5. Click again the Advanced command in the Sort & Filter group. 6. Click Filter By Form. 7. If you have not removed any existing filters and they are displayed, you can still

remove them by clicking on Delete button in the Records group. 8. In the Filter by Form window, click in the field by which you want to filter. 9. Click the field list down arrow.

10. From the list, click the data by which you want to filter. 11. If required, click other field list down arrows and select additional data to filter. 12. If necessary, click the OR tab at the bottom of the Filter By Form window.

13. Repeat steps 9 to 11.

Page 94: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 89

14. If required, add more OR conditions to the filter criteria. 15. When finished, click the Toggle Filter button to apply the filter.

Page 95: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 6 – Organising Table Data

WWP Learning and Development LTD Page 90

EXERCISE ORGANISING TABLE DATA

1. Open Train06. 2. Open the Client table in Datasheet view. 3. Sort the records in descending order by the Zip field. 4. Sort the records in ascending order by the Client ID field. 5. Find all the records in the state of Texas (TX) - 3 records. 6. Use a wildcard to find all records with a telephone number that starts with 713 - 2

records. 7. Use the Replace feature to find the 206-707-7070 telephone number and replace it

with 206-707-8954. 8. Close and save the Client table. 9. Open the Payment table in Datasheet view. 10. Use Filter By Selection to extract all records with VISA as the type of payment - 9

records. 11. Clear the filter. 12. Use the Field Filter to extract all records with a balance due that is not £0.00 - 7

records. 13. Clear the filter. 14. Use a filter of your choice to find all records with a payment date of 30/3/01 - 2

records. 15. Clear the filter. 16. Use Filter By Form (Advanced) to find all records with a balance due of 100 and

VISA type of payment (Hint: Remember to Clear All Filters before you apply the new filter.) - 1 record.

17. Close the table without saving changes. 18. Close the database.

Page 96: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 91

LESSON 7 - USING SIMPLE QUERIES

In this lesson, you will learn how to:

• Use queries and dynasets

• Use the Query Wizard

• Create a query in Design view

• Open a query

• Run a query

• Add a table to a query

• Join tables in a query

Page 97: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 92

INTRODUCTION

Discussion A query is a description of the records you want to retrieve from a database. It is a means of extracting information from tables. You can use queries to analyse the data in a table or to extract data for a form or report. Queries are commonly used to display data in related tables and enable you to control not only which records to display, but also which fields. For example, you may want to give a sales representative a list of the contacts and telephone numbers for a particular region; you can create a query to extract just the contact names and telephone numbers within the specified region.

A query does not contain data; rather, it is a set of instructions. Access uses these instructions to select and display the desired records in a table. As a result, whenever new data is added to the queried table, the query is automatically updated; if the new records meet the conditions of the query, they will be included when the query runs.

When you open or run a query, a dynaset appears. A dynaset contains all the fields and records that meet the conditions of the query. Although the dynaset is not a table, it can be used to edit or add new records in the queried tables.

THE QUERY WIZARD

Discussion The Query Wizard guides you through the steps for creating a basic select query. When you use the Query Wizard, you select the table you want to use and the fields you want the query to display. Then, you name the query and choose whether to display the results of the query or go to Design view to work with the query design.

All queries you create and save are listed under Queries in the Navigation pane. You can then double-click a query to run it and display the results. When you run a select query the

Page 98: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 93

results show only the selected fields for each record in the table that matches your selection criteria.

To view the queries in the Navigation pane, click the pane heading button and select All Access Objects, or Queries if you only want to see the queries in the pane.

Procedure 1. Select the Create tab.

2. Click the Query Wizard button in the Queries group . 3. In the New Query dialog box, select the type of query you want.

4. Click the OK button. 5. In the Tables/Queries list, choose the one you want to query.

6. In the Available fields: list, select the first field you want in the query.

7. Click the arrow to the right of the Available Fields list box. 8. The field is added to the Selected fields: list. 9. Add other fields as required in the same way. 10. Click the Next button.

Page 99: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 94

11. Change the name of the query if you wish. 12. Click the Finish button. 13. The result of the query is displayed in the document window.

CREATING A QUERY IN DESIGN VIEW

Discussion Although a wizard can be useful when you build your first queries, you do not need to use a wizard. You can create a query in Design view. This option gives you the most flexibility in designing a query. It allows you to add criteria for selecting records, as well as sorting the dynaset.

When you create a query in Design view, the design grid is used to set up the query. The field lists of all tables to be used in the query appears in the top pane. The design grid appears in the bottom pane.

Query design view and Show Table dialog box

You drag the fields you want to use in the query to the design grid and then add the desired criteria and sorts. You can add all the fields from a table to the design grid by dragging the asterisk (*) at the top of the field list to the Field row in any column. You can also add a field to a query by clicking in any blank column in the Field row, clicking the drop-down arrow, and then selecting the field you want to add, or by dragging the field to the design grid.

Procedure 1. Select the Create tab. 2. Click the Query Design button in the Queries group

.

3. Click the table you want to use. 4. Click the Add button. 5. Repeat for additional tables.

Page 100: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 95

6. Click the Close button. 7. In the field list in the upper pane, double-click in turn on each field you want to

include in the query. 8. In the Design grid, enter any required criteria for the result of the query. 9. In the Sort box, click the list arrow to specify a sort order. 10. Click the Save button. 11. Type a name for the query. 12. Click the OK button.

A completed query design

OPENING A QUERY

Discussion When you open a query, Access runs the query and displays its dynaset in Datasheet view. If you have added records since the last time you ran the query, the new records will appear as long as they meet the query criteria.

Procedure 1. If necessary, show Queries in the Navigation Pane.

2. Double-click the query you want to open.

Page 101: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 96

Or

1. Use the right mouse button to click the query you want to open. 2. In the shortcut menu, click Open. 3. The result of the query is displayed in the document pane.

RUNNING A QUERY

Discussion You can run a query and display its dynaset directly from Design View. This option is useful for testing the query design to see if its dynaset contains the desired information. While viewing a query, you can switch back to Design view at any time to make any necessary changes.

Running a query does not save the query design. You are prompted to save the changes if you close the dynaset after running a query.

Procedure 1. Click the Run or the upper half of the View button in the Results group of the

Design window Ribbon.

2. To return to Design View, click the lower half of the View button in the Views

group on the Home tab of the Ribbon.

Page 102: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 97

ADDING A TABLE TO A QUERY

Discussion You can use more than one table in a query. The field lists of all tables added to a query appear in the top pane of Design view. Join lines will show between the related fields if the tables have had relationships created between them (see Lesson 16 on page 185) or, the tables follow the following rules:

• Related field names are identically spelled.

• Related field are same data type (exception to this is the AutoNumber field which is compatible to a number field in another table with a Long Integer field size.

• One of the related fields is a Primary Key.

The tables must be joined in order for the query to produce accurate and meaningful results. If the tables do not join automatically, you can create a manual join in the top pane of Design view by clicking and dragging between the related fields.

Query using multiple tables

Once you have added a table to a query and you are satisfied that any related fields are correctly joined, you can add fields from its field list to the design grid. The Table row in the design grid indicates the table in which a field is stored.

When you create a new query in Design view, the Show Table dialog box opens automatically so that you can add the desired table(s). However, when you modify an existing query in Design view, you must manually open it.

Procedure 1. To add a table to a query, first open the query in Design view.

2. Click the Show Table button in the Query Setup group . 3. Select the table name you want to add and click the Add button or double-click the

table name you want to add. 4. Click the Close button.

Page 103: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 98

JOIN TYPES IN A QUERY

Discussion As was described in the Adding a Table to a Query section of this manual (see page 96), there must be valid joins between multiple tables in order for accurate and relevant data to be extracted to a dynaset.

The join type is also important. The default type is an inner join, where records are only included in the dynaset if there is matching data in the join fields of both tables. You can, however, create an outer join, where all the records from the one table appear, even if there is no matching data in the other table.

To specify the join type, you need to open the Join Properties dialog box. There are three type of join available:

Type Description Notes 1 Only include rows where

the joined fields from both tables are equal.

This is the default inner join.

2 Include ALL rows from <<first table>> and only those records from <<second table>> where the joined fields are equal.

This is an outer join. Assume that <<first table>> is a table of customers and <<second table>> a table of orders. You have added to the query grid the Customer Name field from the customer table and the Order ID field from the Orders table. The resulting dynaset would show ALL the customers names but in cases where a customer has not got any related orders in the Orders table, it will leave a blank. This could be useful to identify customers in your

Page 104: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 99

database who haven’t placed any orders for your products.

3 Include ALL rows from <<second table>> and only those records from <<first table>> where the joined fields are equal.

This is also an outer join. Using the same tables and fields as in type 2 above, the resulting dynaset would show ALL the Order IDs but in cases where an order ID has not got a related customer name, it will leave a blank. This could be useful to identify orders which do not have a recognisable customer due to input error or because the customer records have been inadvertently deleted or lost.

In the outer join extract below, it is possible to see that B&B Sporting Goods, Champs and The Complete Athlete have no order numbers. It is safe to assume, therefore, that they have not purchased any products. This would have not been possible to see with an inner join because the three shops names would not have appeared in the query.

Procedure 1. To join tables in a query, first open the query in Design view. 2. Drag the desired join field from one field list to the matching field in a second field

list. 3. Double-click the middle segment of the join line. 4. Select the join type you require. 5. Click the OK button. 6. The arrow head indicates the direction of the join. 7. View the Query.

Page 105: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 100

Tables joined with an outer join. Direction of arrow indicates that

ALL records will be shown from the Customers General table

Page 106: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 7 – Using Simple Queries

WWP Learning and Development LTD Page 101

EXERCISE USING SIMPLE QUERIES

1. Open Train09. 2. Use the Query Wizard to create a simple query. 3. Select the Client table and add the Client ID, Name, and Phone No fields. 4. Name the query Client Names and view its dynaset. Then, close the Client Names

query. 5. Create a query in Design view. 6. Add the Client table to the query. Then add the Client ID and Name fields to the

design grid. 7. Save the query as Client Query and then close it. 8. Run the Client Query to view its dynaset. 9. Return to Design view. 10. Add the Project table to the Client Query; note that an automatic join is created. 11. Add the Project ID, Course Name, Start Date, and Cost fields from the Project

field list to the query. 12. Run the query from Design view. 13. Close the Client Query and save the changes. 14. Close the database file.

Page 107: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 102

LESSON 8 - MODIFYING QUERY RESULTS

In this lesson, you will learn how to:

• Sort a query

• Add criteria to a query

• Hide a field in a query

• Add a record using a query

• Print a query

Page 108: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 8 – Modifying Query Results

WWP Learning and Development LTD Page 103

SORTING A QUERY

Discussion When you run a query, the records in the dynaset appear in the same order in which they appear in the design grid. You can either sort the dynaset or assigning a sort order in the query design. You can sort a dynaset just as you would sort a table; however, you would have to perform the sort every time you run the query. If you assign a sort order in the query design, Access will sort the dynaset automatically each time you run the query.

In Design View, clicking in the Sort row of a field displays a pull down arrow. Clicking on the arrow shows a list of options from where you can select a sort order.

You can sort on more than one field. For example, you can sort by county and then by town within each region. To sort on more than one field, the first sort field must be to the left of the second sort field in the query design grid, since Access sorts from left to right. The example below displays four fields in the query results sorted first by Region, then by Country, and then by City.

If you need to carry out a multilevel sort in a query and the fields in the grid are not in the correct left-to-right order, you can move them. Hold the mouse pointer over the thin, grey bar at the top of a column that you want to move, until it changes to a down pointing black arrow. Click to select the entire column (it will highlight with a black background). Hold the mouse pointer in the same position and while holding down the mouse button, drag left or right until a black bar appears between the columns where you want to move the column. Release the mouse button.

Selecting a field in the query grid

1 2 3

Page 109: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 8 – Modifying Query Results

WWP Learning and Development LTD Page 104

Moving a field in the query grid

Procedure Single level sort

1. Open the query that you want to add a sort order to in Design View. 2. In the query grid, click in the sort row under the field that you want to sort by. 3. Click the drop-down arrow. 4. Select a sort option. 5. View or Run the query. 6. Save changes, if desired.

Multiple level sort

1. Open the query that you want to add a sort order to in Design View. 2. In the query grid, arrange the fields so that the ones you want to sort on are in a

left-to-right order. It is not necessary for them to be the first fields at the left of the grid.

3. Click in the sort row under the field that you want to sort by first (the one nearest to the left of the grid).

4. Select a sort option. 5. Click in the sort row under the field that you want to sort by next (the second

nearest to the left of the grid). 6. Select a sort option. 7. Continue in similar fashion until all fields have their sort order defined. 8. View or Run the query. 9. Save changes, if necessary.

ADDING SIMPLE CRITERIA TO A QUERY

Discussion You can use the Criteria row in the design grid to restrict the number of records a query returns.

To select records that match a single value, you can enter the value you want to match in the Criteria row of the applicable field. Access automatically inserts quotation marks (" ") around text entries and hash symbols (#) around date entries; nothing appears around numeric entries.

When you run the query, only those records with values that match the criteria appear in the dynaset. A field name in the Criteria row must be entered exactly as it appears in the field list.

Page 110: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 8 – Modifying Query Results

WWP Learning and Development LTD Page 105

Procedure 1. Open the query that you want to add criteria to in Design view. 2. Click in the Criteria box under the field you want to match. 3. Enter the value you want to match. 4. Press the [Enter] key. 5. View or Run the query. 6. Save changes, if required.

HIDING A FIELD IN A QUERY

Discussion You can select records that meet specified field criteria without displaying the field in the dynaset. This option is useful when all the records meet the same specified criteria and, as a result, the field does not need to appear.

The design grid provides a Show row for each field. If the Show option is selected, the field will appear in the dynaset; if it is deselected, the field will not appear in the dynaset. The Show option is selected by default.

Procedure 1. Open the query in Design view. 2. Untick the Show check box for the field you want to hide.

Page 111: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 8 – Modifying Query Results

WWP Learning and Development LTD Page 106

ADDING NEW RECORDS AND EDITING DATA IN A QUERY

Discussion You can use a query to update records in related tables. When you enter data into a query dynaset, Access automatically completes the dynaset data, as applicable, and enters the data into the related tables as well.

You can always edit information in queries based on a single table, as is the case in queries based on one-to-one relationships. In queries based on a one-to-many relationship, you may not always be able to edit the data. (see Lesson 16 on page 185 to learn more about relationships).

There are many other “advanced” reasons why you may not be able to edit data in a query and a good description of these together with possible solutions can be found at the following web address: http://office.microsoft.com/en-us/access-help/edit-data-in-a-query-HA010097876.aspx .

Procedure Adding a new record using a query

1. Open the query you want to use for adding a new record.

2. Click the New button in the Records group of the Home tab or, click the New (blank) record button in the Navigation Bar at the bottom of the datasheet.

3. Enter the required value in the first field. 4. Press the [Enter] key. 5. Enter the data into each of the remaining fields, as required. 6. Save the record by clicking into another record or by closing the datasheet.

Editing data in a query

1. Open the query you want to use for editing data. 2. Go to and select the data you want to edit. 3. Make changes as necessary. 4. Save the changes by clicking into another record or by closing the datasheet.

PRINTING A QUERY

Discussion You can print a query dynaset. You can run the query and then print the dynaset, or you can save time by printing the dynaset directly from the main application window.

If you print the dynaset from the application window, Access runs the query and sends the results directly to the printer, rather than to the screen.

Access still retains a separate Print Preview screen (unlike other Office 2010 applications).

Page 112: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 8 – Modifying Query Results

WWP Learning and Development LTD Page 107

Procedure 1. Select the query you want to print

in the Navigation Pane or, open the query to view it.

2. Select the File tab. 3. Select Print at the left. 4. Click Quick Print or, click Print

for more printing options (eg. select a printer, number of copies, etc.).

Page 113: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 8 – Modifying Query Results

WWP Learning and Development LTD Page 108

EXERCISE MODIFYING QUERY RESULTS

1. Open Train10. 2. Open the Project table in Datasheet view. Scroll to the last record; notice that it has

a Project ID of 1024, for a Client ID of WENDT. Close the Project table. 3. Open the Client Query in Design view. 4. Sort the query in ascending order by the Project ID field. Then, run the query. 5. Add a new record to the dynaset, using the following data:

Field Data

Client ID ABEL

Name Abella & Son

Project ID 1025

Course Name INTMA22

Start Date 19/06/01

End Date 19/06/01

Cost 100

Trainer Initials EK

6. Close the query and save the changes. 7. Open the Project table in Datasheet view. Scroll to the last record; notice the new

ABEL record. Then, close the Project table. 8. Re-open the Client Query in Design view. 9. Add a criteria of 125 to the Cost field. Then, run the query. 10. Switch back to Design view. Hide the Cost field and run the query again. Then,

close the Client Query without saving the changes. 11. View the Client Query dynaset in Print Preview. 12. Close Print Preview and close the database file.

Page 114: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 109

LESSON 9 - CREATING BASIC FORMS

In this lesson, you will learn how to:

• Understand forms

• Use Form Tools

• Use the Form Wizard

• Navigate records in a form

• Print records in a form

• Work with data in a form

Page 115: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 110

OVERVIEW

Discussion Forms are created from tables or queries and like datasheets, can be used for viewing and editing data. However, you can also use them to present data in a more attractive format and layout than a datasheet. Any information added or edited in a form, will usually be saved in the underlying table.

Forms are often designed to display all the fields for a single record within the form window, eliminating the need to scroll. You can also display data from related tables in one form creating a main/subform arrangement and in advanced cases, automate the database by assigning macros to form controls and buttons

Simple columnar form

In Access 2010, you can create a form by:

• using a one-click “Form Tools” command or • using the Form Wizard;

The Create tab

USING FORM TOOLS TO CREATE A FORM

Discussion The fastest way to create a form is to use one of the “Form Tools” on the Create tab. These will create a form with a single mouse-click. When you use Form Tools, all the fields from the underlying data source are placed on the form. Most Form Tools create forms in “layouts” (a type of table) and display the form in Layout View. You can start using the new form immediately, or you can make simple modifications to it in Layout View (eg. adjust the size

Page 116: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 111

and position of text boxes, see page 124) or, open it in Design View to make more detailed and advanced changes to suit your needs (see page 131).

Always open a form in Form View, however, to make full use of any auto functionality that may have been built to the form, eg. macro buttons, list boxes and combo lists.

You can use Form Tools to create a:

• basic form

• blank form

• multiple items form

• datasheet form, a split form

• Modal Dialog and

• PivotChart or PivotTable.

Blank forms, modal dialogs and PivotCharts/Tables are outside the scope of this course but covered on the Microsoft Access 2010 Advanced course.

Basic Forms

When using form tools to create a form, you first need to select in the Navigation Pane the table or query you wish to be displayed on the form (the table or query does not have to be open).

Single table basic form created using Form Tools

If you use Form Tools to create a form based on a table that has a one-to-many relationship with another table (see page 187), Access adds a datasheet on the form to display data from the related “many” table. This is also known as a main form/subform combination.

Page 117: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 112

Related tables form created using Form Tools

You can delete the datasheet from the form if you do not need it. If the table that you base the form on has a one-to-many relationship with more than just one other table Access does not add any datasheets to the form. Similarly, Access does not add any additional data if the table has one-to-one relationships with other tables.

Split Forms

A split form gives you two views of the data at the same time — a Form view and a Datasheet view. You can use the datasheet portion of the form to quickly locate a record, and then use the form portion to view or edit the record.

A split form differs from a form/subform combination in that the two views are connected to the same data source and are synchronized with one another at all times. Selecting a field in one part of the form selects the same field in the other part of the form. You can add, edit, or delete data from either part (as long as the record source is updatable, and the form has not had its properties changed to prevent these actions).

Example of a split form

Multiple Items Forms

When you use the Multiple Items Tool, the form created resembles a datasheet. The data is arranged in rows and columns, and you can see more than one record at a time. A Multiple

Page 118: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 113

Items Form, however, gives you more customisation options than a datasheet, such as the ability to add graphical elements, buttons, and other controls.

Like other forms created with the Form Tools, the form is displayed in Layout view where you can make simple design changes while it is displaying data. For example, you can adjust the size of the text boxes to fit the data. It can also be opened in form Design View for more detailed and advanced modifications.

Example of a multiple items form

Datasheet Forms

This form resembles a table or query datasheet. The data is arranged in rows and columns, and you can see more than one record at a time. Its use is primarily to serve as a subform when manually creating main form/subform combinations.

Example of datasheet form

Form Tools can also be used to initiate the creation of Navigation Forms.

Page 119: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 114

These are designed to display a menu along one (or more) of their edges giving commands for opening other forms (similar to a switchboard). They are included mainly for using in Access web databases (stored in SharePoint) but there is no reason why they can’t be used in desktop databases. They are, however, outside the scope of this course.

Procedure 1. Select in the Navigation Form the table or query that you want to use for the form. 2. Select the Create tab. 3. In the Forms group, click on any one of the following commands to create an

instant form. Refer to the discussion above for descriptions of the various types.

a. Form

b. More Forms > Multiple Items

c. More Forms > Datasheet

d. More Forms > creates a form with a chart based on the table datasheet

4. When you have clicked on the relevant button, the form is displayed in Layout view.

5. Click Save button on the Quick Access Toolbar. 6. Enter a name for the form. 7. Click OK. 8. Close the form.

USING THE FORM WIZARD

Discussion As described in the previous topic, forms can be created with Form Tools that create forms in a “layout” and display it in Layout View. The Form Wizard can also be used to create a form and provides the functionality to create four types of form: columnar, tabular, datasheet and justified.

Page 120: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 115

Simple columnar form created by the Forms Wizard

The Form Wizard guides you, step by step, through the form creation process. First, you must choose the table or query on which you want to base the form and then you can select the fields you want to include. Next, you select the desired type of form layout and you can then select a style from a variety of predefined styles provided by Access. Finally, you must name the form. The Wizard opens the form in Form View not Layout View.

You can use the Form Wizard to create a form based on two tables that have a one-to-many relationship. This will result in the mainform/subform arrangement discussed in the previous topic. If creating a form using two such tables, the Form Wizard will prompt you to choose how you want to group the data.

Procedure (single table or a query) 1. Select the Create tab. 2. Click the Form Wizard command in the Forms group,.

3. In the Tables/Queries list, click the list arrow.

4. Click the table or query you wish to use for the form. 5. Specify the fields you want to include in the form by selecting each in turn and

clicking on the right arrow or, by double-clicking on each field to be included. 6. Click the Next button.

Page 121: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 116

7. Select the desired form layout.

8. Click the Next button. 9. Enter a name for the form.

10. Choose whether to open the form in display, or Design view. 11. Click the Finish button.

Procedure (two tables with a one-to-many relationship) NB Tables MUST have a relationship created between them

1. Select the Create tab. 2. Click the Form Wizard command in the Forms group,.

3. Click the Tables/Queries drop-down list. 4. Select the “one” table that you wish to use for the form.

Page 122: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 117

5. Specify the fields you want to include on the form by selecting each in turn and clicking the right arrow or, by double-clicking on each field to be included.

6. Click the Tables/Queries drop-down list. 7. Select the “many” table you wish to use for the form. 8. Specify the fields you want to include in the form by selecting each in turn and

clicking on the right arrow or, by double-clicking on each field to be included.

9. Click the Next button. 10. Select the table you want to group the data. This will usually be the “one” table.

11. Click the Next button. 12. Select the desired layout for the subform. This will usually be datasheet.

13. Click the Next button. 14. Enter a name for the main form and subform or, accept the default names. 15. Choose whether to open the form in display, or Design view.

Page 123: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 118

16. Click the Finish button.

NAVIGATING RECORDS IN A FORM

Discussion Navigating records in a form, no matter how created, is similar to navigating records in Datasheet view. You can use the navigation buttons at the bottom of the window to display records in a form.

The following navigation buttons are available in Form view:

Button Description

Displays the first record

Displays the previous record

Displays the next record

Displays the last record

You can also press the [Ctrl+Home] key combination to display the first record, the [Ctrl+End] key combination to display the last record.

The [Page Up] and [Page Down] keys display the previous and next records, respectively.

You can go directly to a record by selecting the number in the Record box (located within the navigation buttons at the bottom of the window), typing the number of the record you want to display, and pressing the [Enter] key.

PRINTING RECORDS IN A FORM

Discussion You can print an open form. If you use the Print command to print all the data, Access fits as many whole forms as possible on each page; Access will not break a form in the middle. If a form is large and there are numerous records in it, you may be using a large amount of paper and printer time.

Page 124: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 119

Printed out forms

If you use the Print command, you can print all records, only specified pages, or all selected records, thereby saving time and paper.

You do not need to open the form to print it but merely select it in the Navigation Pane.

Procedure 1. Open the form you want to print or select it in the Navigation Pane. 2. Select the File tab. 3. Select Print at the left. 4. Click Quick Print or, click Print for more printing options (eg. select a printer,

number of copies, etc.).

The Print dialog box

Page 125: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 120

WORKING WITH DATA IN A FORM

Discussion Forms are frequently used to add records to one or more tables. It can be easier to work in a well-designed form than in the underlying table because forms are usually designed to display all the fields for a single record within the form window, eliminating the need to scroll.

You can use the [Enter] key to move between fields as you enter data. If you want to skip one or more fields, you can press the [Tab] key until the insertion point appears in the desired field, or you can click in the field in which you want to enter data.

When you press the [Enter] key after entering data in the last field in a record, Access automatically saves the record and displays a blank form for entering another record. You can use the [Shift+Tab] key combination to move to the previous field.

You can also use many of the tools and techniques described in Lesson 7 on page 78 (Organising Table Data) to sort, filter, find and replace data in a form.

Procedure Adding a new record using a form

1. Open the form you want to use for adding a new record.

2. Click the New button in the Records group of the Home tab or, click the New (blank) record button in the Navigation Bar at the bottom of the form.

3. Enter the required value in the first field. 4. Press the [Enter] key. 5. Enter the data into each of the remaining fields, as required. 6. Save the record by navigating to another record or by closing the form.

Editing data in a form

1. Open the form you want to use for editing data. 2. Go to and select the data you want to edit. 3. Make changes as necessary. 4. Save the changes by navigating to another record or by closing the form.

Sorting data in a form

1. Click in the field you wish to sort by. If you are using a tabular form, this will be anywhere in the field column (like in a table or query). If you are using a columnar form, this will be the relevant text box on any record. In the screenshot below, the cursor has been positioned in a ContactName field ready for sorting.

Page 126: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 121

2. If necessary, select the Home tab. 3. Click the Ascending or Descending button in the Sort and Filter group. 4. The records are sorted accordingly.

Removing a sort order (reset to sorting by primary key)

1. Select the Home tab. 2. Click the Remove Sort command in the Sort & Filter group.

Alternatively, you can close the table without saving the changes when prompted.

Finding data

1. Open the form you wish to use for searching. 2. Select the Home tab. 3. Click in the field you wish to search (refer to item 1 under Sorting data in a form

for further details). 4. Click the Find button in the Find group. 5. Type the text you want to find in either uppercase or lowercase letters. If you want

to make the search case sensitive, tick the Match Case check box at the bottom of the dialog box.

6. Click the Look in: list arrow to specify whether Find should search the current field or the entire table/document.

7. Click the Match list arrow and indicate whether you want the text you typed to match all or part of the field.

8. Click the Find Next button as many times as necessary to view all records containing the specified text.

9. When all the records have been found, a message box is displayed.

10. Click the OK button. 11. When finished, click the Close or Cancel button.

Filtering records in a form

1. Open the form you wish to use for filtering records.

Page 127: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 122

2. Select a cell or text box containing the data by which you want to filter. If using a columnar form, you may need to navigate to another record.

3. Select the Home tab. 4. Click the Selection button in the Sort & Filter group. 5. Choose a criteria option. 6. Remove the filter by clicking the Toggle Filter button. 7. Re-activate the filter, if necessary, by clicking the Toggle Filter button again.

NB. The procedures above are not a definitive list of actions and tasks that you can perform on data using forms. Refer to Lesson 7 (page 78) or Access Help for further information.

Page 128: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 9 – Creating Basic Forms

WWP Learning and Development LTD Page 123

EXERCISE CREATING BASIC FORMS

1. Open Train11. 2. Use the Form Wizard to create a new form using the Client table. 3. Add all the fields to the form. 4. Select the Columnar layout. 5. Name the form Client Data Entry and have the Form Wizard open the form to

view or enter information. 6. Use the form to add a new record, with the following data:

Field Data

Client ID NELSON Name Nelson Enterprises Address 490 S. Maple St. City Boston State MA Zip 02188 Phone Number 617-888-9261

7. Close the form and open the Client table in Datasheet view to view the new

record. Then, close the Client table. 8. Use the Form Wizard to create a new form based on the Project Payments query. 9. Add all the fields to the form. 10. Select the Tabular layout. 11. Accept the default name, Project Payments and have the Form Wizard open the

form to view or enter information. 12. Close the form. 13. Use Form Tools to create a Multiple Items Form based on the Trainer table. 14. Close the form, saving it with the default name, Trainer. 15. Close the database file.

Page 129: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 124

LESSON 10 - EDITING FORMS AND REPORTS IN LAYOUTS

In this lesson, you will learn how to:

• Understand layouts and controls

• Move controls

• Size a control by dragging

• Select non-adjacent controls

• Select adjacent controls

• Delete controls

• Size controls automatically

• View the properties of an object

• Change a control property

Although screenshots for a form are used in this lesson, the techniques explained apply equally to working with reports.

Page 130: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 125

OVERVIEW

Discussion Layouts

When you create a form using Form Tools (see page 110), the form opens in Layout View and Access arranges the form controls in a “layout.”A layout is a type of table that Access 2010 uses for positioning and sizing the controls on a form or report.

Layouts are either stacked or tabular and allow you to manipulate groups of controls as one. As a result, it is easier to rearrange fields, columns, rows, or indeed, the whole layout. In layouts, you can also add, and remove fields and/or format objects. And because layouts are based on tables, they allow you to merge and split columns and rows creating a more irregular layout while retaining ease in keeping controls aligned while viewing the form or report data. Knowledge of structuring and formatting Microsoft Word tables is helpful (but not essential) for working with layouts.

To work with layouts, you generally have to be in Layout View. Existing users of Access will be pleased to know that Design View still remains available for more flexible and detailed design work (see page 131). However, the layout feature can be “turned on” when working in Design View, thus combining the benefit of quick and easy positioning and sizing of controls with the more advanced features that Design View offers.

Simple Form in a layout (Layout View)

Quick design changes that can be done in layouts are:

• Simultaneously resize all the controls or labels in a column: Select a single control or label, and then drag it to a required size.

• Change the font type, font colour, or text alignment: Select a label, click the Format tab, and use the available commands.

• Format multiple labels at the same time: Press CTRL and select multiple labels, and then apply the required formats.

Controls

Controls are the objects on a form or report that contain information. Forms and reports usually include bound text box controls and unbound label controls.

Page 131: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 126

Text box controls display data from fields in a table or query on which a form or report is based. Text boxes are known as bound controls because the source of the data is stored in a specific field in a table.

Label controls are unbound controls. They display information that is not stored in a table. Unbound controls can also be labels, images, lines, or rectangles drawn on the design. Unbound controls are often paired with bound controls as labels. Unbound controls are also used to enhance a form or report, or to provide more information, such as instructions for entering data. When you select a control in Access 2010, the control develops an orange border.

When you create a form or a report, text box and label controls are automatically added to the object. You can also start with a blank layout and add controls to create a custom form or report. Even on an existing form or report, you can use the Field List and/or the Form /Report Layout Tools > Design tab on the Ribbon to add additional controls to an existing layout.

MOVING AND SIZING CONTROLS ON A LAYOUT

Discussion You can change the size of a control on a layout. Controls that display text generally display a single line of text horizontally and are long enough to show the entire data entry.

If a field contains a large amount of text (eg. a memo field), you can display several lines of text in the field by vertically increasing the size of the controls.

Procedures Moving controls by click and drag

1. Ensure the form or report is open in Layout View. 2. Hold the mouse pointer over the control that you want to move.

Text boxes (bound controls)

Labels (unbound controls)

Page 132: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 127

3. Click and drag up or down until a thin orange coloured line appears where you want to move the control to. The mouse pointer changes to a shape.

4. Release the mouse button. 5. Repeat steps 1 to 3 for other controls that you want to move.

Moving a control in Layout View

Moving controls automatically

1. Ensure the form or report is open in Layout View. 2. Select the control(s) that you want to move. 3. Select the Arrange tab under Form/Report Layout Tools. 4. Click the Move Up or Move Down button in the move group. 5. Continue clicking the relevant button until the control(s) is/are in the correct

position.

Sizing a control by dragging

1. Ensure the form or report is open in Layout View. 2. Select the control you want to resize. 3. Move the mouse cursor to the edge of the control (over the orange coloured border)

that you wish to resize it from; it will change to a “sizing handle” – a small, black, double-headed arrow .

4. Click and drag the sizing handle in the desired direction to expand or contract the control.

Sizing a control using the keyboard

To gain more control, you can size selected controls with the keyboard by holding the [Shift] key while pressing the [Up], [Down], [Left], or [Right] arrow keys, although this can cause the screen to flicker. Changing the size of the control does not change the size of the text it contains.

Page 133: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 128

Increase spacing between controls automatically

1. Open the required form in Layout View. 2. Select the control(s) that you want to increase the spacing for. 3. Select the Arrange tab under Form Layout Tools. 4. Click the Control Padding command in the Control Layout in the Position group. 5. Select your preferred option.

ADDING AND DELETING CONTROLS ON A LAYOUT

Discussion You can add controls in Layout view. This may be required because you’ve deleted a control and then wish to re-include it on the form, or because the field wasn’t selected in the Form Wizard when the form was first created.

You can delete controls from Layout view. When you delete a pair of controls, you do not delete the field in the table or the data that it contains; you just keep the data from being displayed in the form or report.

Procedure Adding Field Controls

1. To add field controls, first open the required form in Layout view. 2. Click the Add Existing Fields button in the Format tab of the Ribbon. 3. Select the field that you want to add from the Fields available for this view:

section on the Field List pane. 4. Click and drag the field to the form layout until an orange coloured bar appears

where you want to add the field. The mouse pointer changes to a copy shape . 5. Release the mouse button.

+

Page 134: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 129

Deleting Controls on a Lay

Deleting Controls

1. To delete controls, first open the required form in Layout view. 2. Select either of the paired controls that you intend to delete. 3. Press the [Delete] key.

CREATING A TABULAR LAYOUT

Discussion A tabular form shows the form fields in a row with the labels above, rather like a spreadsheet. The difference with a form is that it shows just one record at a time and not the entire recordset. Tabular forms are useful for creating mainform/subforms arrangements (covered on the Access 2010 Advanced course).

Procedure 1. Open the required form in Layout View. 2. Select the first control that you want to re-arrange into a tabular layout. 3. Hold down the [SHIFT] key and click all the other controls that you with to re-

arrange into a tabular layout. These will normally be all the labels and text boxes from the underlying table or query.

4. Select the Arrange tab. 5. Click the Tabular command in Table group. 6. Add the Size to Fit command to the Quick Access Toolbar.

7. Ensure all the controls are selected on the tabular layout. 8. Click the Size to Fit button. 9. Manually adjust the width, height and position of any controls which may still not

be correctly arranged. It is advisable to adjust their size and position individually!

Page 135: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 130

Page 136: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 10 – Editing Forms and Reports in Layout View

WWP Learning and Development LTD Page 131

EXERCISE MANIPULATING FORMS IN LAYOUT VIEW

1. Open Train12. 2. Open the Client Data Entry form in Layout view. 3. Reduce the width of the bound controls by approx. 1cm. 4. Reduce the width of the unbound controls by approx. 2cm. 5. Add the ZIP field to the bottom of the form (you may need to show the field list

first: Add Existing Fields > Design tab). 6. Move the ZIP field controls above the Phone No. field. 7. Save the design changes and close the form. 8. Open the Trainer form in Layout view. 9. Move the ZIP, Home Phone and Memo field controls to the bottom of the first

column. 10. Select ALL the controls. 11. Increase the control padding to Medium. 12. Save the design changes and close the form.

Page 137: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 132

LESSON 11 - EDITING FORMS AND REPORTS IN DESIGN VIEW

In this lesson, you will learn how to:

• Hide or display the ruler

• Disable the Snap to Grid feature

• Display the field list

• Add a field

• Move part of a paired control

• Align controls

• Space controls

• Adding and modifying controls

• Add a label

• Add an image

• Add a rectangle

• Add a line

• Edit an unbound control

• Use multiple Undo/Redo in Design view

Page 138: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 133

INTRODUCTION

Discussion Design view shows you a more detailed view of the structure of the form than Layout View. For example, you can more clearly see and work with the Header, Detail, and Footer sections for the form. However, you will not be able to see the underlying data when making design changes in Design view.

Many of the techniques used in “layouts” (see page 124) apply to Design View (eg. moving and resizing controls). Not only can you arrange and format the objects already on your form/report, but you can add extra objects and controls as you wish and in advanced cases (not covered on this training) automate them with macros.

You might find it easier to work in the Design view to perform certain tasks such as:

• Adding a variety of controls to a form, such as labels, images, lines, and rectangles.

• Editing text box control sources in the text boxes, without using the property sheet.

• Resizing form sections, such as the Form Header or the Detail section.

• Changing certain form properties that cannot be changed in Layout view (such as Default View or Allow Form View).

Simple form in Design View

The different parts of a form that hold information are referred to as controls and usually include bound text box controls and unbound label controls.

Bound Control

(Text B )U b d

Unbound Control (Label)Bound

C l (T B )

Page 139: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 134

Text box controls display data from fields in a table or query on which a form or report is based. Text boxes are known as bound controls because the source of the data is stored in a specific field in a table.

Label controls are unbound controls. They display information that is not stored in a table. Unbound controls can also be text, images, lines, or rectangles drawn on the design. Unbound controls are often paired with bound controls as labels. Unbound controls are also used to add more information to a form such as instructions for entering data or the current date and time. When you select a control in Access 2010, the control develops an orange border.

Although screenshots for a form are used in this lesson, the techniques explained apply equally to a report.

THE RULER

Discussion You can hide or display the ruler in Design view. The ruler provides two scales in the Design window, one across the top and one down the left side. These scales are useful when you want to create controls that are a specific size or place controls in a specific location.

When you move objects, the appropriate area on the ruler is highlighted. This highlighted area indicates the size and position of the control.

The ruler commands act as toggles so you click to display them and you click the same command to hide them.

Procedure 1. To hide, or display, the ruler first open a form or report in Design view. 2. Right click on a blank area of the form/report to display the menu. 3. Click Ruler. 4. Alternatively, click the Arrange tab on the Ribbon. 5. In the Show/Hide group, click the Ruler button.

Page 140: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 135

THE SNAP TO GRID FEATURE

Discussion Access provides several features to help you size and position controls on a form.

The grid in Design view is a series of horizontal and vertical lines that help you position controls. By default, the Snap to Grid feature is activated, meaning that when you move or size a control, it “jumps” 1/10 of a centimetre at a time.

You may sometimes wish to deactivate this feature to allow more precise positioning of control. When the Snap to Grip feature is disabled, you can move or resize your controls by a single pixel at a time. The Snap to Grid is used as a “toggle” command; the same command both activates and deactivates the feature.

Procedure 1. Ensure you have a form or report open in Design view. 2. Select the Arrange tab under Form Design Tools. 3. Click the Size/Space command. 4. Click Snap to Grid from the menu.

Tip You can temporarily disable Snap to Grid by holding down the CTRL key while you click and drag to move or sesize a control.

DISPLAYING THE FIELD LIST

Discussion If a form or report is based on a table or query, you can display the Field List pane. This option allows you to add fields to the view. The field list appears as a window at the right of your screen, displaying the fields available in your table and any related tables.

The Field List button acts as a toggle. You click it to display the field list and click it again to close the field list. You can also close the field list by clicking the Close button on the title bar.

Procedure 1. Select the Design tab under Form Design Tools.

Page 141: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 136

2. In the Tools group, click the Add Existing Fields button .

ADDING A FIELD

Discussion When you add a field to a form or report, you add both a bound and an unbound control. The bound control is a text box that displays the data from the table. The unbound control is a label that contains the field name.

When you add a field, the mouse pointer changes into the following shape. .

This point of the arrow indicates where the top left corner of the bound control will appear on the form. The unbound control, by default, will be located to the left of the bound control. If you move the bound control too close to the left margin, the unbound control may not be totally visible.

Procedure 1. To add a field to a form or report in Design view, first click the Add Existing Fields

button in the Tools group of the Design tab on the Ribbon. 2. Locate and select the field you wish to add to the form. 3. Drag the field name to the desired location on the form design.

+

Page 142: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 137

MOVING PART OF A PAIRED CONTROL

Discussion A bound and an unbound control can be paired. When you select a bound control, the unbound control is selected. An example is a field text box (the bound control) and its label (the unbound control). You can reposition these controls as a single unit, or you can reposition them individually.

When you select paired controls, a large, black box appears in the upper left corner of both the bound and unbound controls (the “move handle”).

Page 143: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 138

You use the these handles to move the controls individually by pointing at the move handle of the control that you wish to move and then dragging the control to its new location.

Procedure 1. Hold the mouse pointer over the large black box in the top left corner of the control

you want to move. It will change to a shape. 2. Click and drag the control to move it to a new position.

ALIGNING CONTROLS

Discussion You can automatically align controls with one another. This option allows you to line up the edges of controls quicker and more accurately than lining them up individually.

Misaligned labels Left aligned labels

The available alignment options are listed in the following table:

Option Description

To Grid The controls are aligned with the grid. Left The left edges of the controls are aligned with the left edge of the leftmost

control in the selection. Right The right edges of the controls are aligned with the right edge of the

Page 144: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 139

rightmost control in the selection. Top The top edges of the controls are aligned with the top edge of the top

control in the selection. Bottom The bottom edges of the controls are aligned with the bottom edge of the

bottom control in the selection.

Procedure 1. Select the first control that you want to align with others. 2. Hold down the [SHIFT] key. 3. Click the successive controls that you want to align with the first. 4. Select the Arrange tab under Form Design Tools. 5. Click the Align command. 6. Select an option in the menu.

SPACING CONTROLS

Discussion You can increase or decrease the spacing between selected controls, or space them evenly between the top and bottom controls. You can also implement spacing changes horizontally or vertically.

Irregular spaced labels Equally spaced labels

Page 145: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 140

Procedure 1. Select the first control that you want to space with others. 2. Hold down the [SHIFT] key. 3. Click the successive controls that you want to space with the first. 4. Select the Arrange tab under Form Design Tools. 5. In the Position group, click the Size/Space button you want. 6. The select the required option under Spacing.

ADDING A LABEL CONTROL

Discussion Controls can be used to improve the appearance of a form or report. They allow you to display more information. Additional controls of various types can be accessed from the Controls group of the Design ribbon. Some controls open and start control wizards.

A label control is a box into which you can add any test that you like. For example, you may want to add additional titles to your form or report, include instructions or add a list of contact points for support with the form/report or data.

Page 146: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 141

Information label added to a form in Design View

Procedure 1. Open the form/report you want to add a label to. 2. Select the Design tab below Form Design Tools tab.

3. In the Controls group, click the Label button . 4. Click on the form/report where you want the top left corner of the label to appear. 5. Type the text for the label. 6. Press [CTRL] [Enter] to create a line break. 7. Press the [Enter] key when finished.. 8. If the label is not associated with a control an error message may display. It can be

removed by clicking on the list arrow and selecting Ignore error.

ADDING AN IMAGE

Discussion You can add a control to a form or report that contains an image. The image is unbound and usually added only for aesthetics. Images can be any type of graphic file. If a graphic file is too large to fit in the frame of the control, the entire graphic will not appear. However, you can resize the frame to display more of the image.

When you use the Insert Image command, the mouse pointer changes into a shape. You add the image to the form by holding the mouse pointer where you want one the corners of the image to start, and dragging to the diagonally opposite corner.

Page 147: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 142

Image added to form

Procedure 1. Select the Design tab below Form Design Tools. 2. In the Controls group, click the Image command.

3. Click Browse… . 4. In the Insert Picture dialog box, locate and select the image you wish to insert. 5. Click the OK button. 6. Hold the mouse pointer where you want the top left corner of the image. The

mouse pointer will have changed to a shape 7. Click and drag to form a frame for the control. 8. The image is entered and can be moved or resized if necessary.

Tip You can add an image by just clicking in the form with the mouse pointer shape. The image will be inserted in its original size which may be very big! You can, however, resize it to more moderate proportions.

Tip

If you have previously inserted an image into a form or report, it will be displayed in the Image menu. You can select it from there without needing to Browse.

Page 148: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 143

LINES AND RECTANGLES

Discussion The Controls group under Form Design Tools > Design tab contains tools for both lines and rectangles that you can add to your layout for effect or enhancement. Selecting the tool you require and then clicking and dragging in the Design view will produce the object you want. The object can then be formatted as necessary with fills and colours.

Depending on the size of your monitor and/or screen resolution, you may have to click the More button in the bottom right of the controls gallery to see the full collection of commands.

Full controls gallery

Procedure 1. Open in Layout View the form or report that you want to add a line or rectangle

to. 2. Select the Design tab under Form/Report Layout Tools.

3. To draw a line, click the Line command in the Controls group (you may have to click the More button to find it).

4. Move the mouse pointer to where you want to start the line (the mouse pointer will have changed to a shape).

5. Click and drag to where you want the line to end.

6. To draw a rectangle, click the Line command in the Controls group (you may have to click the More button to find it).

7. Move the mouse pointer to where you want one of the rectangle corners to start

(the mouse pointer will have changed to a shape). 8. Click and drag to where you want the diagonally opposed corner of the rectangle

to be.

Page 149: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 144

Drawing a rectangle corner to corner

EDITING A LABEL

Discussion You can edit text in an unbound control (eg. a label). However, you must be in edit mode. In edit mode, the insertion point and a solid background appear in the unbound control.

You enter edit mode by clicking the control once to select it, and then clicking again onto the text to add a cursor - you cannot edit text while the sizing handles are displayed. Deleting all the label text also deletes the control.

Editing a label

Procedure 1. Click to select the label for which you want to edit the text. 2. Click onto the text label text. 3. Use the keyboard arrow keys to move the cursor to the desired position. 4. Add, delete text as necessary. 5. Press [Enter} or just click onto another part of the form/report.

USING MULTIPLE UNDO/REDO IN DESIGN VIEW

Discussion The Undo feature allows you to reverse the results of the previous command or action.

Once you have used the Undo feature, the Redo feature becomes available. The Redo feature allows you to restore the results of the command or action you reversed with the Undo feature. Both features can be accessed on the Quick Access Toolbar that can be found in the top left corner of the Access window.

Quick Access Toolbar

Start

Click & drag

Finish

Page 150: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 145

When you work with Access object types, such as tables, queries, forms, or reports, in Design view, you can also use the list arrow on the Undo or Redo button to undo or redo multiple actions. This feature is useful if you want to reverse a previous action, but have performed a number of actions subsequent to it. When you select an action to undo or redo, however, all the items performed after the selected action in the list are also reversed or redone.

However, when you open a table or query in Datasheet view, you are limited to undoing one action at a time. Each time you choose the Undo button in Datasheet view, the last action performed is reversed.

Procedure 1. Click the Undo button in the Quick Access Toolbar. 2. Click the Redo <description of last undo> button to reverse the action. 3. Click the drop down arrow to the right of the Undo button. 4. Click the drop down arrow to the right of the Redo <description of last undo>

button. 5. Select a previously performed undo that you wish to reverse.

Page 151: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 11 – Editing Forms and Reports in Design View

WWP Learning and Development LTD Page 146

EXERCISE USING DESIGN VIEW

1. Open Train18. 2. Open the Project Form 2 form in Design view. 3. Hide the ruler; then, redisplay it. 4. Disable the Snap to Grid feature; then, enable it again. 5. Hide the field list, if necessary. 6. Resize the Detail section to 15cm horizontally and 8cm vertically. 7. Show the field list (Hint: Click the Add Existing Fields button in the Tools group of the

Design tab). 8. Add the Sales Rep field to the bottom of the form below Total Sale. Hide the field

list. 9. Select all the labels (Hint: use the SHIFT to make multiple selections) and align them

left. 10. Select all the text boxes and size to widest AND align them right. 11. Apply equal vertical spacing to all the controls in the Detail section the form (Hint:

make sure they are all selected first). 12. Replace the text in the Form Header label to Worldwide Training Corp. 13. Adjust the label width so that the text fits on one line only. 14. Add the Wwtlogo image at approx. 10cm horizontally and 0.5cm vertically, next to

the Worldwide Training Corp label. 15. Draw a rectangle around the Worldwide Training Corp. label and the image. 16. Draw a horizontal line along the bottom of the Detail area at approximately 7.5cm.

(Hint: Hold down the [Shift] key as you click and drag to draw a straight line.). 17. Use the Undo feature to reverse the previous action. 18. Use the Redo feature to reverse the undo. 19. Switch to Form View to see the completed form. 20. Close the form, saving the changes. 21. Close the database file.

Page 152: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 147

LESSON 12 - CREATING BASIC REPORTS

In this lesson, you will learn how to:

• Use reports

• Use Report Tools

• Use the Report Wizard

• View reports

• Print pages of a report

• Group and summarise report data

Page 153: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 148

INTRODUCTION

Discussion Although you can print records from a table or form, a report provides more precise control over the final output. Reports can include page headers and footers, calculated totals and subtotals, and even graphics. In addition, reports can be used for invoices, orders, presentations, and mailing labels. Reports can be based on tables or queries.

There are two basic types of reports: columnar and tabular. In a columnar report, the field names are listed on the left side of the page, and the field values are listed on the right. If space on the page permits, there can be more than one column. In a tabular report, the field names are listed across the top of the report, and the field values appear in the corresponding columns.

USING REPORT TOOLS TO CREATE A REPORT

Discussion The fastest way to create a report is to use the Report command on the Create tab. This will create a report with a single mouse-click. When you use the Report command, all the fields from the underlying data source are placed on the report.

The Report command creates a report in a “layout” (a type of table) and displays it in Layout View. You can view or print the new report immediately, or you can make simple modifications to it in Layout View (eg. adjust the size and position of text boxes, see page 126) or, open it in Design View to make more detailed and advanced changes to suit your needs (see page 131).

Single table basic report created using the Report Tool

Page 154: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 149

It is also possible to create a report starting with a blank report or in Design View but these methods are recommended for advanced users only and outside the scope of this training. They are covered on the Microsoft Access 2010 Advanced course.

When using form tools to create a form, you first need to select in the Navigation Pane the table or query you wish to be displayed on the form (the table or query does not have to be open).

Procedure 1. Select in the Navigation Pane the table or query that you want to use for the form. 2. Select the Create tab. 3. In the Reports group, click the Report command. The report is displayed in Layout

view. 4. Click the Save button on the Quick Access Toolbar. 5. Enter a name for the form. 6. Click OK. 7. Close the report.

USING THE REPORT WIZARD

Discussion You can use the Report Wizard to control more precisely the type, structure and format of a report. The basic steps needed to create a report using the Report Wizard are as follows:

1. Select the table or query you want to use.

2. Select the fields you want to include.

3. Group the data (if possible).

5. Sort the data.

6. Select a layout.

8. Name the report.

When you have finished creating a report, the Report Wizard displays it in print preview. Print preview allows you to view the report before you print it.

You can use the Form Wizard to create a form based on two tables that have a one-to-many relationship. This will result in a grouped report where each record in the “one” table has listed below it, the related records from the “many “table.

Page 155: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 150

Report created with the Report Wizard using two related tables

Procedure (single table or a query) 1. Select the Create tab. 2. Click the Report Wizard command in the Reports group,.

3. In the Tables/Queries list, click the list arrow.

4. Click the table or query you wish to use for the report. 5. Specify the fields you want to include in the report by selecting each in turn and

clicking on the right arrow or, by double-clicking on each field to be included. 6. Click the Next button. 7. Select a field to group by. This will only possible if you have repeating values in a

single field or, you are creating a report from two tables with a one-to-many relationship. If you cannot or do not wish to group the report, omit this step.

Page 156: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 151

8. Click the Next button. 9. Specify a sort order for the report.

10. Click the Next button. 11. Select a layout for the report; in most cases with will be tabular. 12. Select an orientation for the report.

13. Click the Next button. 14. Enter a name for the report.

Page 157: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 152

15. Choose whether to preview the report or open it in Design view. 16. Click the Finish button.

Procedure (two tables with a one-to-many relationship) NB Tables MUST have a relationship created between them

1. Select the Create tab. 2. Click the Report Wizard command in the reports group.

3. Click the Tables/Queries drop-down list. 4. Select the “one” table that you wish to use for the report. 5. Specify the fields you want to include on the report by selecting each in turn and

clicking the right arrow or, by double-clicking on each field to be included.

6. Click the Tables/Queries drop-down list again. 7. Select the “many” table you wish to use for the report. 8. Specify the fields you want to include in the report by selecting each in turn and

clicking on the right arrow or, by double-clicking on each field to be included.

Page 158: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 153

9. Click the Next button. 10. Select the field(s) that you want to group the data by.

11. Click the Next button. 12. Specify a sort order for the report details.

13. Click the Next button. 14. Select the desired layout for the report.

Page 159: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 154

15. Click the Next button. 16. Enter a name for the report.

17. Choose whether to preview the report or open it in Design view. 18. Click the Finish button.

Tip Use Layout View to easily adjust column widths so that the report fits neatly onto the pages.

VIEWING REPORTS

Discussion You can open a report for viewing and printing purposes by simply double clicking it in the Navigation Pane. This opens it in “Report View.” Report View allows you to carry out other database tasks unassociated with the report, such as opening other objects, creating new objects and working with database tools.

You can, however, open a report to view it in Layout View or Print Preview.

Layout View allows you to view the report on screen and simultaneously make design changes such as adjusting column widths and spacing. See Lesson 11 on page 124for more detail on using Layout View for forms and reports.

Print Preview allows you to see how the printed report will look before you print it although it does not allow you to edit the report.

Print preview also provides options for viewing the report, something that cannot be done in Report or Layout view. By default, the report appears magnified at 100%, the same size as the printout. You can zoom out to see more of the report or zoom in to see a portion of the report

Page 160: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 155

in more detail. The Zoom list in print preview allows you to choose from several magnification options, from as small as 10% to as large as 500% or 1000%.

You can display a report in One Page, Two Pages, or Multiple Pages view. The buttons at the bottom of the window allow you to navigate pages, and the scroll bars allow you to view different areas of a page. You can also use the Zoom Bar at the bottom right of the Access window to increase or reduce the size of the displayed report.

The Zoom Bar

Procedure (open a report in Report View) 1. Double click in the Navigation Pane, the report that you want to view.

2. When finished, close the report by clicking the button at the right of its title.

Procedure (open a report in Layout View) 1. Right click in the Navigation Pane the report that you want to view. 2. Select Layout View from the shortcut menu. 3. If the report is already open in Report View and the Navigation Pane is hidden,

click the lower half of the View command at the left of the Home tab and select Layout View.

Procedure (open a report in Print Preview) 1. Right click in the Navigation Pane the report that you want to view. 2. Select Print Preview from the shortcut menu. 3. If the report is already open in Report or Layout View and the Navigation Pane is

hidden, click the lower half of the View command at the left of the Home tab (Report View) or the Design tab (Layout View) and select Print Preview.

Page 161: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 156

4. Click the document window to zoom in. 5. Click the document window again to zoom out. 6. Use the Zoom group commands to adjust how the report displays on the screen.

7. When finished, click the Close Print Preview command .

Tip If a report is already open in either Report or Layout View, you can also see it in Print Preview by clicking the File tab > Print > Print Preview.

Tip Report views can also be changed using the view button in the bottomright of the Access window

PRINTING A REPORT

Discussion You can print an entire report of just specific pages. This latter option is useful if the report contains numerous pages, and you only need information from one or more particular pages. The Print dialog box allows you to specify which pages you want to print.

Page 162: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 157

Procedure 1. Open in any view or, select in the Navigation Pane the report you want to print. 2. Select the File tab. 3. Click Print at the left. 4. Select settings and options as desired. 5. Click OK.

GROUPING AND SUMMARISING REPORT DATA

Discussion The Report Wizard provides options for grouping and summarising report data. You can organise your report by selecting the fields into which you want to group data. If you create more than one group, you can prioritise the groups into levels.

In addition to grouping data by a field, you can add grouping intervals. Grouping intervals vary, depending upon the selected field. For instance, a date field can be grouped by month, quarter, year, etc.; a numeric field can be grouped by numeric intervals of 10s, 50s, 100s, etc.; and a text field can be grouped by its first letter, second letter, etc.

If you have included a field with numeric data in your report, you can add summary calculations. Summary calculations include Sum, Avg (average), Min (minimum), and Max (maximum). If you select the Sum calculation, you can include a calculated percentage of the

Page 163: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 158

total for each group. You can also display just the summary calculations in the report or both the field data (details) and the summary calculations.

Simple grouped report

Grouped report showing summary totals

Page 164: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 159

Report grouped by year and month

Procedure (simple grouping only) 1. Select the Create tab. 2. Click the Report Wizard command in the Reports group.

3. Click the Tables/Queries drop-down list. 4. Select the table that you wish to use for the report. 5. Specify the fields you want to include on the report by selecting each in turn and

clicking the right arrow or, by double-clicking on each field to be included.

6. Click the Next button. 7. Select the field(s) that you want to group the data by.

Page 165: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 160

8. Click the Next button. 9. Specify a sort order for the report details.

10. Click the Next button. 11. Select the desired layout for the report.

12. Click the Next button. 13. Enter a name for the report.

Page 166: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 161

14. Choose whether to preview the report or open it in Design view. 15. Click the Finish button.

Procedure (grouping and summarising) 1. Select the Create tab. 2. Click the Report Wizard command in the Reports group.

3. Click the Tables/Queries drop-down list. 4. Select the table that you wish to use for the report. 5. Specify the fields you want to include on the report by selecting each in turn and

clicking the right arrow or, by double-clicking on each field to be included.

6. Click the Next button. 7. Select the field(s) that you want to group the data by and create summary totals

for.

Page 167: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 162

NB: If you are grouping on a numerical field or a date field, click the Group Options… button and select the interval for the numbers (eg. 0 -10; 11-20; 21-30, etc.) or dates (eg. years, months, quarters, etc.) to group on. Click OK.

8. Click the Next button. 9. Specify a sort order for the report details.

10. Click the Summary options… button . 11. Select the summary function that you want to perform for each level of grouping.

You can select more than one.

Page 168: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 163

12. Select a Show option – Details and Summary to see data AND totals on the report

or Summary Only to see just the group totals. 13. Select the Calculate percent of total for sums, if desired. This shows for each group

what percentage of the grand total its total represents. 14. Click OK. 15. Click the Next button. 16. Select the desired layout for the report.

17. Click the Next button. 18. Enter a name for the report.

Page 169: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 164

19. Choose whether to preview the report or open it in Design view. 20. Click the Finish button.

Page 170: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 12 – Creating Basic Reports

WWP Learning and Development LTD Page 165

EXERCISE CREATING BASIC REPORTS

1. Open Train13. 2. Use the Report Wizard to create a new report. 3. Select the Project table and add the Project ID, Course Name, and Cost fields to

the report. 4. Do not add any grouping in step 2 of the Wizard. 5. Sort the report by Course Name. 6. Select the Tabular layout, the Portrait orientation. 7. Name the report Projects Report and display it in print preview. 8. Zoom to display the entire page. 9. Zoom to 100% to display the report in more detail. 10. Close the form. 11. Use the Report Wizard to create a report from the Project Payments query. 12. Add all the fields to the report. 13. In step 2, group by Project ID. 14. In step 3, sort by Client ID and add a Summary Option to Sum by Amount Paid. 15. Select the Stepped layout and the Landscape orientation. 16. Accept the default name of Project Payments and preview the report. Then, close

print preview. 17. Use the Report Tool to create a “Quick” report for the Trainer table. 18. Preview the report then close print preview, saving the report as Trainer. 19. Close the database file.

Page 171: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 166

LESSON 13 - FORMATTING CONTROLS IN FORMS AND REPORTS

In this lesson, you will learn how to:

• Change the font

• Change the font size

• Change the character format

• Change the font colour

• Change fill and background colours

• Format lines and borders

• Apply special effects

• Use the Format Painter

• Use Themes

• Run the spelling checker

• Set AutoCorrect options

• Add AutoCorrect entries

Page 172: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 167

INTRODUCTION

Discussion The objects in a database are mainly in the forms and reports. Access provides many formatting, layout, and style options for you to enhance the appearance of your forms and reports. You can also add special effects to certain objects, giving them an embossed or 3-D effect.

After you have created a form or report with the structure you want, you can refine the appearance of the text that appears in it. Design view in Access contains many of the same features found in word processors.

Although screen shots for a report have been used in this lesson, the techniques described can be similarly applied in form design.

CHANGING THE FONT

Discussion You can use Design View or Layout View for both forms and reports to change the font for any object (ie. a control or label) to improve its overall appearance. Different fonts can also help emphasise desired parts of a form or report.

Access includes many font typefaces from which you can choose. They range from heavy bold typefaces to thin light ones. A list of available font typefaces and a sample of their appearance can be viewed in the Font list in the Text Formatting group on the Home tab in all views.

You can mix fonts within a single form or report. If you have a form or report with headings and text beneath each heading, you can select one font for the headings and another for the text. Varying the font within a form or report improves the readability of the text and emphasizes key points. However, mixing too many fonts can be distracting.

You can use the Align Left, Center, and Align Right buttons in the Font group of the Design ribbon to change the alignment of text in controls.

You can select a font by selecting the list arrow in the Font group on the Design ribbon, and choosing the font you want to use. You can also change a font using the Font Name property in the Property Sheet. In Design view, you can select different font sizes for any text displayed. Generally speaking, larger font sizes are used for labels or text of great importance, and smaller font sizes are used for less important objects, such as page numbers. You can also change a font size using the Font Size property in the property sheet.

Font size is measured in points. One point is approximately 1/72 of an inch. Therefore, a word with a 36 point font size is approximately one-half inch in height. The larger the font size, the larger the type.

Page 173: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 168

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to change the font name. 3. Select the Home tab. 4. Click the Font list arrow and choose the font you require. 5. Set the font size by clicking on the font size list arrow. 6. Select the font size you want to use.

Tip You can select multiple objects to change the font for by selecting the first control, holding down the [CTRL] key and then clicking other controls.

Tip You can also change font formatting using the Font group in the Format tab under Report (or Form) Design Tools.

CHANGING THE CHARACTER FORMAT

Discussion You can change the character formats of an object, either to add emphasis or to enhance the appearance of the text. The most commonly used character formats are bold, italic, and underline.

You can tell which character formats have been applied to specific text by positioning the insertion point in the object.

You can apply character formats to existing text or change character formats as you type text. If you no longer want a character format applied to text, you can remove the formatting.

These font formats apply to the entire contents of the control; you cannot change individual characters within a control.

The Bold, Italic, and Underline buttons are toggles. If you select an object that contains one of these formats and click the Bold, Italic, and Underline button, the format is removed.

You can also use the property sheet to add font formats to text. You can use the Font Underline and Font Italic properties to add underlining and italics. The Font Weight property provides multiple bolding options, including Thin, Semi-bold, Extra Bold, and Heavy.

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to change the font name.

Page 174: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 169

3. Select the Home tab. 4. Click the desired format button in the Text Formatting group.

Tip You can also change character formatting using the Font group in the Format tab under Report (or Form) Design Tools.

CHANGING THE FONT COLOUR

Discussion You can change the colour of the font in any object that contains text. You can change the colour of all the text in the object, or you can change only the font colour of selected characters. Changing font colour draws attention to text.

When selecting a font colour for text, you should be aware of the background colour of the object. For example, red text will stand out on a white background, whereas yellow text will not.

The Font Color button has a list arrow which enables you to select a colour. The Color palette also allows you to create custom colours. You can also change the font colour using the Fore Color property in the Property Sheet.

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to change the font colour. 3. Select the Home tab. 4. In the Text Formatting group, click the Font Color list arrow. 5. Select the colour you want to use.

Page 175: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 170

Tip You can also change font colour using the Font group in the Format tab under Report (or Form) Design Tools.

CHANGING BACKGROUND COLOURS

Discussion You can change the background colour of a control or drawn object at any time. Adding colour to a form may make it easier to enter data when viewed on a monitor.

In addition to changing the background colour of objects, you can change the background colour of the of the design grid. Each section, Detail, Page Header, Report Header or Form Header, can display a different background colour.

If the background colour of a drawn object hides text in a form or report, you can remove the background by selecting the Transparent option for that object. Then, only the border of the object appears around the text. You can also layer objects by moving one object behind another. That way you can create a filled colour rectangle behind related controls. The default background colour of a report is white, not transparent.

The Background Color button consists of two components. The button face displays the currently selected colour. To apply the currently selected colour to another object, you only have to select the object and click the button. You can also use the Background Color list to select the desired colour from the colour palette.

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to change the background colour. 3. Select the Home tab. 4. In the Text Formatting group, click the Background Color list arrow. 5. Select the colour you want to use.

Tip You can also change background colour using the Font group in the Format tab under Report/ Form/Layout) Design Tools.

Tip You can also change background colour using the Shape Fill command in the Control Formatting group in the Format tab

under Report/ Form/Layout) Design Tools .

Page 176: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 171

FORMATTING LINES AND BORDERS (SHAPE OUTLINE)

Discussion You can format lines and borders by selecting them and then changing the line colour, width, and style. In an enclosed object, such as a control, the line is the border around an object. In an open object, such as a drawn line, the line is the object itself.

You can change the width of a line or border using the Line Thickness command. The default line width is Hairline, but the width of a line can be increased from 1 to 6 points.

You can also change the line/border colour of an object using the Shape Outline command. Changing the border colour can enhance the appearance of the object. For example, if you are creating a logo, changing the line colour can help distinguish the border of the logo. You can either apply the current colour by clicking the button face or select a different colour from the palette or More Colors… dialog box.

Page 177: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 172

In addition to changing the line width and colour, you can also change the line style. The default line style is a solid line, but other choices include dashes, dots, and combinations of dashes and dots. The line style can be changed using the Line Type property in the Property Sheet.

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to change the outline formatting for. 3. Select the Design tab under Report/Form/Layout /Design Tools. 4. Click the Shape Outline command. 5. Select preferences and options.

APPLYING SPECIAL EFFECTS

Discussion Special three dimensional effects can be applied to objects to create interest or a feeling of depth. There are five special effects you can apply: Raised, Sunken, Etched, Shadowed, and Chiseled. You can remove a special effect by applying the Flat effect.

To apply a special effect, you select the object which is to have the special effect, and click the button for the special effect you want applied

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to change the special effect for. 3. Select the Design tab under Report/Form/Layout /Design Tools. 4. Click the Special Effects command. 5. Select preferences and options.

USING THE FORMAT PAINTER

Discussion You can use the Format Painter button on the Home or Design tabs to copy the style of a specific object and apply it to other objects. This feature saves time when multiple formats have been applied to the object and you want to format other objects with the same formats.

When the Format Painter is active, the mouse pointer becomes an I-beam with a paintbrush to its left.

Page 178: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 173

To copy the selected formatting to multiple locations, double-click the Format Painter button to enable it. Then, click it again when you have finished formatting text to disable it.

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the object for which you want to copy the style from. 3. Select the Home tab or the Format tab under Report/Form/Layout /Design

Tools.

4. Click the Format Painter command . 5. Click another object to apply the style.

USING THEMES A fast way of formatting a report or form is by using the Themes command in the Design tab under Report/Form/Layout /Design Tools.

The Themes gallery

When you click on this button, you can select from a variety of ready-made styles. After you have made your selection, Access formats the selected object in a consistent manner for you.

Themes are common across the Office 2010 family of applications hence, you can give all your documents, spreadsheets, presentations, etc. the same look and feel.

Themes can be modified by applying different built-in colour and font schemes as well as creating your own custom styles.

Page 179: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 174

Theme color schemes Theme font schemes

Procedure 1. Open the desired form or report in Design or Layout view. 2. Select the Design tab under Report/Form/Layout /Design Tools. 3. Click Themes in the Themes group. 4. Select your desired option in the gallery. 5. If desired, click the Colors ▼or Fonts ▼ commands in the Themes group and select

an alternative colour or font scheme.

RUNNING THE SPELL CHECKER

Discussion The Spelling facility helps you to proof read your data by identifying possible misspelled words and suggesting possible spelling to use instead.

You can correct the spelling, ignore the word, add the word to your dictionary, or create an AutoCorrect entry.

Procedure 1. Open the table containing the data you want to spell check. 2. Click the row selector(s) or the column heading(s) that you want to check. 3. Select the Home tab.

Page 180: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 175

4. In the Records group, click the Spelling button. 5. Correct, or ignore, the identified words as appropriate. 6. To change the spelling of an identified word, select the desired spelling from the

Suggestions list box. 7. Select Change or Change All as necessary. 8. To ignore an identified word, select Ignore or Ignore All. 9. Click on Add to add the word to your dictionary so the spell checker will not

identify it as a misspelled word. 10. Click on AutoCorrect to add the word to the AutoCorrect list. 11. If prompted, click the OK button to end a spell check.

NB: Microsoft Office 2010 programs all share the same spell checker and dictionary.

SETTING AUTOCORRECT OPTIONS

Discussion AutoCorrect automatically corrects misspelled or mistyped words as you type. For example, if you inadvertently type teh instead of the, Access will automatically make the correction. Access uses a predefined list of commonly misspelled or mistyped words. You can easily customise the preset AutoCorrect options or add errors that you know you commonly make to the list of AutoCorrect entries.

AutoCorrect cannot make the corrections immediately, because it needs to sense what you are typing before it can make a change. As soon as you press the [Spacebar] key or type punctuation, AutoCorrect attempts to make the correction.

Procedure 1. Select the File tab.

2. Click the Options button . 3. In the left pane, click Proofing.

Page 181: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 176

4. Click AutoCorrect Options… 5. Select, or clear options as required. 6. Click OK. 7. Click OK.

ADDING AUTOCORRECT ENTRIES

Discussion To use AutoCorrect to its full potential, it is a good idea to add the typing mistakes you make most often and the correct replacements to the AutoCorrect dictionary.

You can also add abbreviations for commonly typed text. For example, you can add initials and the corresponding full name to the dictionary so that when you type JAD, AutoCorrect replaces it with John Alan Doe.

Procedure 1. Select the File tab.

2. Click the Options button . 3. In the left pane, click Proofing. 4. Click AutoCorrect Options… 5. In the Replace: box, add an entry, type a word or phrase you tend to mistype or

misspell. 6. In the With: box type the correct spelling of the word or phrase. 7. Click the Add button. 8. Click OK. 9. Click OK.

Page 182: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 177

Page 183: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 13 – Formatting Controls in Forms and Reports

WWP Learning and Development LTD Page 178

EXERCISE FORMATTING CONTROLS

1. Open Train19. 2. Open the Client Information Report in Design view. 3. Apply the Equity Theme to the report. 4. Change the font size of the controls in the Details section to 12. 5. Preview the report. 6. Resize to widest the controls in the Details section and increase the vertical

spacing. 7. Make the Client ID unbound control (label) bold and italic. 8. Using the Format Painter, apply the style of the Client ID bound control to all of

the other unbound controls (labels only). 9. Preview the report and then close it without saving the changes. 10. Open the Project Information Report in Design view. 11. Change the background colour of the Report Header section to Aqua Blue 2. 12. Change the background of the Project Information Report label to Aqua Accent 5,

Lighter 40%, its font colour to white and the character style to Bold. 13. Select the Trainer Initials control in the Trainer Initials Header section. 14. Apply an Aqua Blue 2 background colour. 15. Add a horizontal line at the bottom of the detail area (you will probably have to

make the Detail area taller). 16. Format the line to Aqua Blue 2. 17. Remove the borders (Shape Outline) from the Project ID and Client ID controls in

the Detail area. 18. Add a raised special effect to the Trainer Initials label. 19. Preview the report. 20. Close the report, saving the changes. 21. Close the database file.

Page 184: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 179

LESSON 14 - WORKING WITH HELP

In this lesson, you will learn how to:

• Search for Help on a topic

• Use Help Contents

Page 185: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 14 – Using Help

WWP Learning and Development LTD Page 180

SEARCHING FOR GENERAL HELP

Discussion If you need assistance on any Access topic or task, you can use Access’s extensive Help facility. The Help Viewer provides both the answers and the resources you need.

If you have an active internet connection, Help also searches the Microsoft website for additional help, articles, tips, templates, training, and downloads. By using Microsoft Office Online, you have access to standard product help as well as updated information from the Web.

The Web browser style Help Viewer allows you to browse the catalogue of topics using a table of contents, or you can type a question to search for specific information.

Procedure 1. To use the Help window to get general help on Access, first click the Help button

at the top right of the ribbon or, press the [F1] key. 2. In the search box at the top of the window, enter a keyword or two for the help

required, eg. form design, or query.

3. Click Search . 4. Select a topic from the search results pane. 5. If the search has not produced the expected results, try entering different key

words in the Search box and try again. 6. If you follow a link to a topic and it does not tell you what you need, click the Back

button at the top of the Help window to return to the list of topics or the Home

button to clear the search results. The Help window is designed to be used like a web browser.

7. Close the Help window when finished.

Page 186: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 14 – Using Help

WWP Learning and Development LTD Page 181

Tip

You can filter where Access look for Help buy clicking the drop down arrow at the right of the Search button in the Help window.

ACCESSING HELP ON SPECIFIC TOPICS

Discussion If you prefer to adopt a more structured and detailed approach to finding help on Access topics, you can search for it in an Access “manual.” This can be found by clicking the Table of Contents button at the top of the Help window and following the links at the left to the required topics. You can use the Back, Forward and Home buttons at the top of the Help window rather like a web browser to navigate through the topics.

Page 187: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 14 – Using Help

WWP Learning and Development LTD Page 182

Procedure

1. Click the Help button at the top right of the ribbon or, press the [F1] key.

2. Click the Table of Contents button at the top of the window. 3. Click a main topic in the left-hand pane. 4. If necessary, click a sub topic in the left-hand pane. 5. Follow additional links in the right-hand pane to find and study the help available. 6. Close the Help window when finished.

SCREENTIPS

Discussion ScreenTips are small windows that display information text when you rest the mouse cursor on a command, or control, button.

Enhanced ScreenTips are larger windows that display more descriptive text than a ScreenTip and can have a link to a Help topic. You can control how much information a screentip displays in Access Options.

Procedure 1. Select the File tab.

2. Click Options . 3. Select the Popular tab. 4. Under User interface options, in the ScreenTip style: list, click the option that you

want. a. Show feature descriptions in ScreenTips turns on ScreenTips and Enhanced

ScreenTips. This is the default setting. b. Don't show feature descriptions in ScreenTips turns off the Enhanced

ScreenTips, but you still see the standard ScreenTips. c. Don't show ScreenTips turns off ScreenTips and Enhanced ScreenTips.

5. Click OK.

Page 188: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 14 – Using Help

WWP Learning and Development LTD Page 183

Page 189: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 14 – Using Help

WWP Learning and Development LTD Page 184

EXERCISE USING HELP

1. Open Train14. 2. Use the Help Viewer to find out how to create a form for the data in a query. 3. Using Help Contents, display help information about changing the primary key of

a table 4. Close the Microsoft Access Help window. 5. Open the Access Options and ensure that the ScreenTip style shows the feature

descriptions. 6. Close the database.

Page 190: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 185

LESSON 15 - CREATING RELATIONSHIPS

In this lesson, you will learn how to:

• Use related tables

• Create a relationship between tables

• Set referential integrity

• View subdatasheets

• Delete a relationship

Page 191: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 186

INTRODUCTION

Discussion Tables can be joined, or related, in order to access and coordinate information in all the fields of the related tables. Joining tables is a useful way to avoid entering duplicate information in various, related tables. In addition, it allows you to create reports, forms, and queries from the related data tables and save them in the database file. Relating tables allows you to create smaller, more efficient tables that can be referenced when you need access to the data.

When you relate tables, the table from which you select a field to join is the primary table, and the second table containing the field you want to associate is the related table. The tables must have at least one common field that contains the same type of data. This common field is called the join field. The join fields in both tables must have the same or equivalent data types and, if they are Number fields, they must have the same field size. In addition, the join field in the primary table must be the primary key in order to avoid duplicate entries.

For example, the following table consists of customer names and address fields, along with a unique identification number for each customer, which serves as the primary key in the table.

ID Name Address City Country Zip 1 Smith 1 St John Street London EC1 2 Conrad 16 Guildford Road Woking Surrey GU21 2EE 3 Kane 10 Butely Road Luton Beds LU4 9EY 4 Apple 51 Beacon Ave. Banbury Oxon OX15 4AG 5 Billow 92 Sherry Lane Clifton Yorks YO3 6PY

You could then create a separate table consisting only of orders placed by customers. This table would also contain the field for the unique customer identification number, but not the customers’ names and addresses.

ID # Order

1 Office Work Centre

2 All-In-One Corner Desk and Hutch

3 Open-Front Steel Bookcase

4 2-Drawer Letter File

5 Executive Leather Chair, Black

By relating the two tables through the common customer identification number field, the customers’ name and address does not have to be entered for every order. All that has to be entered is the customer identification number, along with the orders.

Access includes two basic types of relationships: one-to-many and one-to-one. A one-to-many relationship occurs when one record from the primary table matches many records from the related table (e.g., one customer record matches many order records). A one-to-one relationship occurs when one record from the primary table matches one record from the

Page 192: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 187

related table. Access determines the relationship type automatically when you create the relationship.

CREATING A RELATIONSHIP BETWEEN TABLES

Discussion The Relationships window displays a graphic representation of database relationships and allows you to create relationships between tables. You drag field lists in the Relationships window to reposition them as needed. In addition, any field name that represents a primary key is bolded in the corresponding field list.

You can add tables to the Relationships window for additional joins. For example, if the Relationships window displays only two related tables and you need to access information from a third table, you can easily add the required table to the Relationships window and then create the join.

Procedure 1. Select the Database Tools tab. 2. Click the Relationships command in the Relationships group.

3. If necessary, click the Show Table button . 4. Click the Tables tab. 5. Click the first table you want to relate to. 6. Click the Add button. 7. Select the second table you want to relate. 8. Click the Add button. 9. Add further tables as required.

10. Click the Close button.

Page 193: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 188

11. Drag the common field in the first table to the common field in the second table.

12. In the Edit Relationships dialog box, click the Create button.

13. Repeat for any further relationships.

14. Click the Close button on the Relationships window. 15. In the Message box, click the Yes button.

SETTING REFERENTIAL INTEGRITY

Discussion When you create a relationship between two tables, you can set referential integrity. Referential integrity is a built-in set of rules Access uses to make sure that the relationship is valid. Referential integrity can also prevent accidental deletion or editing of data. In order to use referential integrity, the following conditions must be true: the related field in one table must be its primary key, the related fields in both tables must have the same data type, and both tables must belong to the same database.

When you set referential integrity, you must observe the following three rules. First, you cannot enter data in the join field in the "many" table that does not have a match in the join field in the "one" table. Second, you cannot delete records from the "one" table if there are

Page 194: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 189

matching records in the "many" table. Third, you cannot edit primary key values if related records exist.

If you want to perform any of the changes listed above, however, and still maintain referential integrity, you can select the Cascade Update Related Fields and Cascade Delete Related Records options in the Edit Relationships dialog box. If either or both of these options are selected, Access automatically makes the necessary changes to related tables to maintain referential integrity. It is recommended that these two options be selected only after careful consideration, since the changes cannot be undone.

When referential integrity is enforced, Access displays symbols above the join line to indicate the type of relationship, one-to-one or one-to-many. The number 1 above a join line indicates “one”, and the mathematical symbol for infinity (which resembles a horizontal 8) indicates “many”.

Double-clicking the middle segment of any join line opens the Edit Relationships window with the selected join displayed. Double-clicking the beginning or ending segment of any join line opens the Edit Relationships window, but with no join selected. You can then use the Table/Query list to select the desired join.

Procedure 1. Select the Database Tools tab. 2. Click the Relationships command in the Relationships group. 3. Double- click the join line between the two tables whose referential integrity you

want to establish. 4. In the Edit Relationships dialog box, select the Enforce Referential Integrity

option.

5. Click OK.

VIEWING SUBDATASHEETS

Discussion Subdatasheets are datasheets nested in the primary table and display the data in the related foreign tables; it rather like being able to see data from two tables at the same time.

When you create a relationship between two tables, Access automatically creates subdatasheets. When you open the primary table, a column containing expand symbols appears at the left of the table next to each record. Clicking the expand symbol displays a subdatasheet of data from the foreign table.

Page 195: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 190

Table displaying a subdatasheet for related records (one-to-many relationship)

If the primary table has relationships with more than one table, when you click the expand symbol, you are prompted for which table you want to see a datasheet for. Upon selecting the table, Access should automatically identify the related field and populate the Link Child Fields: and Link Master Fields: boxes.

It is not necessary to have a relationship between tables in order to view subdatasheets. If there is a valid joining field between two tables, you can open the primary table and select the Subdatasheet command in the Records group of the Home tab.

Record in primary table

Related records in foreign table

Expand buttons for other primary records

Page 196: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 191

This command opens the dialog box shown above and you can select the table that you want to be the source for the subdatsheet and, if necessary, select the appropriate linking fields. When you click OK, Access will offer to create a relationship between the tables but it is not necessary to click Yes for the feature to work.

In addition to viewing data, you can edit data right in the subdatasheet; the edited data is saved back to the table in which it is stored.

Procedure (viewing datasheets) 1. To display subdatasheets, first open the primary table that has a relationship with

another.

2. Click the expand symbol next to the record you want to see a subdatasheet for. 3. If available, click an expand button next to a record in the subdatasheet to drill

down further into the data.

4. Click the collapse symbol(s) next to any expanded record(s) to close any open subdatasheets.

5. Close the table.

Procedure (changing the subdatasheet source table) 1. Open the primary table for which you to want to change the subdatasheet. 2. Select the Home tab. 3. Click the More command in the Records group.

4. Hold the mouse pointer over the Subdatasheet item. 5. Click Subdatasheet….

Page 197: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 192

6. Select the table or query that you want as the source for the subdatasheet.

7. If necessary, in the Link Child Fields: and the Link Master Fields: drop lists, select

the linking field from each table. 8. Click OK.

Tip

You can use the More > Subdatasheet side menu to quickly expand or collapse all the subdatasheets for a table, or remove a subdatasheet form a table.

DELETING A RELATIONSHIP

Discussion Deleting a relationship line removes the relationship between two tables. You may want to delete a join line if you no longer need to relate the tables or you want to create a different relationship.

You must select a relationship line before you can delete it. You must click the middle segment of a relationship line in order to select it; clicking the beginning or ending segment does not select the relationship line. You can also delete a relationship line by right-clicking its middle segment and selecting the Delete command.

Procedure 1. Select the Database Tools tab. 2. Click the Relationships command in the Relationships group. 3. Click the middle of the relationship line that you wish to delete. 4. Press the [Delete] key. 5. Click Yes to the warning message.

Page 198: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 193

Or

1. Right click the relationship line that you want to delete.

2. Click Delete . 3. Click Yes to the warning message. 4. In all cases, close the Relationships window. 5. Respond to saving the layout, if prompted. This will only appear if you have

added, removed or repositioned tables.

Page 199: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 15 – Creating Table Relationships

WWP Learning and Development LTD Page 194

EXERCISE CREATING RELATIONSHIPS

1. Open Train08. 2. Open the Relationships window. 3. Add the Client and Project tables to the Relationships window. 4. Create a relationship between the Client ID field in the Client table and the Client

ID field in the Project table; set referential integrity for the relationship. 5. Add the Trainer table to the Relationships window. 6. Create a relationship between the Trainer Initials field in the Project table and the

Initials field in the Trainer table; set referential integrity for the relationship. 7. Close the Relationships window and save the changes. 8. Open the Client table in Datasheet view and view the subdatasheet for the

CONCORD client. Then, collapse the subdatasheet and close the Client table. 9. Open the Relationships window. Delete the relationship line between the Project

and Trainer tables and remove the Trainer field list, since it is no longer related to any tables. Then, close the Relationships window and save the changes.

10. Close the database file.

Page 200: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 195

LESSON 16 - USING OPERATORS IN QUERIES

In this lesson, you will learn how to:

• Use comparison operators

• Use an And condition

• Use an Or condition

• Use the Between And operator

• Use the Expression Builder

• Use a wildcard character

Page 201: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 196

INTRODUCTION

Discussion You can add criteria to a query in order to limit the number of records in the query results. The simplest criterion is to find all records matching a single value.

You can also use comparison operators to limit the query results to a group of records. Comparison operators are symbols that represent conditions recognised by Access. The following comparison operators are available in Access:

Operator Description < less than <= less than or equal to > greater than >= greater than or equal to = equal to <> not equal to Not reverses logic

You can use one or more comparison operators to compare a specified value to all the values in a field. For example, you may want to find all customers with credit limits of less than £1000 or all customers with a contract date on or before January 2012; you can use a combination of comparison operators and field values to write an expression defining the desired criteria (e.g., <1000 or <=1/1/01, respectively). When you run the query, only those records with values meeting the specified criteria appear in the dynaset.

NB: when entering dates as criteria, Access will add hashes ( # ) around it to distinguish it from, for example, 1 divided by 1 divided by 11.

#1/1/11# is a date : =1/1/11 is a number

Procedure 1. Open the required query in Design view. 2. Click in the Criteria row in the field for which you want to add criteria. 3. Type the desired comparison operator and value. 4. Press the [Enter] key. 5. View or Run the query.

Page 202: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 197

USING AN AND CONDITION

Discussion Many times, a query requires more than one condition to obtain the desired result. If you want to find all customers in one region with sales to date of over £10,000, for example, you need two conditions: Region=South and Sales to Date>10000. The records must meet both conditions in order to be included in the query results. When two or more criteria must be met, you are creating an And condition. An And condition for two separate fields is created by entering the criteria into the same criteria row for the fields.

Creating an AND criteria for two separate fields

You can also create an And condition by adding multiple criteria to a single field. In order to do this, you must use the And operator to find records that fall within a range. For example, to find customers whose contract dates fall between 1/9/11 and 30/9/11, you would type both criteria in a single cell in the Criteria row of the appropriate field (i.e., >=1/9/99 And <=30/9/99 in the Contract Date field).

Creating an AND criteria for the same field

Page 203: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 198

Procedure 1. Open the required query in Design view. 2. Click in the Criteria row of the first field. 3. Type the desired criteria. 4. Type additional criteria in the same Criteria row of one or more other fields. 5. Press [Enter]. 6. View or Run the query.

USING AN OR CONDITION

Discussion There are times you may want to find records that meet only one of several specified conditions. This is called an Or condition. If you want to find all customers in Surrey or all customers with sales to date of over £10,000, for example, you would need two conditions: Country = Surrey and Sales to Date > 10000. A record needs to meet only one of the conditions in order to be included in the dynaset.

You can create an Or condition in a single field by entering criteria in different Criteria rows of that field. You can also create an Or condition by typing criteria in different Criteria rows of two or more fields.

You can create additional Or and And conditions by typing criteria into the Criteria row, the or row, or any row below the or row. Any criteria entered into the same Criteria row creates an And condition, any criteria entered into different rows creates an Or condition, and you can even create a combination of And and Or conditions.

Criteria entered in the same Criteria row across the design grid create an And condition, and criteria entered in different Criteria rows create an Or condition. Examples of OR conditions are given below:

Extracts all records where London is in the City

field OR where France is in the Country field Extracts all records where London OR Cardiff

OR Belfast is in the City field

Page 204: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 199

Alternative way of entering criteria for previous

example Combination AND / OR criteria. Extracts all

records where London is in the City field AND >5000 is in the same record for the CredLimit

field OR where Cardiff is in the City field AND >3000 is in the same record for the CredLimit

Procedure 1. Open the required query in Design view. 2. Click in the Criteria row of the first field. 3. Type the desired criteria. 4. Click in the Or row of the next required field. 5. Type the second criteria. 6. Press [Enter]. 7. View or Run the query.

USING THE BETWEEN AND OPERATOR

Discussion You can use the Between And operator to find data that includes or falls between two stated values. The Between And operator is inclusive; all records with values that include or fall between the stated criteria are included in the dynaset. It can be used in text, numeric, or date fields.

Spaces must be included between the criteria and the words Between and And. If you do not include the proper spacing, the Data type mismatch in criteria expression error message will appear. You do not have to type the criteria with capital letters B and A; Access will do it for you when you view or run the query.

Page 205: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 200

Procedure 1. Open the required query in Design view. 2. Click in the Criteria row of the first field. 3. Type Between, the first value in the range, then type And, and then, the last value

in the range. 4. Press [Enter]. 5. View or Run the query.

USING THE EXPRESSION BUILDER

Discussion When you enter criteria, you are actually creating an expression. Expressions are calculations and can include database objects, operators, and values. Objects range from table fields to controls in a form. Operators are standard mathematical operators used in calculations (such as +, -, *, /, (), <>). Values can be numbers, dates, text, and built-in functions, as well as field, control, and property identifiers.

You can create an expression by typing the expression elements, or you can use the Expression Builder. The Expression Builder is a tool that provides all the elements needed to build the expression.

The Expression Builder displays the Expression box in its top pane, a row of operator buttons below the Expression box, and three lower panes that display categories, subcategories, and values, respectively.

Page 206: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 201

The Expression Builder

You can use a combination of methods to build a new expression. You can type some elements of the expression and select others (such as operators, functions, and values) from the Expression Element / Categories and Values panes. If you make a mistake, you can select and delete any elements that you want to remove from the Expression box.

The Expression Builder is available in Design view for any database object for which you need to create an expression. For example, you can use the Expression Builder to create complex criteria a query.

Procedure 1. Open the required query in Design view. 2. Right click the criteria row where you want to enter the first condition. 3. From the shortcut menu, select Build….

OR

Click the Builder command in the Query Setup group of the Design tab.

4. In the Expression Builder, expand the Expression Elements pane as necessary. 5. Click the required element.

Page 207: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 202

6. Click the required subcategory in the Expression Categories pane. 7. Double click on a value in the Expression Values pane to insert it in the Expression

box. 8. Click OK.

Alternatively, to enter a value manually

1. Open the Expression Builder as described above. 2. Select existing text or position the insertion point as needed in the Expression box. 3. Type the required value. 4. Complete the expression. 5. Click OK.

USING A WILDCARD CHARACTER

Discussion You can use a wildcard in a query in place of one or several characters. Wildcard characters are helpful when you want to find criteria with a pattern (such as all last names beginning with M), or if you are not sure exactly how values you want to find appear (such as the correct spelling—Kline or Klein). When you use wildcard characters (? and *), Access automatically inserts the word Like before the criteria and quotation marks (“ ”) around text.

Common wildcards are listed in the following table:

Character Description Example

* Matches any number of characters. You can use the asterisk anywhere in a character string.

wh* finds what, white, and why, but not awhile or watch.

? Matches any single alphabetic character. B?ll finds ball, bell, and bill

[ ] Matches any single character within the brackets.

B[ae]ll finds ball and bell but not bill

! Matches any character not in the brackets. b[!ae]ll finds bill and bull but not ball or bell

- Matches any one of a range of characters. You must specify the range in ascending order (A to Z, not Z to A).

b[a-c]d finds bad, bbd, and bcd

# Matches any single numeric character. 1#3 finds 103, 113, 123

Procedure 1. Open the required query in Design view. 2. Click in the Criteria row for the required field. 3. Type the desired criteria, using wildcards as appropriate. 4. Press the [Enter] key. Access may add extra characters or words to the criteria 5. View or Run the query.

Page 208: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 203

Extracts all records where the ShopName starts with Sport. The rest of the name can

be any character and any number of characters.

Extracts all records where the ShopName starts with Sp, the third character can be

anything, the fourth character must be an R and the rest of the name can be any

character and any number of characters.

Page 209: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 16 – Using Operators in Queries

WWP Learning and Development LTD Page 204

EXERCISE USING OPERATORS IN QUERIES

1. Open Train17. 2. Open the Course Query in Design view. 3. Set criteria to find only projects with a cost of more than £150. 4. Run the query; the criteria should find 16 records. Then, return to Design view and

delete the criteria. 5. Use wildcards and an Or condition to find only records with the text excel or word

occurring anywhere in the course name (Hint: Use asterisks both before and after each criteria).

6. Run the query; the criteria should find 7 records. Then, return to Design view and delete the criteria from the query.

7. Extract only those records with a start date between 1/4/2011 and 30/6/2011. 8. Run the query; the criteria should find 12 records. Then, switch back to Design

view and delete the criteria. 9. Find all records with trainer initials of DF and a cost of £175 or more. The criteria

should find 5 records. 10. Close the query, saving the changes. 11. Close the database file.

Page 210: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 205

LESSON 17 - ADVANCED QUERIES

In this lesson, you will learn how to:

• Set top values in a query

• Create a calculated field

• Format a calculated field

• Create a function query

• Create a parameter query

• Create a concatenation in a query

• Add a calculated field to a table

Page 211: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 206

SET TOP VALUES IN A QUERY

Discussion Access offers several types of queries to help you to display the information you wish to retrieve from the database. You can apply functions and other expressions to fields so as to deliver calculated results, specify limitations to the number of values you display and summarise values from the values in your tables.

You can limit the results of a query so that only the highest or lowest values in a field appear in the query results. You can also limit the number of records to a specific number or percentage of all records being queried.

The field for which you are setting the top or bottom values must be sorted. If the field is sorted in descending order (Z to A, 9 to 0), the top values will be found. If the field is sorted in ascending order (A to Z, 0 to 9), the bottom values will be found.

Procedure 1. Open the required query in Design view. 2. Select the Sort row of the required field. 3. Select the order you require (Ascending or Descending). 4. In the Query Setup group, click the Return list arrow. 5. Click the value you require (or type your own in the box). 6. When the query is run, only the top number of values is displayed.

Query returning top five results only

Page 212: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 207

CREATING A CALCULATED FIELD

Discussion Access allows you to create expressions that calculate new field values; for example, you can create an expression that multiplies the value in the Quantity field by the value in the Price field to calculate total sales.

In expressions, field names are enclosed in square brackets ([ ]); numbers are not. For example, to calculate 20% of sales and display the results in a column named Commission, you would enter Commission:0.2*[Sales] in the design grid. (The colon separates the column name from the expression.) The field names used in an expression must be the same as the field names that appear in the table.

Calculated fields are created in queries. You can also use criteria to remove nonessential records, thereby allowing the query to run faster. The results of your query can then be used to generate a report.

You can also use the Expression Builder to create a calculated field by selecting any blank Field row and clicking the Build button on the Query Design toolbar (see Using The Expression Builder on page 200).

To help you see your calculated field expression more easily while you are creating it, you can open the Zoom window by holding down the [Shift] key and pressing F2.

Page 213: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 208

Procedure 1. Open the required query in Design view. 2. Click in a blank Field row. 3. Type a name for the calculated field followed by a colon, eg. ItemPrice: 4. Type the expression required for the calculation. Field names must be in square

brackets, eg. [Quantity] * [UnitPrice] 5. Press the [Enter] key. 6. View or Run the query.

FORMATTING A CALCULATED FIELD

Discussion Once you have created a calculated field, you can change its properties as you would any other field on the design grid. The Format property determines how data appears in Datasheet view. For example, you can change the properties of a calculated field so that the field values display as currency.

Procedure 1. Open the required query in Design view. 2. Click in the field to be formatted. 3. In the Show/Hide group, click the Property Sheet command. 4. In the Property Sheet, click the Format down arrow. 5. Select the required format. 6. View or Run the query.

Page 214: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 209

CREATING A FUNCTION QUERY

Discussion Access allows you to create a query that groups records by a selected field and then applies a function that calculates a value within the grouped fields.

A grouped and totalled report

Access allows you to perform more than one calculation on a field. For example, you can group records by weekly sales and then find both the minimum and maximum values.

There are several types of functions from which you can choose. The most commonly used functions are listed in the following table:

Function Description

Sum Totals the values in the calculated field

Average Averages the values in the calculated field

Count Counts the number of records in the calculated field

Max Finds the highest value in the calculated field

Min Finds the lowest value in the calculated field

Procedure 1. Open the required query in Datasheet view. 2. Select, if necessary, the Design tab under Query Tools. 3. In the Show/Hide group, click the Totals button. An extra Total: row appears near

the top of the query grid.

4. Add to the first column at the left of the query grid, the first field that you want to

group on, eg. LastName. 5. Leave the Total: row set to Group By. 6. If required, add to the second column from the left of the query grid the second

field that you want to group on, eg. FirstName. 7. Leave the Total: row set to Group By. 8. If necessary, continue adding more fields to group on in sequence at the left of the

query grid. In practice, you will only be grouping on one or two fields.

Page 215: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 210

9. Add in the next column to the right of the Group By fields, the field you want to create totals from. In most cases this will be a number or currency data type unless you just want to count when it can be a text data type.

10. Click the down arrow in the Total: row. 11. Select a function to aggregate by. 12. View or Run the query.

CREATING A PARAMETER QUERY

Discussion You can create a query to which you add different criteria each time you run it; such a query is called a parameter query.

A parameter query is designed to prompt the user for input each time it is run; Access then runs the query based on the criterion (parameter) entered.

A parameter query allows you to quickly and easily change query criteria without having to redesign the query.

You can add multiple parameters to a query. When you run the query, a prompt will appear for each parameter in it.

Procedure 1. Open the required query in Design view. 2. Click in the Criteria row of the desired field.

Page 216: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 211

3. Type the prompt surrounded by square brackets. 4. Press [Enter] 5. View or Run the query. 6. Type the required criteria in the text box. 7. Click OK.

Tip Press [SHIFT] F2 to open the Zoom window. This will make it easier to see and type the parameter into the Criteria: cell.

CREATING A CONCATENATION IN A QUERY

Discussion A concatenation query allows you to combine two or more text fields into one field. In other words, concatenation enables you to append one text string to another. In addition, you can insert characters between the text strings as needed. For example, you can concatenate the City, State, and Postal Code fields and store the concatenated text string in a fourth field, the Address field, adding commas and spaces between the text strings as needed.

When typing a concatenation expression, the first part of the expression defines the name of the new field and the second part of the expression defines the fields which are to be concatenated. All field names must be surrounded by brackets.

The concatenation character (the ampersand - &) appears between field names, and you must enclose any additional characters in double quotes. For example, the expression…

FullName: [Last Name]&", "&[First Name]

…concatenates the Last Name and First Name fields and inserts a comma and space in-between. The new field displays the last name, a comma, a space, and the first name for each record in the table.

You can also use concatenation to create text strings in forms and reports.

Page 217: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 212

Procedure 1. Open the required query in Design view. 2. Click in a blank Field row. 3. Type a name for the concatenated field followed by a colon, eg. FullName: 4. Type the expression required for the concatenation. Field names must be in square

brackets, eg. [FirstName] &” “& [LastName] 5. Press the [Enter] key. 6. View or Run the query.

ADDING A CALCULATED FIELD TO A TABLE

Discussion Microsoft Access 2010 introduces the ability to add a calculate field directly in a table. Although Access has always supported calculated fields in queries, sometimes you may prefer to perform calculations in a table so that you can more easily use them in other objects based on the table without having to create a separate query first, even though purists in database design will take issue with this!

In addition, SharePoint supports calculations in its tables; because of the integration between Access and SharePoint, Access must support the same sort of calculations in Access tables.

To add a calculated field to a table, you create a new field in table design view and give it a Calculation data type. This opens the Expression Builder where you enter the expression.

Page 218: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 213

The expression can be a simple calculation such as multiplying an Cost Price field by 20% to show tax payable or, they can be more complex involving conditional statements and other functions. Any fields used in the expression must be in the same table. Upon saving an viewing the table, the result of the expression will be shown for each record.

The calculated field expression builder

Procedure 1. In the Navigation Pane, right click the table that you want to add a calculated field

to. 2. Select Design View. 3. Click in the blank row at the bottom of the field list. 4. Type a name for the new field. 5. Click in the Data Type column for the new field. 6. Select Calculation. The Expression Builder appears. 7. Enter the required expression, a few simple examples are given in the table below. 8. Click OK. 9. Save the table design view and close.

Example expression Description

[ItemValue] * 0.2 Returns 20% of the item value.

[ItemQuantity] * [ItemPrice] Returns the item quantity field multiplied by the item price field.

[LastName] & “, “ & [FirstName] Joins the last name and first name fields with a comma and space in-between, eg. Smith, John.

IIF([Value]>=100,[Value]* 1.1,0) Increases value but only where the value is greater than or equal to 100.

Page 219: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Lesson 17 – Advanced Queries

WWP Learning and Development LTD Page 214

EXERCISE DESIGNING ADVANCED QUERIES

1. Open Train17. 2. Open the Project Sales query in Design view. 3. Create a new calculated field named Total Sales that multiplies the number of

students to be trained (Students field in the Project table) by the per student cost of the course (Cost field in the Courses table).

4. Run the query to view the results. Close the query and save it. 5. Open the Trainer Pay query in Design view. 6. Create a new field that concatenates the first and last names of each trainer. Name

the field Trainer Name and use the Last Name, First Name format. (Hint: Use the format Trainer Name:[last name]&", "&[first name])

7. Run the query and widen the Trainer Name column to view the text. Then, return to Design view.

8. Trainers are paid 15% percent of the total sale for each project. Create a calculated field named Pay that calculates the trainer's pay for each project. (Hint: Use Pay:[students]*[cost]*0.15)

9. Format the Pay field as currency. (Hint: Use the Property Sheet button.) Run the query to view the results. Then, return to Design view.

10. Find the three trainers with the highest pay. (Hint: Sort the Pay field in Descending order and type 3 into the Top Values box on the toolbar.) Run the query to view the results. Then, return to Design view.

11. Reset the Pay field back to (not sorted) and the top values back to All. 12. Run the query again. Use the Filter By Selection button to display only those

records for Diana Franz. 13. Close the query, saving the changes. 14. Open the Sales by Rep query in Design view. 15. Add a Totals row to the query grid (Hint: Design tab > Show/Hide group). 16. Group the query by Sales Rep and add a SUM and a COUNT field for Total Sales. 17. View the query dynaset; return to Design View. 18. Remove the Totals row. 19. Add a suitable parameter to the Criteria row of the Sales Rep field that prompts

you to enter the initials of the sales rep each time the query is run. 20. Run the query, typing sh into the parameter. Notice that only records that match

the criteria appear in the dynaset. 21. Close the query, saving the changes. 22. Close the database file.

Page 220: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 215

APPENDIX A - USING THE LABEL WIZARD

Discussion Access has a Label Wizard that guides you through the process of creating a report that prints labels. You can choose from many standard types of labels, or you can create your own custom label definition.

The Label Wizard provides a sample label into which you insert the fields you want to print in their desired order.

You can also type additional text that you want to appear on each label. For example, if you are creating an address label, you may want to include the text Attn: before the name of the addressee.

Procedure 1. Select the table containing the data (names and addresses) that you want to use for

the labels. 2. Click the Create tab. 3. In the Reports group, click the Labels button.

4. In the Filter by manufacturer: drop list, select the desired label manufacturer.

5. In the What label size would you like? List box, select the label size type. This

should be written on the labels box or on the label sheets themselves. If the manufacturer and/or label size is not listed, you can create a custom one as follows:

a. Click the Customize… button .

Page 221: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix A – Using the Labels Wizard

WWP Learning and Development LTD Page 216

b. Click New.

c. Type a name for the new custom label in the Label Name: box. d. Select the unit that that you are using for your measurements in the Unit of

Measure box. e. Under Label Type: Select Sheet feed if you are using single sheets of labels in

the printer or, select Continuous if you are using perforated, continuous feed paper (dot matrix printers only).

f. Under Orientation, select Portrait or Landscape. g. Enter how many labels your paper has horizontally in the Number Across: box. h. Carefully measure and enter the dimensions for the label, page margins and

spacing in-between into the nine measurement boxes. An error of just 1/10th of a centimetre will probably cause the printout to be misaligned.

i. Click OK when finished.

6. Click Close.

Page 222: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix A – Using the Labels Wizard

WWP Learning and Development LTD Page 217

7. Click Next.

8. Select font specifications as required. 9. Click Next. 10. Double click the field names you want for the label in the Available Fields: list,

remembering to press the [Enter] key for each line.

11. Click Next.

12. Set a sort order if required. 13. Click Next.

Page 223: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix A – Using the Labels Wizard

WWP Learning and Development LTD Page 218

14. Name the Label report if necessary. 15. Click the Finish button.

16. Click Print.

Page 224: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 219

APPENDIX B - EXCHANGING DATA WITH EXCEL

Discussion - Importing Data From Excel If you have data in an Excel workbook, you can use the information in an Access database. You can import or link all the data from a workbook or the specified data from a named range. When you import or link data, Access usually creates a new table for the information.

Procedure 1. Click the External Data tab. 2. In the Import group, click the Excel button.

3. Click the Browse… button and locate and select the Excel workbook containing the

data you want to import.

4. Click the Open button.

Page 225: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix B – Exchanging Data with Excel

WWP Learning and Development LTD Page 220

5. Choose from the three options as to whether you want import, append, or link. 6. Click OK.

7. Select the worksheet containing the data you want to import or, change the option

to Show Named Ranges and select the range that you want to import. 8. Click Next.

9. Specify whether the data has column headings. 10. Click Next.

Page 226: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix B – Exchanging Data with Excel

WWP Learning and Development LTD Page 221

11. Specify options, if necessary, for the first field (ie. Field Name: Indexed: Data Type: Do

not import field (Skip)). 12. Click the thin, grey heading for the next column. 13. Repeat step 11. 14. Continue setting options for all columns, if necessary. 15. Click Finish.

16. Tick the Save import steps check box if you anticipate importing the table again.

You can then repeat the process without having to go through all the steps of the Import Wizard again.

17. If step 16 has been actioned, click Save import otherwise, click Close. 18. The imported table is added to the Navigation Pane under tables.

Page 227: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix B – Exchanging Data with Excel

WWP Learning and Development LTD Page 222

Tip To successfully import Excel data, ensure that the data table starts in cell A1 of the worksheet. If this is not possible, for example, there is a title or blank rows at the top of the worksheet, name the data range in Excel and import it using the Show Name Ranges option.

Tip

If you have saved the import steps, you can re-import the same data using the Saved Imports command – External Data tab > Import

& Link group . The Saved Imports dialog box can also be used to delete and rename the saved import(s). You can add a reminder to Outlook to run the import on a particular date or in a recurring pattern. The Outlook task includes a command button to run the import.

Discussion - Exporting Data to Excel Access table data can easily be converted into an Excel worksheet for analysis. Once the data has been transferred, Excel can be used to analyse or chart the data. The resulting data can then be imported back into Access.

Procedure 1. Click the External Data tab. 2. In the Export group, click the Excel button.

Page 228: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix B – Exchanging Data with Excel

WWP Learning and Development LTD Page 223

3. Click the Browse… button to specify a destination for the exported data.

4. In the File Save dialog box, select the location for the new workbook and name it. 5. Click Save.

6. Click the File format: drop down list. 7. Select the Excel format to export the data as. 8. Tick, if required, the Export data with formatting and layout check box. 9. Tick the Open destination file after export operation is complete check box, if

required. This check box will only activate if step 8 above has been actioned. 10. Click the OK button. If step 9 has been actioned, Excel will launch and the data

displayed. Quit Excel.

Page 229: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Appendix B – Exchanging Data with Excel

WWP Learning and Development LTD Page 224

11. Tick the Save export steps check box if you anticipate importing the table again. You can then repeat the process without having to go through all the previous steps again.

12. If step 11 has been actioned, click Save export otherwise click Close.

Tip

If you have saved the export steps, you can re-export the same data using the Saved Exports command – External Data tab > Export

group . The Saved Exports dialog box can also be used to delete and rename the saved export(s). You can also add a reminder to Outlook to run the export on a particular date or in a recurring pattern. The Outlook task includes a command button to run the import.

Page 230: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

WWP Learning and Development LTD Page 225

INDEX

A Access

exiting ............................................................................. 12 Actions

redoing.......................................................................... 144 undoing ......................................................................... 144

AutoCorrect adding entries ............................................................... 176 setting options .............................................................. 175

B Background colour

changing in forms and reports ...................................... 170 Borders

changing in forms and reports ...................................... 171 Bound controls

text box ................................................................. 125, 133

C Calculated fields

concatenation ............................................................... 211 creating ......................................................................... 207 formatting ..................................................................... 208

Column width changing ......................................................................... 66

Columns deleting ........................................................................... 64 freezing ........................................................................... 79 freezing in a table ........................................................... 72 hiding .............................................................................. 70 inserting in a table .......................................................... 62 moving ............................................................................ 63 selecting .......................................................................... 70 unfreezing ....................................................................... 73 unhiding .......................................................................... 71

Comparison operators using ............................................................................. 196

Concatenation using in a query ............................................................. 211

Conditions And ............................................................................... 197 Between And ................................................................ 199 Or 198

Controls adding lines and rectangles to a form or report ........... 143 aligning ......................................................................... 138 applying special effects ................................................. 172 bound ................................................................... 126, 134 changing background colour ........................................ 170 changing character format ........................................... 168 changing lines and borders on ...................................... 171 changing the font .................................................. 167, 169 deleting ......................................................................... 128 editing in Design View .................................................. 133 formatting ..................................................................... 167 labels ..................................................................... 126, 134 moving part of a paired ................................................ 137

sizing ............................................................................. 126 spacing .......................................................................... 139 text box ................................................................. 126, 134 unbound ................................................................ 126, 134 using .............................................................................. 125 using the Format Painter............................................... 172 using the Image tool ..................................................... 141

Criteria adding to a query .......................................................... 104 creating expressions ..................................................... 200

D Data

replacing ......................................................................... 83 Data types

assigning .......................................................................... 22 AutoNumber ................................................................... 23 Currency .......................................................................... 23 Date/Time ....................................................................... 22 Hyperlink ......................................................................... 23 Lookup Wizard ................................................................ 23 Memo .............................................................................. 22 Number ........................................................................... 22 OLE object ....................................................................... 23 Text ................................................................................. 22 Yes/No ............................................................................. 23

Database Wizard creating databases .......................................................... 16

Databases creating ........................................................................... 16 forms ................................................................................. 7 macros .............................................................................. 7 modules ............................................................................ 7 queries .............................................................................. 7 reports .............................................................................. 7 tables................................................................................. 7

Datasheet view opening a query .............................................................. 95 viewing tables ................................................................. 28

Date/Time formats setting ............................................................................. 39

Default values setting ............................................................................. 41

Deleting datasheet columns .......................................................... 64

Design View adding a field to a form or report ................................. 136 adding an image ............................................................ 141 adding controls ............................................................. 143 adding labels ................................................................. 140 aligning controls ............................................................ 138 creating a query .............................................................. 94 disabling the Snap to Grid feature ................................ 135 displaying the field list .................................................. 135 displaying the ruler ....................................................... 134 editing an unbound control .......................................... 144 formatting controls ....................................................... 167 forms and reports ......................................................... 133 hiding the ruler ............................................................. 134 moving part of a paired control .................................... 137

Page 231: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Index

WWP Learning and Development LTD Page 226

spacing controls ............................................................ 139 using for tables ............................................................... 21

Dynaset ................................................................................ 92

E Excel

exporting from Access .................................................. 222 importing to Access ...................................................... 219

Exporting data to Excel ......................................................................... 222

Expression Builder using in query calculations............................................ 207 using to create query criteria........................................ 200

F Field list

displaying for a form or a report ................................... 135 Field properties

creating an input mask ............................................. 44, 46 limiting the field size ....................................................... 36 Lookup ............................................................................ 48 modifying Lookup properties .......................................... 54 number formats .............................................................. 38 property types ................................................................ 35 setting date/time formats .............................................. 39 setting default values ..................................................... 41 setting validation rules/text............................................ 42 setting yes/no formats.................................................... 40 Smart Tags ...................................................................... 57 using ............................................................................... 35

Fields adding to a form or report ............................................ 136 hiding in a query ........................................................... 105

Filter By Form ...................................................................... 87 Filter By Selection ................................................................ 86 Filtering

field filters ....................................................................... 84 Filter By Form ................................................................. 87 Filter By Selection ........................................................... 86 records in a form .......................................................... 122

Finding data in forms................................................................. 121 finding specific records ................................................... 81 Instant Search ................................................................. 83 using wildcards ............................................................... 82

Font attributes changing ......................................................................... 69

Fonts changing ............................................... 168, 170, 172, 173 changing in forms and reports .............................. 167, 169 formatting characters ................................................... 168

Form View ......................................................................... 115 Format Painter

using ............................................................................. 172 Formatting

calculated fields ............................................................ 208 datasheets ...................................................................... 68

Forms ..................................................................................... 7 adding a record ............................................................. 120 applying special effects to controls .............................. 172 changing lines and borders ........................................... 171 changing the background colours ................................. 170 changing the font .................................................. 167, 169 create using FormTools ................................................ 110

creating a one table form .............................................. 115 creating a two table form ............................................. 116 creating using the Report Tool ...................................... 148 datasheet type .............................................................. 113 editing record ................................................................ 120 filtering records ............................................................. 121 finding data ................................................................... 121 Form View ..................................................................... 115 formatting ..................................................................... 167 formatting characters ................................................... 168 moving between fields .................................................. 120 multiple item ................................................................. 112 printing records ............................................................. 118 sorting records .............................................................. 120 split forms ..................................................................... 112 the Form Wizard ........................................................... 114 types.............................................................................. 111 using .............................................................................. 110 viewing records ............................................................. 118

G Grouping and summarising

in queries ...................................................................... 209 in reports ....................................................................... 157

H Help

screentips ...................................................................... 182 searching for topics ....................................................... 180 Table of Contents .......................................................... 181 using .............................................................................. 180

I Images

adding ........................................................................... 141 Importing data

from Excel ..................................................................... 219 Input mask

creating custom .............................................................. 47 Input Mask Wizard ......................................................... 44, 47 Instant Search

finding records ................................................................ 83

J Joins in queries..................................................................... 98

L Label Wizard

using .............................................................................. 215 Labels

adding to a form or report ............................................ 140 editing text .................................................................... 144

Layout View ....................................................................... 125 create a form in ............................................................. 111 create a report in .......................................................... 154

Layouts ............................................................................... 125 adding controls in.......................................................... 128 create a form in ............................................................. 110 deleting controls in ....................................................... 128 manipulating controls in ............................................... 126

Page 232: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Index

WWP Learning and Development LTD Page 227

moving controls automatically ..................................... 127 moving controls in ........................................................ 127 moving controls using keyboard ................................... 127 sizing controls in ........................................................... 127 space controls automatically ........................................ 128 tabular .......................................................................... 129

Lookup field creating ........................................................................... 48 properties ....................................................................... 54

Lookup list creating ........................................................................... 48

Lookup properties modifying ........................................................................ 54 types ............................................................................... 54

Lookup Wizard creating a list .................................................................. 48

M Macros ................................................................................... 7 Modules ................................................................................. 7

N Number formats

setting ............................................................................. 38

O Operators

And ............................................................................... 197 Between And ................................................................ 199 Or 198

P Parameters

adding to a query .......................................................... 210 Primary keys

setting ............................................................................. 25 Print Preview

viewingreports .............................................................. 154 Printing

queries .......................................................................... 106 records in a form .......................................................... 118 recordsets ..................................................................... 106 report pages ................................................................. 156

Proofing adding AutoCorrect entries .......................................... 176 setting AutoCorrect options ......................................... 175 spellchecking ................................................................ 174

Q Queries ............................................................................ 7, 92

adding a table ................................................................. 97 adding criteria ............................................................... 104 adding records .............................................................. 106 adding tables to .............................................................. 97 creating a calculated field ............................................. 207 creating in Design view ................................................... 94 creating with functions ................................................. 209 grouping records ........................................................... 209 hiding a field ................................................................. 105 join types ........................................................................ 98

joining fields (concatenation) ........................................ 211 joining tables ................................................................... 97 opening ........................................................................... 95 parameter ..................................................................... 210 printing .......................................................................... 106 running ............................................................................ 96 setting top values .......................................................... 206 Simple Query Wizard ...................................................... 92 sorting ........................................................................... 103 using an And condition ................................................. 197 using an Or condition .................................................... 198 using comparison operators ......................................... 196 using the Between And operator .................................. 199 using wildcard characters ............................................. 202

R Records

adding ............................................................................. 29 adding using a form ...................................................... 120 adding using a query ..................................................... 106 deleting ........................................................................... 32 editing ............................................................................. 30 finding specific ................................................................ 81 moving through ............................................................... 29 replacing data ................................................................. 83 saving .............................................................................. 31 selecting .......................................................................... 30 viewing in forms ............................................................ 118

Recordsets ........................................................................... 92 printing .......................................................................... 106

Redo using .............................................................................. 144

Referential integrity setting ........................................................................... 188

Relationships creating between tables ............................................... 187 deleting ......................................................................... 192 one-to-many ................................................................. 186 one-to-one .................................................................... 186 setting referential integrity ........................................... 188 subdatasheets ............................................................... 189 using related tables ....................................................... 186 window ......................................................................... 187

Renaming datasheet columns .......................................................... 63

Replace ................................................................................ 83 Report Wizard .................................................................... 149 Reports................................................................................... 7

applying special effects to controls ............................... 172 changing lines and borders ........................................... 171 changing the background colours ................................. 170 changing the font .................................................. 167, 169 columnar ....................................................................... 148 creating ................................................................. 148, 149 creating single table ...................................................... 150 creating two table ......................................................... 152 formatting ..................................................................... 167 formatting characters ................................................... 168 grouping and summarising data.................................... 157 printing pages ............................................................... 156 tabular ........................................................................... 148 using Design View ......................................................... 148 using the Label Wizard .................................................. 215 viewing .......................................................................... 154

Row height

Page 233: VERSION 2010 FOUNDATION - WWP 2010 Foundation Course Book(1... · VERSION 2010 . FOUNDATION . Microsoft Access 2010 – Foundation Contents . WWP Learning and Development LTD . CONTENTS

Microsoft Access 2010 – Foundation Index

WWP Learning and Development LTD Page 228

changing ......................................................................... 65 Ruler

displaying ...................................................................... 134 hiding ............................................................................ 134

S Simple Query Wizard ........................................................... 92 Smart Tags

setting property in field .................................................. 57 types ............................................................................... 58

Snap to Grid disabling ........................................................................ 135

Sorting clearing a sort order ....................................................... 80 multiple column .............................................................. 79 records in a datasheet .................................................... 79 records in forms ............................................................ 121

Special effects applying to controls on forms and reports ................... 172

Subdatasheets viewing.......................................................................... 189

T Table Design View

adding fields ................................................................... 24 deleting fields ................................................................. 24 moving fields .................................................................. 24

Tables adding a totals row ......................................................... 74 adding a Totals row ...................................................... 212 adding records ................................................................ 29 adding to a query ............................................................ 97 assigning data types........................................................ 22 changing font attributes ................................................. 69 changing the column width ............................................ 66 changing the row height ................................................. 65 creating relationships ................................................... 187 deleting records .............................................................. 32 deleting relationships ................................................... 192 designing ......................................................................... 18 editing records ................................................................ 30 formatting height ............................................................ 68 freezing columns............................................................. 72 hiding columns ................................................................ 70 inserting a column .......................................................... 62 moving columns .............................................................. 63 moving through records ................................................. 29 navigating ....................................................................... 29 navigating fields .............................................................. 28

related ........................................................................... 186 renaming columns........................................................... 63 saving records ................................................................. 31 selecting columns ............................................................ 70 selecting records ............................................................. 30 setting a primary key....................................................... 25 unhiding columns ............................................................ 71 using Datasheet view ...................................................... 28 using Design view ............................................................ 21 viewing subdatasheets .................................................. 189

Themes modifying ...................................................................... 173 using .............................................................................. 173

Totals adding to a table ..................................................... 74, 212 aggregate types ............................................................... 74

U Unbound controls

editing ........................................................................... 144 labels ..................................................................... 125, 133

Undo using .............................................................................. 144

Unfreezing columns in a table ........................................................... 73

V Validation rules/text

setting ............................................................................. 42 Viewing

reports .......................................................................... 154

W Wildcard characters

using in queries ............................................................. 202 Wildcards

using ................................................................................ 82 Wizards

Form Wizard .................................................................. 114 Input Mask ................................................................ 44, 47 Report Wizard ............................................................... 149

Y Yes/No formats

setting ............................................................................. 40