You are on page 1of 51

Introduction to Microsoft Access

Introduction to Microsoft Access


Databases are THE REASON why organizations have used computers Many uses:
Corporate & organizational data
Sales Inventory Employee records ...

Personal databases
Appointments Addresses To-dos

PC & Mac: Quicken Palm: a collection of databases

World Wide Web

Increasing fraction of Web pages driven by databases Allows pages customized for the user

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports Modules, Programming, and the Web (no content)

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports Modules, Programming, and the Web (no content) Basics of Macros Security features in Access

Intro to Microsoft Access


Goals of Class:

Learn how to use Access Develop understanding of database systems i.e., Word, Excel, PowerPoint, FrontPage Prior experience with Access not needed

Assumes you know something in Microsoft Office:

Introduction to Database Systems: A Very Brief History


First attempt:

Put paper records in computer-based files One record in a paper form One row (record) in computerized table of data

Worked OK for single application, e.g.


Write payroll checks Maintain checking account balances

But . . .

Additional applications for data appeared


Inflexible- difficult to expand

Many redundant data entries needed for this system Overwhelming complexity

Continuing problem- identifying and eliminating incorrect entries Wasted storage space Large effort to maintain this system

Problems with file systems- redundant entries


Dept.
Geology

Course No.
1003

Course
Geol. for Jocks

Term
Fall 2002

Section
001

Teacher
Joseph Sagacious

Student
Robinson, Ed

Grade
B-

Geology

1003

Geol. for Jocks

Fall 2002

001

Joseph Sagacious

Langer, Yvonne

Geology
Math Math Math Math Math Math History History History

1003
0503 0503 0503 0503 0603 0603 1113 1113 1113

Geol. for Jocks


Algebra II Algebra II Algebra II Algebra II Trigonometry Trigonometry History I History I History I

Fall 2002
Fall 2002 Fall 2002 Fall 2002 Spring 2003 Spring 2003 Spring 2003 Spring 2003 Spring 2003 Spring 2003

001
001 001 002 001 001 001 001 001 001

Joseph Sagacious
Bernadette Whist Bernadette Whist Edward Wilson Bernadette Whist Edward Wilson Edward Wilson Ronald Regan Ronald Regan Ronald Regan

Briggs, Jim Bob


Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob

CF CA

Problems with File Systems


Different views of data needed
Class rosters Input grades

Teacher View data for each class taught

Student- Personal data only Administrator- needs multiple views May need other views (e.g., counselors) Teachers can add grades

Different privileges for data access and modification


but only in classes he/she teaches, and only for current term Cant enroll students, add courses

Students cant change anything Administrative personnel can add courses, class sections, or teachers

Problems with file systems


Dept.
Geology

Course No.
1003

Course
Geol. for Jocks Geol. for Jocks Geol. for Jocks Algebra II Algebra II Algebra II Algebra II Trigonometry Trigonometry History I History I History I

Term
Fall 2002

Section
001

Teacher
Joseph Sagacious

Student
Robinson, Ed

Grade
B-

Geology

1003

Fall 2002

001

Joseph Sagacious

Langer, Yvonne

Geology
Math Math Math Math Math Math History History History

1003
0503 0503 0503 0503 0603 0603 1113 1113 1113

Fall 2002
Fall 2002 Fall 2002 Fall 2002 Spring 2003 Spring 2003 Spring 2003 Spring 2003 Spring 2003 Spring 2003

001
001 001 002 001 001 001 001 001 001

Joseph Sagacious
Bernadette Whist Bernadette Whist Edward Wilson Bernadette Whist Edward Wilson Edward Wilson Ronald Regan Ronald Regan Ronald Regan

Briggs, Jim Bob


Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob

CF CA

Problems with File Systems


Different views of data needed

Teacher View data for each class taught Student- Personal data only
Course schedule Final grades

Administrator- needs multiple views May need other views (e.g., counselors) Teachers can add grades Students cant change anything
Can only view his/her data

Different privileges for data access and modification

Administrative personnel can add courses, class sections, or teachers

Problems with file systems


Dept.
Geology Geology Geology Math Math Math Math Math Math History History History

Course No.
1003 1003 1003 0503 0503 0503 0503 0603 0603 1113 1113 1113

