introduction to microsoft access mark mcdonald and jason dewitt visual information systems center...

54
Introduction to Introduction to Microsoft Access Microsoft Access Mark McDonald and Jason Mark McDonald and Jason Dewitt Dewitt Visual Information Systems Visual Information Systems Center School of Information Center School of Information Sciences Sciences University of Pittsburgh University of Pittsburgh March 14, 2003 March 14, 2003

Upload: erik-garrett

Post on 26-Dec-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to Microsoft Introduction to Microsoft AccessAccess

Mark McDonald and Jason DewittMark McDonald and Jason Dewitt

Visual Information Systems Center Visual Information Systems Center School of Information SciencesSchool of Information Sciences

University of PittsburghUniversity of PittsburghMarch 14, 2003March 14, 2003

Page 2: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Databases are THE REASON why organizations have Databases are THE REASON why organizations have used computersused computers

Many uses:Many uses: Corporate & organizational dataCorporate & organizational data

SalesSales InventoryInventory Employee recordsEmployee records . . .. . .

Personal databasesPersonal databases PC & Mac: QuickenPC & Mac: Quicken Palm: a collection of databasesPalm: a collection of databases

AppointmentsAppointments AddressesAddresses To-do’sTo-do’s

World Wide WebWorld Wide Web Increasing fraction of Web pages driven by databasesIncreasing fraction of Web pages driven by databases Allows pages customized for the userAllows pages customized for the user

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 3: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database systemsIntroduction to database systems What is a database?What is a database? Why are databases set up this way?Why are databases set up this way?

How to use Microsoft AccessHow to use Microsoft Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 4: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 5: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 6: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 7: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 8: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports Modules, Programming, and the Web (no Modules, Programming, and the Web (no

content)content)

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 9: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports Modules, Programming, and the Web (no content)Modules, Programming, and the Web (no content) Basics of MacrosBasics of Macros Security features in AccessSecurity features in Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 10: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Intro to Microsoft AccessIntro to Microsoft Access

Goals of Class:Goals of Class: Learn how to use AccessLearn how to use Access Develop understanding of database systemsDevelop understanding of database systems

Assumes you know something in Microsoft Assumes you know something in Microsoft Office:Office: i.e.i.e., Word, Excel, PowerPoint, FrontPage , Word, Excel, PowerPoint, FrontPage Prior experience with Access not neededPrior experience with Access not needed

Page 11: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

First attempt:First attempt: Put paper records in computer-based filesPut paper records in computer-based files One record in a paper form One record in a paper form One row (“record”) in One row (“record”) in

computerized table of datacomputerized table of data Worked OK for single application, Worked OK for single application, e.g.e.g.

Write payroll checksWrite payroll checks Maintain checking account balancesMaintain checking account balances

But . . . But . . . Additional applications for data appearedAdditional applications for data appeared

Inflexible- difficult to expandInflexible- difficult to expand Many redundant data entries needed for this systemMany redundant data entries needed for this system

Continuing problem- identifying and eliminating incorrect entriesContinuing problem- identifying and eliminating incorrect entries Wasted storage spaceWasted storage space

Overwhelming complexityOverwhelming complexity Large effort to maintain this systemLarge effort to maintain this system

Introduction to Database Systems: Introduction to Database Systems: A Very Brief HistoryA Very Brief History

Page 12: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Problems with file systems- redundant Problems with file systems- redundant entriesentries

Dept. Course No. Course Term Section Teacher Student Grade

Geology 1003 Geol. for Jocks Fall 2002 001 Joseph Sagacious Robinson, Ed B-

Geology 1003 Geol. for Jocks Fall 2002 001 Joseph Sagacious Langer, Yvonne A

Geology 1003 Geol. for Jocks Fall 2002 001 Joseph Sagacious Briggs, Jim Bob C-

Math 0503 Algebra II Fall 2002 001 Bernadette Whist Robinson, Ed F

Math 0503 Algebra II Fall 2002 001 Bernadette Whist Langer, Yvonne C-

Math 0503 Algebra II Fall 2002 002 Edward Wilson Briggs, Jim Bob A

Math 0503 Algebra II Spring 2003 001 Bernadette Whist Robinson, Ed  

