95
Instructor: Eng. Juan E. Crespo Introduction to MS Access 2007 1 Copyright Crespo Technology Services Group, Inc.

Training Ms Access 2007

  • Upload
    crespoje

  • View
    19.618

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Training Ms Access 2007

Instructor:Eng. Juan E. Crespo

Introduction toMS Access 2007

1 Copyright Crespo Technology Services Group, Inc.

Page 2: Training Ms Access 2007

Course Outline Lesson 1: Exploring the Microsoft®

Office Access™ 2007 Environment Examine Database Concepts Explore the User Interface Explore the Ribbon Customize the Access Environment Obtain Help Use an Existing Access Database

Lesson 2: Designing a Database Describe the Relational Database Design

Process Define Database Purpose Review Existing Data Determine Fields Group Fields into Tables Normalize Data Designate Primary and Foreign Keys Determine Table Relationships

Lesson 3: Building a Database Create a New Database Create a Table Manage Tables Create a Table Relationship Save a Database as a Previous Version

Lesson 4: Managing Data in a Table Modify Table Data Sort Records Work with Subdatasheets

Lesson 5: Querying a Database Filter Records Create a Query Add Criteria to a Query Add a Calculated Field to a Query Perform Calculations on a Record

Grouping Lesson 6: Designing Forms

View Data Using an Access Form Create a Form Modify the Design of a Form

Lesson 7: Generating Reports View an Access Report Create a Report Add a Custom Calculated Field to a Report Format the Controls in a Report Apply an AutoFormat to a Report Prepare a Report for Print

2 Copyright Crespo Technology Services Group, Inc.

Page 3: Training Ms Access 2007

Exploring the Microsoft® Office Access™ 2007 Environment

Copyright Crespo Technology Services Group, Inc.3

Page 4: Training Ms Access 2007

Database ConceptsTerms

Database: collection of objects that allow you to store data, organize it and retrieve it in any way you want. It may contain:Tables: structure that allow you to organize the data

so that it's easy to find laterForms: let you input the data into the tables Reports: print selected information from the tables

Relational Database: stores data in various interrelated tables where data is stored, accessed and presented without affecting the structure

4 Copyright Crespo Technology Services Group, Inc.

Page 5: Training Ms Access 2007

Database Concepts

Last Name First Name Student ID City

Pérez Juan 101010 Utuado

Crespo Carlos 802-91-2515 Aguadilla

5 Copyright Crespo Technology Services Group, Inc.

Page 6: Training Ms Access 2007

Database ConceptsDatabase Design

Reason for the database: There are usually two reasons for a database:Data management: Add, remove or modify dataData analysis: Analyze information and trends

Database content

6 Copyright Crespo Technology Services Group, Inc.

Page 7: Training Ms Access 2007

Explore the User InterfaceMS Access 2007 is a Database

Management SystemIt allows the user to:

Retrieve and update dataPresent data sorted or groupedImport or export data from various sources

including the Internet

7 Copyright Crespo Technology Services Group, Inc.

Page 8: Training Ms Access 2007

Explore the User InterfaceThe user interface is composed of:

Office buttonQuick access tool barThe ribbonThe navigation paneThe MS Office window frameDialog box launcher

8 Copyright Crespo Technology Services Group, Inc.

Page 9: Training Ms Access 2007

Explore the User Interface

9 Copyright Crespo Technology Services Group, Inc.

Page 10: Training Ms Access 2007

Explore the User Interface

10 Copyright Crespo Technology Services Group, Inc.

Page 11: Training Ms Access 2007

Explore the Ribbon

Home TabViewsClipboardFontRich TextRecordsSort &

FilterFind

11 Copyright Crespo Technology Services Group, Inc.

Page 12: Training Ms Access 2007

Explore the Ribbon

Create TabTablesFormsReportsOther

12 Copyright Crespo Technology Services Group, Inc.

Page 13: Training Ms Access 2007

Explore the Ribbon

External Data TabImportExportCollect

DataSharePoi

nt List

13 Copyright Crespo Technology Services Group, Inc.

