Upload
crespoje
View
19.618
Download
2
Embed Size (px)
Citation preview
Instructor:Eng. Juan E. Crespo
Introduction toMS Access 2007
1 Copyright Crespo Technology Services Group, Inc.
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.
Exploring the Microsoft® Office Access™ 2007 Environment
Copyright Crespo Technology Services Group, Inc.3
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.
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.
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.
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.
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.
Explore the User Interface
9 Copyright Crespo Technology Services Group, Inc.
Explore the User Interface
10 Copyright Crespo Technology Services Group, Inc.
Explore the Ribbon
Home TabViewsClipboardFontRich TextRecordsSort &
FilterFind
11 Copyright Crespo Technology Services Group, Inc.
Explore the Ribbon
Create TabTablesFormsReportsOther
12 Copyright Crespo Technology Services Group, Inc.
Explore the Ribbon
External Data TabImportExportCollect
DataSharePoi
nt List
13 Copyright Crespo Technology Services Group, Inc.
Explore the Ribbon
Database Tools TabMacroShow/HideAnalyzeMove DataDatabase
Tools
14 Copyright Crespo Technology Services Group, Inc.
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.
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.
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.
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.
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.
Customize the Access Environment
Can be found on the MS Office button
20 Copyright Crespo Technology Services Group, Inc.
Customize the Access Environment Various options to
customize the MS Access environmentDatabase objectsSecurityQuick Access toolbar
21 Copyright Crespo Technology Services Group, Inc.
Obtain Help
Access HelpComplete manual
on featuresQuick and easy
access to answers
22 Copyright Crespo Technology Services Group, Inc.
Design a Database
Copyright Crespo Technology Services Group, Inc.23
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.
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.
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
Determine Fields
Copyright Crespo Technology Services Group, Inc.27
The required fields depend on the information required by the userReportsSummary information
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
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.
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.
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
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)
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
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
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
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.
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
Building a Database
Copyright Crespo Technology Services Group, Inc.38
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
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
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
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
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
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
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
Table Maintenance
Copyright Crespo Technology Services Group, Inc.46
Tables can be:DeletedRenamedExportedAdd a description in the Table Properties
Dialog
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
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
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
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
Table Relationships
Copyright Crespo Technology Services Group, Inc.51
Create the table relationships for the books circulation class exercise
Enforce referential integrity as required
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
Managing Data in a Table
Copyright Crespo Technology Services Group, Inc.53
Modifying Data
Copyright Crespo Technology Services Group, Inc.54
Users can:Search for recordsReplace Data in recordsAdd recordsDelete RecordsModify Records
Find Command
Copyright Crespo Technology Services Group, Inc.55
Helps locate specific data.Has various find options
Replace Command
Copyright Crespo Technology Services Group, Inc.56
Helps replace specific data with new data
Has various replace options
Totals Features
Copyright Crespo Technology Services Group, Inc.57
Provides simple math functions to the tables
Sorting Records
Copyright Crespo Technology Services Group, Inc.58
Can sort dataAscending Descending
The order is based on Numeric
informationAlphanumeric
information
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
Copyright Crespo Technology Services Group, Inc.60
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
Queriyng a Database
Copyright Crespo Technology Services Group, Inc.62
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
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.
Query Wizard
Copyright Crespo Technology Services Group, Inc.65
Select Query WizardSelect type of querySelect query fieldsRequest query detailAdd title. Click FinishQuery result shown
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
Query Design Context Tab
Copyright Crespo Technology Services Group, Inc.67
Query DesignResultsQuery TypeQuery
SetupShow/Hide
Query Object Views
Copyright Crespo Technology Services Group, Inc.68
Design ViewSQL ViewDatasheet ViewPivotTable ViewPivotChart View
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
Create a Query
Copyright Crespo Technology Services Group, Inc.70
Class ExerciseCreate a query of studentsCreate a query of books
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
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
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
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
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
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
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
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
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
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
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
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
Designing Forms
Copyright Crespo Technology Services Group, Inc.83
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
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
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
Group by Functions
Copyright Crespo Technology Services Group, Inc.87
Header: Displays TitleDetail: Displays fieldsFooter: Displays additional information
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
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
Generating Reports
Copyright Crespo Technology Services Group, Inc.90
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
Report Sections
Copyright Crespo Technology Services Group, Inc.92
Header: Displays TitleDetail: Displays fieldsFooter: Displays additional information
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
Report Creation Wizard
Copyright Crespo Technology Services Group, Inc.94
Report Printing
Copyright Crespo Technology Services Group, Inc.95