Math 0603 Trigonometry Spring 2003 001 Edward Wilson Langer, Yvonne  

Math 0603 Trigonometry Spring 2003 001 Edward Wilson Briggs, Jim Bob  

History 1113 History I Spring 2003 001 Ronald Regan Robinson, Ed  

History 1113 History I Spring 2003 001 Ronald Regan Langer, Yvonne  

History 1113 History I Spring 2003 001 Ronald Regan Briggs, Jim Bob  

Page 13: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Problems with File SystemsProblems with File Systems Different views of data neededDifferent views of data needed

Teacher – View data for each class taughtTeacher – View data for each class taught Class rostersClass rosters Input gradesInput grades

Student- Personal data onlyStudent- Personal data only Administrator- needs multiple viewsAdministrator- needs multiple views May need other views (May need other views (e.g.e.g., counselors), counselors)

Different privileges for data access and modificationDifferent privileges for data access and modification Teachers can add gradesTeachers can add grades

… … but only in classes he/she teaches, and only for current termbut only in classes he/she teaches, and only for current term Can’t enroll students, add coursesCan’t enroll students, add courses

Students can’t change anythingStudents can’t change anything Administrative personnel can add courses, class sections, or Administrative personnel can add courses, class sections, or

teachersteachers

Page 14: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Problems with file Problems with file systemssystems

Dept. Course No. Course Term Section Teacher Student Grade

Geology 1003Geol. for Jocks

Fall 2002 001 Joseph Sagacious Robinson, Ed B-

Geology 1003Geol. for Jocks

Fall 2002 001 Joseph Sagacious Langer, Yvonne A

Geology 1003Geol. for Jocks

Fall 2002 001 Joseph Sagacious Briggs, Jim Bob C-

Math 0503 Algebra II Fall 2002 001 Bernadette Whist Robinson, Ed F

Math 0503 Algebra II Fall 2002 001 Bernadette Whist Langer, Yvonne C-

Math 0503 Algebra II Fall 2002 002 Edward Wilson Briggs, Jim Bob A

Math 0503 Algebra II Spring 2003 001 Bernadette Whist Robinson, Ed  

Math 0603 Trigonometry Spring 2003 001 Edward Wilson Langer, Yvonne  

Math 0603 Trigonometry Spring 2003 001 Edward Wilson Briggs, Jim Bob  

History 1113 History I Spring 2003 001 Ronald Regan Robinson, Ed  

History 1113 History I Spring 2003 001 Ronald Regan Langer, Yvonne  

History 1113 History I Spring 2003 001 Ronald Regan Briggs, Jim Bob  

Page 15: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Problems with File SystemsProblems with File Systems Different views of data neededDifferent views of data needed

Teacher – View data for each class taughtTeacher – View data for each class taught Student- Personal data onlyStudent- Personal data only

Course scheduleCourse schedule Final gradesFinal grades

Administrator- needs multiple viewsAdministrator- needs multiple views May need other views (May need other views (e.g.e.g., counselors), counselors)

Different privileges for data access and modificationDifferent privileges for data access and modification Teachers can add gradesTeachers can add grades Students can’t change anythingStudents can’t change anything

Can only view his/her dataCan only view his/her data Administrative personnel can add courses, class sections, or Administrative personnel can add courses, class sections, or

teachersteachers

Page 16: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Problems with file Problems with file systemssystems

Dept. Course No. Course Term Section Teacher Student Grade

Geology 1003 Geol. for Jocks Fall 2002 001 Joseph Sagacious Robinson, Ed B-

Geology 1003 Geol. for Jocks Fall 2002 001 Joseph Sagacious Langer, Yvonne A

Geology 1003 Geol. for Jocks Fall 2002 001 Joseph Sagacious Briggs, Jim Bob C-

Math 0503 Algebra II Fall 2002 001 Bernadette Whist Robinson, Ed F

Math 0503 Algebra II Fall 2002 001 Bernadette Whist Langer, Yvonne C-

Math 0503 Algebra II Fall 2002 002 Edward Wilson Briggs, Jim Bob A

Math 0503 Algebra II Spring 2003 001 Bernadette Whist Robinson, Ed  

Math 0603 Trigonometry Spring 2003 001 Edward Wilson Langer, Yvonne  