Course
Geol. for Jocks Geol. for Jocks Geol. for Jocks Algebra II Algebra II Algebra II Algebra II Trigonometry Trigonometry History I History I History I

Term
Fall 2002 Fall 2002 Fall 2002 Fall 2002 Fall 2002 Fall 2002 Spring 2003 Spring 2003 Spring 2003 Spring 2003 Spring 2003 Spring 2003

Section
001 001 001 001 001 002 001 001 001 001 001 001

Teacher
Joseph Sagacious Joseph Sagacious Joseph Sagacious Bernadette Whist Bernadette Whist Edward Wilson Bernadette Whist Edward Wilson Edward Wilson Ronald Regan Ronald Regan Ronald Regan

Student
Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob Robinson, Ed Langer, Yvonne Briggs, Jim Bob

Grade
BA CF CA

Problems with File Systems


Different views of data needed
Teacher View data for each class taught Student- Personal data only Administrator- needs multiple views
At start of semester:
ensure teacher for every class sufficient student enrollment in class

At end of semester, ensure teachers have submitted grades

May need other views (e.g., counselors)


Teachers can add grades Students cant change anything Administrative personnel can add courses, class sections, or teachers
But they cant change grades

Different privileges for data access and modification


Database systems
(After twenty years and several intermediate stages of development )

Separate into two functions: Database management system(DBMS)


Keeps data in small, unique chunks
Efficient storage Maintains just enough redundancy The relational database Handles physical details of storing data efficiently Delivers & manipulates data for applications Limits data access based on users privileges in system Oracle 9i IBM DB2 Microsoft SQL Server

Principle focus: handling data


Several industrial-strength DBMS:


Application programs
Get data from DBMS Standardized language to get data (SQL)

The Relational Database


Dept Course No. Course Term Section Teacher Student Grade Courses Dept. Geol. Math Math History Course No. 1003 0503 0603 1113 Course Geol. for Jocks Algebra II Trigonometry History I CourseID 111 222 223 444

The Relational Database


Dept Course No. Course Term Section Teacher Student Grade

Courses
Dept. Geol. Math Math History Course No. 1003 0503 0603 1113 Course Geol. for Jocks Algebra II Trigonometry History I CourseID 111 222 223 444 StudentFirst Ed Yvonne Jim Bob

Students
StudentLast Robinson Langer Briggs Teachers TeacherFirst Joseph Bernadette Edward Ronald TeacherLast Sagacious Whist Wilson Regan Teacher No. 111-22-2458 222-11-4500 333-11-0123 444-22-3210 Student No. 555-11-5432 666-11-6543 777-22-8765

The Relational Database


Dept Course No. Course Courses Dept. Geol. Math Math History Course No. 1003 0503 0603 1113 Course Geol. for Jocks Algebra II Trigonometry History I CourseID 111 222 223 444 StudentFirst Ed Yvonne Jim Bob Students StudentLast Robinson Langer Briggs Student No. 555-11-5432 666-11-6543 777-22-8765 Term Section Teacher Student Grade

Teachers
Course Sections CourseID 111 222 SectionID 111-2002-1-001 222-2002-1-001 Term Fall 2002 Fall 2002 Section 001 001 Teacher No. 111-22-2458 222-11-4500 TeacherFirst Joseph Bernadette Edward Ronald TeacherLast Sagacious Whist Wilson Regan Teacher No. 111-22-2458 222-11-4500 333-11-0123 444-22-3210

222
222 223 444

222-2002-1-002
222-2002-2-001 223-2002-2-001 444-2002-2-001

Fall 2002
Spring 2003 Spring 2003 Spring 2003

002
001 001 001

333-11-0123
222-11-4500 333-11-0123 444-22-3210

The Relational Database


Dept Course No. Courses Dept. Geol. Math Math History Course No. 1003 0503 0603 1113 Course Geol. for Jocks Algebra II Trigonometry History I CourseID 111 222 223 444 SectionID StudentFirst Ed Yvonne Jim Bob Course Term Section Teacher Students StudentLast Robinson Langer Briggs Student No. 555-11-5432 666-11-6543 777-22-8765 Grades Student No. Grade Teachers ( Not shown ) Student Grade