Page 14: Training Ms Access 2007

Explore the Ribbon

Database Tools TabMacroShow/HideAnalyzeMove DataDatabase

Tools

14 Copyright Crespo Technology Services Group, Inc.

Page 15: Training Ms Access 2007

Use an Existing DatabaseTables are

composed of three elementsFields: these are

the table columns

Records: these are the table rows

Values: A single piece of data

Student ID

Last Name

First Name

101010 Pérez Juan802-91-2154

Crespo Carlos

010101 Campos Diana

15 Copyright Crespo Technology Services Group, Inc.

Page 16: Training Ms Access 2007

Use an Existing DatabaseQueries

Request Information

Requires fields and table names

Can include conditions

Can be reusedCan perform

calculations

Student ID

Last Name

First Name

101010 Pérez Juan802-91-2154

Crespo Carlos

010101 Campos Diana

16 Copyright Crespo Technology Services Group, Inc.

Page 17: Training Ms Access 2007

Last Name First Name Dept.Crespo Carlos ISCampos Diana IS

Use an Existing Database

RecordsetIs a tableDisplays smaller set of recordsCan come from a table or query

Student ID

Last Name

First Nam

e

Birth Date

Dept. City

101010 Pérez Juan 01/01/70

HUM Utuado

802-91-2154

Crespo Carlos

07/16/73

IS Aguadilla

010101 Campos

Diana 03/20/78

IS Lares

123456 Figueroa

Ricardo

10/31/76

ADM Coamo

131313 Rivera David 11/02/80

ADM Utuado

17 Copyright Crespo Technology Services Group, Inc.

Page 18: Training Ms Access 2007

Use an Existing DatabaseForms

Used to display and edit data

Based on tables or queries

Can be customized

Can includeCalculationsGraphicsOther objects

18 Copyright Crespo Technology Services Group, Inc.

Page 19: Training Ms Access 2007

Use an Existing DatabaseReport

Screen output of data

Presented as specified by the user

Data comes from tables or queries

Can perform calculations and display results

Can be printed

19 Copyright Crespo Technology Services Group, Inc.

Page 20: Training Ms Access 2007

Customize the Access Environment

Can be found on the MS Office button

20 Copyright Crespo Technology Services Group, Inc.

Page 21: Training Ms Access 2007

Customize the Access Environment Various options to

customize the MS Access environmentDatabase objectsSecurityQuick Access toolbar

21 Copyright Crespo Technology Services Group, Inc.

Page 22: Training Ms Access 2007

Obtain Help

Access HelpComplete manual

on featuresQuick and easy

access to answers

22 Copyright Crespo Technology Services Group, Inc.

Page 23: Training Ms Access 2007

Design a Database

Copyright Crespo Technology Services Group, Inc.23

Page 24: Training Ms Access 2007

Relational Database Designing ProcessSequential process for developing a

database planThis process consists of seven steps

Database purposeReview existing dataCreate list of fieldsOrganize fields into tablesEnter sample data and verify if changes are

requiredDesignate primary and foreign keysDetermine table relationships

24 Copyright Crespo Technology Services Group, Inc.

Page 25: Training Ms Access 2007

Define Database PurposeStatement of purpose

Defines the scope of a databaseHelps guide the designImplies the kind of dataDetermine the probable users

25 Copyright Crespo Technology Services Group, Inc.

Page 26: Training Ms Access 2007

Review Existing Data

Copyright Crespo Technology Services Group, Inc.26

Relevant data to the statement of purposeCan be in paper or electronic

PaperInternal Business FormsGovernment FormsInvoices

ElectronicSpreadsheetsWord documentsDatabases (Access, MS SQL, Oracle, etc.)Web pages

Page 27: Training Ms Access 2007

Determine Fields

Copyright Crespo Technology Services Group, Inc.27

The required fields depend on the information required by the userReportsSummary information

Page 28: Training Ms Access 2007

Group Fields Into Tables

Copyright Crespo Technology Services Group, Inc.28

Business RulesPolicies and procedures that govern