Math 0603 Trigonometry Spring 2003 001 Edward Wilson Briggs, Jim Bob  

History 1113 History I Spring 2003 001 Ronald Regan Robinson, Ed  

History 1113 History I Spring 2003 001 Ronald Regan Langer, Yvonne  

History 1113 History I Spring 2003 001 Ronald Regan Briggs, Jim Bob  

Page 17: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Problems with File SystemsProblems with File Systems Different views of data neededDifferent views of data needed

Teacher – View data for each class taughtTeacher – View data for each class taught Student- Personal data onlyStudent- Personal data only Administrator- needs multiple viewsAdministrator- needs multiple views

At start of semester:At start of semester: ensure teacher for every classensure teacher for every class sufficient student enrollment in classsufficient student enrollment in class

At end of semester, ensure teachers have submitted gradesAt end of semester, ensure teachers have submitted grades May need other views (e.g., counselors)May need other views (e.g., counselors)

Different privileges for data access and modificationDifferent privileges for data access and modification Teachers can add gradesTeachers can add grades Students can’t change anythingStudents can’t change anything Administrative personnel can add courses, class sections, or Administrative personnel can add courses, class sections, or

teachersteachers But they can’t change gradesBut they can’t change grades

Page 18: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

(After twenty years and several intermediate stages of (After twenty years and several intermediate stages of development… )development… )

Separate into two functions: Separate into two functions: Database management system(DBMS)Database management system(DBMS)

Keeps data in small, unique chunksKeeps data in small, unique chunks Efficient storageEfficient storage Maintains “just enough” redundancyMaintains “just enough” redundancy The “relational database”The “relational database”

Principle focus: handling dataPrinciple focus: handling data Handles physical details of storing data efficientlyHandles physical details of storing data efficiently Delivers & manipulates data for applicationsDelivers & manipulates data for applications Limits data access based on user’s privileges in systemLimits data access based on user’s privileges in system

Several “industrial-strength” DBMS:Several “industrial-strength” DBMS: Oracle Oracle 9i 9i IBM IBM DB2DB2 Microsoft Microsoft SQL ServerSQL Server

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

Database systemsDatabase systems

Page 19: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

The Relational DatabaseThe Relational Database

Courses

Dept. Course No. Course CourseID

Geol. 1003 Geol. for Jocks 111

Math 0503 Algebra II 222

Math 0603 Trigonometry 223

History 1113 History I 444

Dept Course No. Course Term Section Teacher Student Grade

Page 20: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

The Relational DatabaseThe Relational Database

Students

StudentFirst StudentLast Student No.

Ed Robinson 555-11-5432

Yvonne Langer 666-11-6543

Jim Bob Briggs 777-22-8765

Courses

Dept. Course No. Course CourseID

Geol. 1003 Geol. for Jocks 111

Math 0503 Algebra II 222

Math 0603 Trigonometry 223

History 1113 History I 444

Dept Course No. Course Term Section Teacher Student Grade

Teachers

TeacherFirst TeacherLast Teacher No.

Joseph Sagacious 111-22-2458

Bernadette Whist 222-11-4500

Edward Wilson 333-11-0123

Ronald Regan 444-22-3210

Page 21: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

The Relational DatabaseThe Relational Database

Courses

Dept. Course No. Course CourseID

Geol. 1003 Geol. for Jocks 111

Math 0503 Algebra II 222

Math 0603 Trigonometry 223

History 1113 History I 444

Course Sections

CourseID SectionID Term Section Teacher No.

111 111-2002-1-001 Fall 2002 001 111-22-2458

222 222-2002-1-001 Fall 2002 001 222-11-4500

222 222-2002-1-002 Fall 2002 002 333-11-0123

222 222-2002-2-001 Spring 2003 001 222-11-4500

223 223-2002-2-001 Spring 2003 001 333-11-0123

444 444-2002-2-001 Spring 2003 001 444-22-3210

Dept Course No. Course Term Section Teacher Student Grade

Students

StudentFirst StudentLast Student No.

Ed Robinson 555-11-5432

Yvonne Langer 666-11-6543

Jim Bob Briggs 777-22-8765

Teachers

TeacherFirst TeacherLast Teacher No.

Joseph Sagacious 111-22-2458