111-2002-1-001
Course Sections CourseID 111 222 222 222 223 444 SectionID 111-2002-1-001 222-2002-1-001 222-2002-1-002 222-2002-2-001 223-2002-2-001 444-2002-2-001 Term Fall 2002 Fall 2002 Fall 2002 Spring 2003 Spring 2003 Spring 2003 Section 001 001 002 001 001 001 Teacher No. 111-22-2458 222-11-4500 333-11-0123 222-11-4500 333-11-0123 444-22-3210 222-2002-1-002 223-2002-2-001 444-2002-2-001 111-2002-1-001 222-2002-1-001 223-2002-2-001 444-2002-2-001 111-2002-1-001 222-2002-1-001 222-2002-2-001 444-2002-2-001

777-22-8765
777-22-8765 777-22-8765 777-22-8765 666-11-6543 666-11-6543 666-11-6543 666-11-6543 555-11-5432 555-11-5432 555-11-5432 555-11-5432

CA

A C-

BF

Microsoft Access is Unique


Provides DBMS functions
Not industrial-strength, designed for:
Individuals Small workgroups Can use SQL to get or manipulate data in Access database

External application programs work with Access

Provides built-in tools for reporting and for application development


Forms Reports Visual Basic code modules
Small, simple all-in-one environment Data can be easily transferred to full-fledged DBMS
i.e., if database, # of users gets too large No need to decide on database size before you start Allows natural growth

Provides flexibility

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and Reports Modules, Programming, and the Web (no content) Basics of Macros Security features in Access

Introduction to Access
Sample databases
School
Used with this presentation See Tutorials & Resources on our web site

Northwind
Included with every version of Access since 2.0

(Demonstration of Access environment)

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports Modules, Programming, and the Web Macros Security features in Access

Design of an Access database


First step: Eliminate the computer
Capture required features of school, business, or organization in model Pencil & paper work; no computer needed Translate to computer later

Identify the entity types Add attributes (if desired) Identify relationships between entities

Design of an Access database


First step: Eliminate the computer Identify the entity types
Will become names for tables of data Entity types should be real things
Can be physically real (e.g., Employees) Can be abstract (e.g., Courses) Examples: Students Teachers Courses Class Sections Teachers- could be an entity type for a school Crossing guards- not an entity type

Should be central to the work process of the school, business, or organization


Add attributes (if desired) Identify relationships between entities

Identifying Entities
Students

Course

Class_Sections

Teacher

Grades

Design of an Access database


First step: Eliminate the computer Identify the entity types Add attributes (if desired)
Will be column headings in our table Attributes are characteristics that go with entity Example- A Students entity type would have these attributes:
First Name Last Name Street Address City Soc. Sec. No.

Identify relationships between entities

Adding Attributes
StudentNo StudentFirstName

Students

Address

City StudentLastName State

Email

CellPhone

WorkPhone

HomePhone

Always 1:1 with entity Adding attributes: a mixed bag


Upside: You know where things go Downside: Clutters up entity relationships

Design of an Access database


First step: Eliminate the computer Identify the entity types Add attributes (if desired) Identify relationships between entity types
How many: How many
1: 1 1: Many
[ Many = more than one ]

Many: Many Remember: numbers refer to relationship, not to population of entity type Optional
(e.g., ClassSection may be optional to Course- a course may not be taught every semester) (e.g., Teacher mandatory for ClassSection)

Is entity required in relationship?

Mandatory

Identifying Relationships
1

Students
Many Many

have

Emergency Contact Info

advised by

obtain Grades in

Grades

1 1

Many

Course

has

Teacher
1

Class_Sections

teaches

has

Employee_Information

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports Modules, Programming, and the Web Macros Security features in Access

Converting Design into Tables and Queries


Entities database tables
Table Design View: establish or modify table structure
Attributes fields in table Make primary key Data types and other table details

Table Wizard- not that useful Datasheet View: view or enter data

Add relationships between tables Make queries

Converting Design into Tables and Queries


(Demonstration- making tables and entering data)

School1.mdb

????????

Converting Design into Tables and Queries


Entities database tables Add relationships between tables
Menu command: Tools / Relationships Match primary key in one table with matching value in another table (foreign key) Enforce referential integrity- keeps your data good! Access uses to mean Many

Make queries

Converting Design into Tables and Queries


(Demonstration on drawing relationships)