operation of an organizationDefine methods for data entry in a databaseDefine a standard naming convention for

objects. Example: Student name object can be S_Fname and the lastname can be S_Lname

Page 29: Training Ms Access 2007

Database DesignClass Exercise

You are required to develop a database to keep track of the books being lent by the university library.

AssumptionsOnly students are allowed to take booksThe books can only be lent for two weeksNo other service will be tracked through this

database

29 Copyright Crespo Technology Services Group, Inc.

Page 30: Training Ms Access 2007

Database DesignClass Exercise

Develop a list of data required for this databaseHow many tables are required? Why?What information is required for each table?

30 Copyright Crespo Technology Services Group, Inc.

Page 31: Training Ms Access 2007

Normalize Data

Copyright Crespo Technology Services Group, Inc.31

NormalizationProcess organizing data in a databaseOptimizes table structureRefining database by reducing complex data

into simple table structuresOptimizes by

Eliminate redundancyEliminate inconsistency dependency between

tables

Page 32: Training Ms Access 2007

Normalize Data

Copyright Crespo Technology Services Group, Inc.32

Break data into smallest values possibleAssure data is not repeatedBreak repeated data into separate tablesAvoid empty fields as much as possibleConsistent references in tables (naming

convention)

Page 33: Training Ms Access 2007

De-normalization

Copyright Crespo Technology Services Group, Inc.33

DefinitionCombining tables into a bigger table

UsesMake queries run fasterKeep similar data togetherKeep table structure simple

Page 34: Training Ms Access 2007

Designate Primary and Foreign Keys

Copyright Crespo Technology Services Group, Inc.34

Primary KeyField with unique valuesValues identify each recordUsed to create relationships between tablesCan be of any data type except memo, OLE

or AttachmentCan never be blankValues do not change or have duplicates

Page 35: Training Ms Access 2007

Designate Primary and Foreign Keys

Copyright Crespo Technology Services Group, Inc.35

Composite KeyMade of the union of two unique fields

Foreign KeyField that relates to primary key of another

tablePrimary key acts as record indexHelps implement relationship between

tablesForeign key helps establish relationship

with primary key

Page 36: Training Ms Access 2007

Designate Primary and Foreign KeysClass Exercise

Define a primary and foreign key for each table. This field identifies each individual in a unique way.

List any field that contains a limited list of items. Example: City or state.

Define default values when possible. Example: 90% of students will be from PR.

36 Copyright Crespo Technology Services Group, Inc.

Page 37: Training Ms Access 2007

Determine Table Relationships

Copyright Crespo Technology Services Group, Inc.37

Representation of association among data contained within tables

Helps poll matching fieldsOne-to-one relationship

Primary key and foreign key are uniqueOne-to-many relationship

Primary key unique with many foreign key values

Page 38: Training Ms Access 2007

Building a Database

Copyright Crespo Technology Services Group, Inc.38

Page 39: Training Ms Access 2007

Create a Database

Copyright Crespo Technology Services Group, Inc.39

To create a databaseOpen Access 2007In the Getting

Started screen select blank database

Write database name and select location.

Press Create

Page 40: Training Ms Access 2007

Create a Table

Copyright Crespo Technology Services Group, Inc.40

Access creates a new table when a new blank database is created

New tables can be created by selecting the table icon on the Create tab

Page 41: Training Ms Access 2007

Table Views

Copyright Crespo Technology Services Group, Inc.41

Tables can be viewed in several ways. The two most common views are: Datasheet: This is the

default view and presents record values

Design: This presents the table and field properties but does no present record values

Page 42: Training Ms Access 2007

Field Insertion Feature

Copyright Crespo Technology Services Group, Inc.42

Allows adding new fields from datasheet viewWrite the field name in

the column headerRepeat for each field

Page 43: Training Ms Access 2007

Data Types

Copyright Crespo Technology Services Group, Inc.43

Text: Contains characters up to 255Memo: Advanced text field. Can hold up to 2 GB of

data with rich text formattingNumbers: Numeric values up to 16 bytesDate/Time: Stores and manipulates date and time