Bernadette Whist 222-11-4500

Edward Wilson 333-11-0123

Ronald Regan 444-22-3210

Page 22: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

The Relational DatabaseThe Relational Database

Students

StudentFirst StudentLast Student No.

Ed Robinson 555-11-5432

Yvonne Langer 666-11-6543

Jim Bob Briggs 777-22-8765

Grades

SectionID Student No. Grade

111-2002-1-001 777-22-8765 C-

222-2002-1-002 777-22-8765 A

223-2002-2-001 777-22-8765  

444-2002-2-001 777-22-8765  

111-2002-1-001 666-11-6543 A

222-2002-1-001 666-11-6543 C-

223-2002-2-001 666-11-6543  

444-2002-2-001 666-11-6543  

111-2002-1-001 555-11-5432 B-

222-2002-1-001 555-11-5432 F

222-2002-2-001 555-11-5432  

444-2002-2-001 555-11-5432  

Courses

Dept. Course No. Course CourseID

Geol. 1003Geol. for Jocks 111

Math 0503 Algebra II 222

Math 0603 Trigonometry 223

History 1113 History I 444

Dept Course No. Course Term Section Teacher Student Grade

Teachers( Not shown )

Course Sections

CourseID SectionID Term Section Teacher No.

111 111-2002-1-001 Fall 2002 001 111-22-2458

222 222-2002-1-001 Fall 2002 001 222-11-4500

222 222-2002-1-002 Fall 2002 002 333-11-0123

222 222-2002-2-001 Spring 2003 001 222-11-4500

223 223-2002-2-001 Spring 2003 001 333-11-0123

444 444-2002-2-001 Spring 2003 001 444-22-3210

Page 23: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Microsoft Access is UniqueMicrosoft Access is Unique Provides DBMS functionsProvides DBMS functions

Not “industrial-strength”, designed for:Not “industrial-strength”, designed for: Individuals Individuals Small workgroups Small workgroups

External application programs work with AccessExternal application programs work with Access Can use SQL to get or manipulate data in Access databaseCan use SQL to get or manipulate data in Access database

Provides built-in tools for reporting and for application Provides built-in tools for reporting and for application developmentdevelopment FormsForms ReportsReports Visual Basic code modulesVisual Basic code modules

Provides flexibilityProvides flexibility Small, simple all-in-one environmentSmall, simple all-in-one environment Data can be easily transferred to full-fledged DBMSData can be easily transferred to full-fledged DBMS

i.e.i.e., if database, # of users gets too large, if database, # of users gets too large No need to decide on database size before you startNo need to decide on database size before you start Allows natural growthAllows natural growth

Page 24: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and ReportsForms and Reports Modules, Programming, and the Web (no content)Modules, Programming, and the Web (no content) Basics of MacrosBasics of Macros Security features in AccessSecurity features in Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 25: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to AccessIntroduction to Access Sample databasesSample databases

SchoolSchool Used with this presentationUsed with this presentation See “Tutorials & Resources” on our web siteSee “Tutorials & Resources” on our web site

NorthwindNorthwind Included with every version of Access since Included with every version of Access since

2.02.0

(Demonstration of Access (Demonstration of Access environment)environment)

Page 26: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to AccessIntroduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports Modules, Programming, and the WebModules, Programming, and the Web MacrosMacros Security features in AccessSecurity features in Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 27: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Design of an Access Design of an Access databasedatabase

First step: Eliminate the computerFirst step: Eliminate the computer Capture required features of school, business, or Capture required features of school, business, or

organization in modelorganization in model Pencil & paper work; no computer neededPencil & paper work; no computer needed Translate to computer laterTranslate to computer later

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

Page 28: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Design of an Access Design of an Access databasedatabase

First step: Eliminate the computerFirst step: Eliminate the computer Identify the “entity types” Identify the “entity types”

Will become names for tables of dataWill become names for tables of data Entity types should be real thingsEntity types should be real things

Can be physically real (e.g., Employees)Can be physically real (e.g., Employees) Can be abstract (e.g., Courses)Can be abstract (e.g., Courses) Examples:Examples:

StudentsStudents TeachersTeachers CoursesCourses Class SectionsClass Sections

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