School2.mdb ????????

Rules of Thumb: Creating Tables


Many:Many relationships
Require a bridging table Converts Many:Many two 1:Many Bridging table is the Many side of the new relationships Example: Grades table Typically, add a foreign key from 1 side in Many table Example: Advisor field in Students table
Table on end may be unnecessary Fields may belong in other table Exceptions:
When main table is big Certain fields arent used often

1:Many relationships

Tables dangling on end of 1:1 relationship


Example: Emergency Contact Info Entity

Rules of Thumb: Creating Tables


Primary key determination
Each value MUST be unique Key determines all other fields in table- they all depend on value of primary key Otherwise: a problem with design
Add extra (otherwise meaningless) field with Autonumber data type as primary key
Any use of this data in another table should be of data type Number, Format = Long Integer (If you choose Autonumber type again, Access wont let you choose the number!)

When only a combination of fields is unique:

Example: Grades table

Rules of Thumb: Creating Tables


Data types
Choose Number only if you want to do math on it Date/Time, Currency: specialized number types Memo type has no limits on length
Good for catch-all Notes field (misc. data that doesnt have a slot)

Lookup Wizard- good for looking up real names for meaningless ID numbers When in doubt, use Text Default values assigned by Access usually OK
Unless youre likely to run out of storage space
Before data added Before relationships between tables made

Field Size:

If you want to change from default, do it early!


Rules of Thumb: Creating Tables


Format:
Extra level of formatting for Date/Time, Number, Currency
Formatting for viewing, inputting Soc. Sec. No., Phone no., etc. Wizard for masking common types Human-friendly name for field when used elsewhere in Access What filled in automatically if no entry in field

Input Mask:

Caption:

Default value:

Rules of Thumb: Creating Tables


Validation Rule:
Mathematical expression- sets limits on data in field Example: Course_sections table, Year field Text you want displayed when a Validation Rule is violated Example: Course_sections table, Year field

Validation Text:

Converting Design into Tables and Queries


Entities database tables Add relationships between tables Make queries
Query assembles data we want
Just enough redundancy makes this work Query Wizard- Let Access guide you Query Design View- Make your query manually Datasheet view- View, update, add, or delete data
Looks like data in a table Any data changes result in changes in underlying tables Filter data By form By selection

Making a query in Access


SQL view (Youve been writing programming code!)

Converting Design into Tables and Queries


(Demonstration on making queries)

School3.mdb ???????????

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports Modules, Programming, and the Web Macros Security features in Access

Forms and Reports


Make it easier to view, modify, add, and delete data
Forms optimized for on-screen use Reports- optimized for printout Each based on a table or on a query

Creating Forms Creating Reports

Forms and Reports


Make it easier to view, modify, add, and delete data Creating Forms
Form Wizard Form Design View
Controls in Toolbox allow customization Wizards for many of them, e.g. Button Use the View / Properties command to modify form or control properties

Datasheet View
Useful in sub-forms

Creating Reports

Forms and Reports


(Demonstration of forms)

School4.mdb ???????????

Forms and Reports


Make it easier to view, modify, add, and delete data Creating Forms Creating Reports
Wizard- makes it easy Design View
Very similar to Form Design View Differences- more headers and footers
Report level Page level Data grouping level Can be modified with Sorting and Grouping command on View menu

Page Preview
Similar to Page Preview in other Office applications

Forms and Reports


(Demonstration of reports)

School5.mdb ???????????

Introduction to Microsoft Access


Introduction to database management systems How to use Microsoft Access
Introduction to Access Design of an Access database Converting design into tables and queries Forms and reports Modules, Programming, and the Web Macros Security features in Access

Modules, Programming, and the Web


Modules: Allows automation beyond the simple level of Macros
Advantages:
Broader range of choices Execute faster Deeper level of integration with other programs Allows more user choice in response Visual Basic: the simplest programming environment More complexity Overkill for many simple tasks

Disadvantages

Data Access Pages

Modules, Programming, and the Web


Modules: Allows automation beyond the simple level of Macros Data Access Pages
Added to Access when WWW arrived In essence, a form/report designed for browser Methods to connect to an Access database
The standard method (ODBC) Data Access Pages

Advantage: you dont leave Access to use Data Access Pages Disadvantage: limited functionality

You might also like