valuesCurrency: Monetary valuesAutoNumber: Automatically creates a numeric

value with new records. Are usually used as primary keys.

Yes/No: Boolean information (true or false)Hyperlink: Stores web addressesAttachment: Add files to a recordMultivalued: Can have more than one value

Page 44: Training Ms Access 2007

New Fields

Copyright Crespo Technology Services Group, Inc.44

Fields can be added through:Field insertion

feature Design view

Multivalued fields are added through the Lookup Wizard

Page 45: Training Ms Access 2007

Creating Tables

Copyright Crespo Technology Services Group, Inc.45

Create the tables for the books circulation class exercise

Use the datasheet view as well as the design view

Page 46: Training Ms Access 2007

Table Maintenance

Copyright Crespo Technology Services Group, Inc.46

Tables can be:DeletedRenamedExportedAdd a description in the Table Properties

Dialog

Page 47: Training Ms Access 2007

Table Properties

Copyright Crespo Technology Services Group, Inc.47

Allows for a detailed description of the table

Presents information about the tableCreate dateModified date

Allows to hide a tableAllows for row

tracking when used by multiple simultaneous users

Page 48: Training Ms Access 2007

Referential Integrity

Copyright Crespo Technology Services Group, Inc.48

Process to ensure data validity across two tables

It is enforced by ensuring values in a foreign field have corresponding values in the primary key

Referential integrity prevents the entering of invalid data

Benefits of Referential IntegrityAvoid data lossAvoid updating data

Page 49: Training Ms Access 2007

Referential Integrity

Copyright Crespo Technology Services Group, Inc.49

Referential integrity between two table can be set if:Both tables are in the same databaseThe matching field is a primary key in one

table or has a unique indexThe related fields have the same data type

Page 50: Training Ms Access 2007

Table Relationships

Copyright Crespo Technology Services Group, Inc.50

In the Database Tools tab select relationships

If no relationship exists, Access brings the Show Tables or Queries dialog to add them to the relationship

Once added, drag the primary key to the foreign key.

This brings the Edit relationships dialog

Referential integrity can be enforced here

A line is drawn between tables to indicate relationship

Page 51: Training Ms Access 2007

Table Relationships

Copyright Crespo Technology Services Group, Inc.51

Create the table relationships for the books circulation class exercise

Enforce referential integrity as required

Page 52: Training Ms Access 2007

Save a Database in a Previous Version

Copyright Crespo Technology Services Group, Inc.52

In the Office Button menu select Save As

There are several database format available :Access 2007Access 2002-2003Access 2000

Page 53: Training Ms Access 2007

Managing Data in a Table

Copyright Crespo Technology Services Group, Inc.53

Page 54: Training Ms Access 2007

Modifying Data

Copyright Crespo Technology Services Group, Inc.54

Users can:Search for recordsReplace Data in recordsAdd recordsDelete RecordsModify Records

Page 55: Training Ms Access 2007

Find Command

Copyright Crespo Technology Services Group, Inc.55

Helps locate specific data.Has various find options

Page 56: Training Ms Access 2007

Replace Command

Copyright Crespo Technology Services Group, Inc.56

Helps replace specific data with new data

Has various replace options

Page 57: Training Ms Access 2007

Totals Features

Copyright Crespo Technology Services Group, Inc.57

Provides simple math functions to the tables

Page 58: Training Ms Access 2007

Sorting Records

Copyright Crespo Technology Services Group, Inc.58

Can sort dataAscending Descending

The order is based on Numeric

informationAlphanumeric

information

Page 59: Training Ms Access 2007

Subdatasheets

Copyright Crespo Technology Services Group, Inc.59

Datasheet nested within another datasheet

Contains data related to the first datasheet

Subdatasheet presence is indicated by + sign on the row

Page 60: Training Ms Access 2007

Copyright Crespo Technology Services Group, Inc.60

Page 61: Training Ms Access 2007

Managing Data

Copyright Crespo Technology Services Group, Inc.61

Class ExerciseFill the created tables with at least 10