Teachers- could be an entity type for a schoolTeachers- could be an entity type for a school Crossing guards- not an entity typeCrossing guards- not an entity type

Add attributes (if desired)Add attributes (if desired) Identify relationships between entitiesIdentify relationships between entities

Page 29: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Identifying EntitiesIdentifying EntitiesStudents

Teacher

Class_Sections

Course

Grades

Page 30: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Design of an Access Design of an Access databasedatabase

First step: Eliminate the computerFirst step: Eliminate the computer Identify the “entity types”Identify the “entity types” Add attributes (if desired) Add attributes (if desired)

Will be column headings in our tableWill be column headings in our table Attributes are characteristics that “go with” entityAttributes are characteristics that “go with” entity Example- A “Students” entity type would have these Example- A “Students” entity type would have these

attributes:attributes: First NameFirst Name Last NameLast Name Street AddressStreet Address CityCity Soc. Sec. No.Soc. Sec. No.

Identify relationships between entitiesIdentify relationships between entities

Page 31: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Adding AttributesAdding Attributes

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

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

Students

StudentNo

Address

City

State

WorkPhoneCellPhone

HomePhone

Email

StudentFirstName

StudentLastName

Page 32: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Design of an Access Design of an Access databasedatabase

First step: Eliminate the computerFirst step: Eliminate the computer Identify the “entity types”Identify the “entity types” Add attributes (if desired)Add attributes (if desired) Identify relationships between entity typesIdentify relationships between entity types

How many: How many How many: How many 1: 11: 1 1: Many 1: Many

[ “Many” = more than one ][ “Many” = more than one ] Many: ManyMany: Many Remember: numbers refer to relationship, not to population of entity typeRemember: numbers refer to relationship, not to population of entity type

Is entity required in relationship? Is entity required in relationship? Optional Optional

((e.g.e.g., “ClassSection” may be optional to “Course”- a course may not be taught , “ClassSection” may be optional to “Course”- a course may not be taught every semester)every semester)

Mandatory Mandatory ((e.g.e.g., “Teacher” mandatory for “ClassSection”), “Teacher” mandatory for “ClassSection”)

Page 33: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Identifying RelationshipsIdentifying RelationshipsStudents

Teacher

Class_Sections

Many

Many

1

haveEmergencyContact Info

11

teaches1

obtainGrades

in

Course has 11

has 1

1

Employee_Information

1

1

advised by

Many

Grades

Page 34: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to Access Introduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports Modules, Programming, and the WebModules, Programming, and the Web MacrosMacros Security features in AccessSecurity features in Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 35: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Converting Design into Tables Converting Design into Tables and Queriesand Queries

Entities Entities database tables database tables Table Design View: establish or modify table Table Design View: establish or modify table

structurestructure Attributes Attributes fields in table fields in table Make primary keyMake primary key Data types and other table detailsData types and other table details

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

Add relationships between tablesAdd relationships between tables Make queriesMake queries

Page 36: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Converting Design into Tables Converting Design into Tables and Queriesand Queries

(Demonstration- making tables and (Demonstration- making tables and entering data)entering data)

School1.mdb

????????

Page 37: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Converting Design into Tables Converting Design into Tables and Queriesand Queries

Entities Entities database tables database tables Add relationships between tablesAdd relationships between tables

Menu command: Tools / RelationshipsMenu command: Tools / Relationships Match primary key in one table with matching Match primary key in one table with matching

value in another table (“foreign key”)value in another table (“foreign key”) Enforce referential integrity- keeps your data Enforce referential integrity- keeps your data

good!good! Access uses “Access uses “” to mean “Many”” to mean “Many”

Make queriesMake queries

Page 38: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Converting Design into Tables Converting Design into Tables and Queriesand Queries

(Demonstration on drawing (Demonstration on drawing relationships)relationships)

School2.mdb????????

Page 39: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Rules of Thumb: Creating Rules of Thumb: Creating TablesTables

Many:Many relationshipsMany:Many relationships Require a “bridging” tableRequire a “bridging” table Converts Many:Many Converts Many:Many two 1:Many two 1:Many Bridging table is the “Many” side of the new relationshipsBridging table is the “Many” side of the new relationships Example: “Grades” tableExample: “Grades” table