records eachDelete at least 1 record from each tableModify at least 1 record from each table

Page 62: Training Ms Access 2007

Queriyng a Database

Copyright Crespo Technology Services Group, Inc.62

Page 63: Training Ms Access 2007

Querying a Database

Copyright Crespo Technology Services Group, Inc.63

Looking for data in a database is difficult unless there is mechanism for extracting and isolating is

A database is effective when data can be retrieved as easily as it was entered

Queries greatly reduce the data retrieval time

Page 64: Training Ms Access 2007

Filter Feature

Copyright Crespo Technology Services Group, Inc.64

Display only the records that match your criteria

Filter data based on the values in a column

Filter by:Text for the text data

typeNumber filters for the

number data typeDate filters for the date

data typeMultiple filters can be

applied to a table at the same time.

Page 65: Training Ms Access 2007

Query Wizard

Copyright Crespo Technology Services Group, Inc.65

Select Query WizardSelect type of querySelect query fieldsRequest query detailAdd title. Click FinishQuery result shown

Page 66: Training Ms Access 2007

Query Types

Copyright Crespo Technology Services Group, Inc.66

Simple: Can select fields from multiple tables and queries

Crosstab: Can perform simple calculationsFind duplicates: Can find duplicate field

valuesFind unmatched: Finds records in a table

with no related records on another table

Page 67: Training Ms Access 2007

Query Design Context Tab

Copyright Crespo Technology Services Group, Inc.67

Query DesignResultsQuery TypeQuery

SetupShow/Hide

Page 68: Training Ms Access 2007

Query Object Views

Copyright Crespo Technology Services Group, Inc.68

Design ViewSQL ViewDatasheet ViewPivotTable ViewPivotChart View

Page 69: Training Ms Access 2007

Show Tables Dialog Box

Copyright Crespo Technology Services Group, Inc.69

The Show Tables dialog box is found on the Query Design Context Tab

The user can select to view:TablesQueriesBoth

Page 70: Training Ms Access 2007

Create a Query

Copyright Crespo Technology Services Group, Inc.70

Class ExerciseCreate a query of studentsCreate a query of books

Page 71: Training Ms Access 2007

Query Criteria

Copyright Crespo Technology Services Group, Inc.71

Search condition to retrieve specific informationThese are used to compare criteria value with

values in the columnCalculations can also be performed

Page 72: Training Ms Access 2007

Comparison Operators

Copyright Crespo Technology Services Group, Inc.72

Symbols used to compare two valuesWhen set in criterion establishes results

after comparisonThe result is always a true or false

Page 73: Training Ms Access 2007

List of Comparison Operators

Copyright Crespo Technology Services Group, Inc.73

= : Equals< : Less than<= : Less than or equal to> : Greater than>= : Greater than or equal to<> : Not equal toBetween And : Within a rangeIs Null : Null values

Page 74: Training Ms Access 2007

Conditional Operators

Copyright Crespo Technology Services Group, Inc.74

Test for the truth of a comparisonThe result is always a true or falseParenthesis can be used to change the

order of evaluation

Page 75: Training Ms Access 2007

List of Conditional Operators

Copyright Crespo Technology Services Group, Inc.75

AND : True if both conditions are trueExample: >2 AND <>10

OR : True if either condition is trueExample: <10 OR >100

NOT : True if the single instance is not trueExample: Not Between 2 and 10

Page 76: Training Ms Access 2007

Create a Query

Copyright Crespo Technology Services Group, Inc.76

Class ExerciseCreate a query of students that have books

outCreate a query of books that are past due to

be returned

Page 77: Training Ms Access 2007

Calculated Fields

Copyright Crespo Technology Services Group, Inc.77

Values come from calculations with other fieldsAre not entered by the user but are created when query

runsThe values may change if the expression is changed

Page 78: Training Ms Access 2007

Arithmetic Operators

Copyright Crespo Technology Services Group, Inc.78

Arithmetic Operator

Description Example

+ Addition value1 + value 2

- Subtraction value1 - value 2

* Multiplication value1 * value 2

/ Division value1 / value 2

Page 79: Training Ms Access 2007

Expressions

Copyright Crespo Technology Services Group, Inc.79

Values come from calculations with other fieldsAre not entered by the user but are created when query

runsThe values may change if the expression is changed

Page 80: Training Ms Access 2007

Expression Builder

Copyright Crespo Technology Services Group, Inc.80

Allows users to select objects and use operators and functions to build formulas

These can be used in queries or reports

Page 81: Training Ms Access 2007

Property Sheet Pane

Copyright Crespo Technology Services Group, Inc.81

Allows users to set properties to objectsThese properties can be of Structure, appearance and

behaviorFeatures include Description, Format, Decimal Places,

Input Mask, Caption and Mart Tags

Page 82: Training Ms Access 2007

Group by Functions

Copyright Crespo Technology Services Group, Inc.82

Perform calculations on a group of valuesCan be used with any number of values and result in a single

valueAggregate functions are used to group records in all databases

Page 83: Training Ms Access 2007

Designing Forms

Copyright Crespo Technology Services Group, Inc.83

Page 84: Training Ms Access 2007

Designing Forms

Copyright Crespo Technology Services Group, Inc.84

Datasheet viewCan be difficult to view large amounts dataSearching can be time consumingCan lead to errors by misreading a value

Access formsAllows to view and edit one record at a timeIs easier to view

Page 85: Training Ms Access 2007

Form Views

Copyright Crespo Technology Services Group, Inc.85

View DescriptionDesign A static view that helps design a form.Form A dynamic view data within the developed

formLayout An interactive and dynamic view that you

can use to create a form

Page 86: Training Ms Access 2007

Form Sections

Copyright Crespo Technology Services Group, Inc.86

Perform calculations on a group of valuesCan be used with any number of values and result in a single

valueAggregate functions are used to group records in all databases

Page 87: Training Ms Access 2007

Group by Functions

Copyright Crespo Technology Services Group, Inc.87

Header: Displays TitleDetail: Displays fieldsFooter: Displays additional information

Page 88: Training Ms Access 2007

Form Creation Tools

Copyright Crespo Technology Services Group, Inc.88

Form Creation Tool

Description

Form Creates a form with all fields in a tableForm Design Helps you create a form in Design viewSplit Form Lets you view the form in Form view and

Datasheet view simultaneouslyMultiple Items Lets you view multiple records from the table

in the form of a spreadsheetPivotChart Helps you create a form in PivotChart viewBlank Form Use a blank form to build a form from

scratchForm Wizard A tool that helps you through the process of

creating a form

Page 89: Training Ms Access 2007

Modifying the Design of a Form

Copyright Crespo Technology Services Group, Inc.89

Can be dome by modifying the TAB orderAdd, delete or modify controls

Bound: Associated to a field in the table or query

Unbound: Not associated with dataCalculated: Displays data obtained by

evaluating an expression

Page 90: Training Ms Access 2007

Generating Reports

Copyright Crespo Technology Services Group, Inc.90

Page 91: Training Ms Access 2007

Report Views

Copyright Crespo Technology Services Group, Inc.91

View DescriptionDesign Ability to add, modify or delete controls.

Cannot view data.Report View data without ability to make changes

to controlsLayout View data and ability to make changes to

controlsPrint Preview Check how the report will print

Page 92: Training Ms Access 2007

Report Sections

Copyright Crespo Technology Services Group, Inc.92

Header: Displays TitleDetail: Displays fieldsFooter: Displays additional information

Page 93: Training Ms Access 2007

Report Creation Tool

Copyright Crespo Technology Services Group, Inc.93

View DescriptionReport Creates a report with all the fields

Blank Report Create a blank report from scratchReport Design Helps you create a report in Design viewReport Wizard Helps create a report by following step-by-

step instructions

Page 94: Training Ms Access 2007

Report Creation Wizard

Copyright Crespo Technology Services Group, Inc.94

Page 95: Training Ms Access 2007

Report Printing

Copyright Crespo Technology Services Group, Inc.95