1:Many relationships1:Many relationships Typically, add a “foreign key” from “1” side in “Many” tableTypically, add a “foreign key” from “1” side in “Many” table Example: “Advisor” field in “Students” tableExample: “Advisor” field in “Students” table

Tables dangling on end of 1:1 relationshipTables dangling on end of 1:1 relationship Table on end may be unnecessaryTable on end may be unnecessary Fields may belong in other tableFields may belong in other table Exceptions:Exceptions:

When main table is bigWhen main table is big Certain fields aren’t used oftenCertain fields aren’t used often

Example: “Emergency Contact Info” EntityExample: “Emergency Contact Info” Entity

Page 40: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Rules of Thumb: Creating Rules of Thumb: Creating TablesTables

Primary key determinationPrimary key determination Each value MUST be uniqueEach value MUST be unique Key “determines” all other fields in table- they all Key “determines” all other fields in table- they all

depend on value of primary keydepend on value of primary key Otherwise: a problem with designOtherwise: a problem with design

When only a combination of fields is unique:When only a combination of fields is unique: Add extra (otherwise meaningless) field with Add extra (otherwise meaningless) field with

“Autonumber” data type as primary key“Autonumber” data type as primary key Any use of this data in another table should be of data type Any use of this data in another table should be of data type

“Number”, Format = “Long Integer”“Number”, Format = “Long Integer” (If you choose Autonumber type again, Access won’t let you (If you choose Autonumber type again, Access won’t let you

choose the number!)choose the number!) Example: “Grades” tableExample: “Grades” table

Page 41: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Rules of Thumb: Creating Rules of Thumb: Creating TablesTables

Data typesData types Choose “Number” only if you want to do math on itChoose “Number” only if you want to do math on it ““Date/Time”, “Currency”: specialized number typesDate/Time”, “Currency”: specialized number types ““Memo” type has no limits on lengthMemo” type has no limits on length

Good for catch-all “Notes” field (misc. data that doesn’t have a Good for catch-all “Notes” field (misc. data that doesn’t have a “slot”)“slot”)

Lookup Wizard- good for looking up real names for Lookup Wizard- good for looking up real names for meaningless ID numbersmeaningless ID numbers

When in doubt, use “Text”When in doubt, use “Text” Field Size:Field Size:

Default values assigned by Access usually OK Default values assigned by Access usually OK Unless you’re likely to run out of storage spaceUnless you’re likely to run out of storage space

If you want to change from default, do it early!If you want to change from default, do it early! Before data addedBefore data added Before relationships between tables madeBefore relationships between tables made

Page 42: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Rules of Thumb: Creating Rules of Thumb: Creating TablesTables

Format: Format: Extra level of formatting for Date/Time, Number, Extra level of formatting for Date/Time, Number,

CurrencyCurrency Input Mask:Input Mask:

Formatting for viewing, inputting Soc. Sec. No., Phone Formatting for viewing, inputting Soc. Sec. No., Phone no., etc. no., etc.

Wizard for masking common typesWizard for masking common types Caption: Caption:

Human-friendly name for field when used elsewhere in Human-friendly name for field when used elsewhere in AccessAccess

Default value:Default value: What filled in automatically if no entry in fieldWhat filled in automatically if no entry in field

Page 43: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Rules of Thumb: Creating Rules of Thumb: Creating TablesTables

Validation Rule: Validation Rule: Mathematical expression- sets limits on data in Mathematical expression- sets limits on data in

fieldfield Example: “Course_sections” table, “Year” fieldExample: “Course_sections” table, “Year” field

Validation Text:Validation Text: Text you want displayed when a Validation Text you want displayed when a Validation

Rule is violatedRule is violated Example: “Course_sections” table, “Year” fieldExample: “Course_sections” table, “Year” field

Page 44: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Converting Design into Tables Converting Design into Tables and Queriesand Queries

Entities Entities database tables database tables Add relationships between tablesAdd relationships between tables Make queriesMake queries

Query assembles data we wantQuery assembles data we want ““Just enough” redundancy makes this workJust enough” redundancy makes this work

Making a query in AccessMaking a query in Access Query Wizard- Let Access guide youQuery Wizard- Let Access guide you Query Design View- Make your query manuallyQuery Design View- Make your query manually Datasheet view- View, update, add, or delete dataDatasheet view- View, update, add, or delete data

Looks like data in a tableLooks like data in a table Any data changes result in changes in underlying tablesAny data changes result in changes in underlying tables Filter dataFilter data

By formBy form By selectionBy selection

SQL view (You’ve been writing programming code!)SQL view (You’ve been writing programming code!)

Page 45: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Converting Design into Tables Converting Design into Tables and Queriesand Queries

(Demonstration on making queries)(Demonstration on making queries)

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

Page 46: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to Access Introduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports Modules, Programming, and the WebModules, Programming, and the Web MacrosMacros Security features in AccessSecurity features in Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 47: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Forms and ReportsForms and Reports

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

Creating FormsCreating Forms Creating ReportsCreating Reports

Page 48: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Forms and ReportsForms and Reports

Make it easier to view, modify, add, and delete Make it easier to view, modify, add, and delete datadata

Creating FormsCreating Forms Form WizardForm Wizard Form Design ViewForm Design View

Controls in Toolbox allow customizationControls in Toolbox allow customization Wizards for many of them, Wizards for many of them, e.g.e.g. Button Button Use the View / Properties command to modify form or Use the View / Properties command to modify form or

control propertiescontrol properties Datasheet ViewDatasheet View

Useful in sub-formsUseful in sub-forms Creating ReportsCreating Reports

Page 49: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Forms and ReportsForms and Reports

(Demonstration of forms)(Demonstration of forms)

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

Page 50: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Forms and ReportsForms and Reports Make it easier to view, modify, add, and delete dataMake it easier to view, modify, add, and delete data Creating FormsCreating Forms Creating ReportsCreating Reports

Wizard- makes it easyWizard- makes it easy Design ViewDesign View

Very similar to Form Design ViewVery similar to Form Design View Differences- more headers and footersDifferences- more headers and footers

Report levelReport level Page levelPage level Data grouping levelData grouping level

Can be modified with “Sorting and Grouping” command on Can be modified with “Sorting and Grouping” command on View menuView menu

Page PreviewPage Preview Similar to Page Preview in other Office applicationsSimilar to Page Preview in other Office applications

Page 51: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Forms and ReportsForms and Reports

(Demonstration of reports)(Demonstration of reports)

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

Page 52: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Introduction to database management Introduction to database management systemssystems

How to use Microsoft AccessHow to use Microsoft Access Introduction to Access Introduction to Access Design of an Access databaseDesign of an Access database Converting design into tables and queriesConverting design into tables and queries Forms and reportsForms and reports Modules, Programming, and the WebModules, Programming, and the Web MacrosMacros Security features in AccessSecurity features in Access

Introduction to Microsoft Introduction to Microsoft AccessAccess

Page 53: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Modules, Programming, and the Modules, Programming, and the WebWeb

Modules: Allows automation beyond the Modules: Allows automation beyond the simple level of Macrossimple level of Macros Advantages:Advantages:

Broader range of choices Broader range of choices Execute fasterExecute faster Deeper level of integration with other programsDeeper level of integration with other programs Allows more user choice in responseAllows more user choice in response Visual Basic: the simplest programming environmentVisual Basic: the simplest programming environment

DisadvantagesDisadvantages More complexityMore complexity Overkill for many simple tasksOverkill for many simple tasks

Data Access PagesData Access Pages

Page 54: Introduction to Microsoft Access Mark McDonald and Jason Dewitt Visual Information Systems Center School of Information Sciences University of Pittsburgh

Modules, Programming, and the Modules, Programming, and the WebWeb

Modules: Allows automation beyond the Modules: Allows automation beyond the simple level of Macrossimple level of Macros

Data Access PagesData Access Pages Added to Access when WWW arrivedAdded to Access when WWW arrived In essence, a form/report designed for browserIn essence, a form/report designed for browser Methods to connect to an Access databaseMethods to connect to an Access database

The standard method (“ODBC”)The standard method (“ODBC”) Data Access PagesData Access Pages

Advantage: you don’t leave Access to use Data Advantage: you don’t leave Access to use Data Access PagesAccess Pages

Disadvantage: limited functionalityDisadvantage: limited functionality