intro ms access
TRANSCRIPT
-
7/28/2019 Intro MS Access
1/51
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
2/51
Databases are THE REASON why organizations have usedcomputers
Many uses:Corporate & organizational data
SalesInventory
Employee records. . .
Personal databasesPC & Mac: Quicken
Palm: a collection of databasesAppointments
Addresses
To-dos
World Wide WebIncreasing fraction of Web pages driven by databases
Allows pages customized for the user
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
3/51
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
-
7/28/2019 Intro MS Access
4/51
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
-
7/28/2019 Intro MS Access
5/51
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
-
7/28/2019 Intro MS Access
6/51
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 Microsoft Access
-
7/28/2019 Intro MS Access
7/51
Intro to Microsoft Access
Goals of Class:
Learn how to use Access
Develop understanding of database systemsAssumes you know something in Microsoft Office:
i.e., Word, Excel, PowerPoint, FrontPage
Prior experience with Access not needed
-
7/28/2019 Intro MS Access
8/51
First attempt:Put paper records in computer-based files
One record in a paper form One row (record) incomputerized 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 systemContinuing problem- identifying and eliminating incorrect entries
Wasted storage space
Overwhelming complexityLarge effort to maintain this system
Introduction to Database Systems:
A Very Brief History
-
7/28/2019 Intro MS Access
9/51
Problems with file systems- redundant entries
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
-
7/28/2019 Intro MS Access
10/51
Problems with File Systems
Different views of data needed
Teacher View data for each class taught
Class rosters
Input grades
Student- Personal data only
Administrator- needs multiple views
May need other views (e.g., counselors)
Different privileges for data access and modification
Teachers can add grades
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
-
7/28/2019 Intro MS Access
11/51
Problems with file systems
Dept. Course No. Course Term Section Teacher Student Grade
Geology 1003Geol. for
JocksFall 2002 001 Joseph Sagacious Robinson, Ed B-
Geology 1003Geol. for
JocksFall 2002 001 Joseph Sagacious Langer, Yvonne A
Geology 1003Geol. for
JocksFall 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
-
7/28/2019 Intro MS Access
12/51
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)
Different privileges for data access and modification
Teachers can add grades
Students cant change anything
Can only view his/her data
Administrative personnel can add courses, class sections, or teachers
-
7/28/2019 Intro MS Access
13/51
Problems with file systems
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
-
7/28/2019 Intro MS Access
14/51
Problems with File SystemsDifferent 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 classAt end of semester, ensure teachers have submitted grades
May need other views (e.g., counselors)
Different privileges for data access and modification
Teachers can add grades
Students cant change anythingAdministrative personnel can add courses, class sections, or teachers
But they cant change grades
-
7/28/2019 Intro MS Access
15/51
(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 databasePrinciple focus: handling data
Handles physical details of storing data efficiently
Delivers & manipulates data for applications
Limits data access based on users privileges in system
Several industrial-strength DBMS:
Oracle 9iIBM DB2
Microsoft SQL Server
Application programsGet data from DBMSStandardized language to get data (SQL)
Database systems
-
7/28/2019 Intro MS Access
16/51
The 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
-
7/28/2019 Intro MS Access
17/51
The 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
-
7/28/2019 Intro MS Access
18/51
The 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
-
7/28/2019 Intro MS Access
19/51
The 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-5432444-2002-2-001 555-11-5432
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( 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
-
7/28/2019 Intro MS Access
20/51
Microsoft Access is Unique
Provides DBMS functionsNot industrial-strength, designed for:
Individuals
Small workgroups
External application programs work with AccessCan use SQL to get or manipulate data in Access database
Provides built-in tools for reporting and for application developmentFormsReportsVisual Basic code modules
Provides flexibility
Small, simple all-in-one environmentData 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
-
7/28/2019 Intro MS Access
21/51
Introduction to database management systems
How to use Microsoft Access
Introduction to Access
Design of an Access databaseConverting design into tables and queries
Forms and Reports
Modules, Programming, and the Web (no content)
Basics of Macros
Security features in Access
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
22/51
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)
-
7/28/2019 Intro MS Access
23/51
Introduction to database management systems
How to use Microsoft Access
Introduction to Access
Design of an Access databaseConverting design into tables and queries
Forms and reports
Modules, Programming, and the Web
Macros
Security features in Access
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
24/51
Design of an Access database
First step: Eliminate the computerCapture required features of school, business, or organization in model
Pencil & paper work; no computer needed
Translate to computer later
Identify theentity types
Add attributes (if desired)
Identify relationships between entities
-
7/28/2019 Intro MS Access
25/51
Design of an Access database
First step: Eliminate the computerIdentify the entity types
Will become names for tables of data
Entity types should be real thingsCan be physically real (e.g., Employees)
Can be abstract (e.g., Courses)
Examples:
Students
Teachers
Courses
Class Sections
Should be central to the work process of the school, business, or organizationTeachers- could be an entity type for a school
Crossing guards- not an entity type
Add attributes (if desired)
Identify relationships between entities
-
7/28/2019 Intro MS Access
26/51
Identifying Entities
Students
Teacher
Class_Sections
Course
Grades
-
7/28/2019 Intro MS Access
27/51
Design of an Access database
First step: Eliminate the computerIdentify 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
-
7/28/2019 Intro MS Access
28/51
Adding Attributes
Always 1:1 with entity
Adding attributes: a mixed bagUpside: You know where things go
Downside: Clutters up entity relationships
Students
StudentNo
Address
City
State
WorkPhoneCellPhone
HomePhone
Email
StudentFirstName
StudentLastName
-
7/28/2019 Intro MS Access
29/51
Design of an Access databaseFirst step: Eliminate the computer
Identify the entity types
Add attributes (if desired)
Identify relationships between entity typesHow many: How many
1: 1
1: Many[Many = more than one ]
Many: Many
Remember: numbers refer to relationship, not to population of entity type
Is entity required in relationship?
Optional(e.g., ClassSection may be optional to Course- a course may not be taught
every semester)
Mandatory
(e.g., Teacher mandatory for ClassSection)
-
7/28/2019 Intro MS Access
30/51
Identifying RelationshipsStudents
Teacher
Class_Sections
Many
Many
1
haveEmergency
Contact Info
11
teaches
1
obtain
Grades
in
Course has1
1
has 1
1
Employee_Information
1
1
advised by
Many
Grades
-
7/28/2019 Intro MS Access
31/51
Introduction to database management systems
How to use Microsoft Access
Introduction to Access
Design of an Access databaseConverting design into tables and queries
Forms and reports
Modules, Programming, and the Web
Macros
Security features in Access
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
32/51
Converting Design into Tables and
Queries
Entities database tablesTable 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
C i D i i T bl d
-
7/28/2019 Intro MS Access
33/51
Converting Design into Tables and
Queries
(Demonstration- making tables and enteringdata)
School1.mdb
????????
-
7/28/2019 Intro MS Access
34/51
Converting Design into Tables and
Queries
Entities database tables
Add relationships between tablesMenu command: Tools / Relationships
Match primary key in one table with matching value inanother table (foreign key)
Enforce referential integrity- keeps your data good!
Access uses to mean Many
Make queries
-
7/28/2019 Intro MS Access
35/51
Converting Design into Tables and
Queries
(Demonstration on drawing relationships)
School2.mdb
????????
-
7/28/2019 Intro MS Access
36/51
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
1:Many relationships
Typically, add a foreign key from 1 side in Many table
Example: Advisor field in Students table
Tables dangling on end of 1:1 relationship
Table on end may be unnecessary
Fields may belong in other table
Exceptions:When main table is big
Certain fields arent used often
Example: Emergency Contact Info Entity
-
7/28/2019 Intro MS Access
37/51
Rules of Thumb: Creating Tables
Primary key determinationEach value MUST be unique
Keydetermines all other fields in table- they all depend on value ofprimary key
Otherwise: a problem with design
When only a combination of fields is unique: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 thenumber!)
Example: Grades table
-
7/28/2019 Intro MS Access
38/51
Rules of Thumb: Creating Tables
Data typesChoose 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 IDnumbers
When in doubt, use Text
Field Size:
Default values assigned by Access usually OKUnless youre likely to run out of storage space
If you want to change from default, do it early!
Before data added
Before relationships between tables made
-
7/28/2019 Intro MS Access
39/51
Rules of Thumb: Creating Tables
Format:
Extra level of formatting for Date/Time, Number, Currency
Input Mask:
Formatting for viewing, inputting Soc. Sec. No., Phone no., etc.
Wizard for masking common types
Caption:
Human-friendly name for field when used elsewhere in Access
Default value:
What filled in automatically if no entry in field
-
7/28/2019 Intro MS Access
40/51
Rules of Thumb: Creating Tables
Validation Rule:
Mathematical expression- sets limits on data in field
Example: Course_sections table, Year field
Validation Text:Text you want displayed when a Validation Rule is violated
Example: Course_sections table, Year field
-
7/28/2019 Intro MS Access
41/51
Converting Design into Tables and
Queries
Entities database tables
Add relationships between tables
Make queriesQuery assembles data we want
Just enough redundancy makes this workMaking a query in Access
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 tableAny data changes result in changes in underlying tables
Filter data
By form
By selection
SQL view (Youve been writing programming code!)
-
7/28/2019 Intro MS Access
42/51
Converting Design into Tables and
Queries
(Demonstration on making queries)
School3.mdb
???????????
-
7/28/2019 Intro MS Access
43/51
Introduction to database management systems
How to use Microsoft AccessIntroduction to Access
Design of an Access databaseConverting design into tables and queries
Forms and reports
Modules, Programming, and the WebMacros
Security features in Access
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
44/51
Forms and Reports
Make it easier to view, modify, add, and deletedata
Forms optimized for on-screen use
Reports- optimized for printout
Each based on a table or on a query
Creating Forms
Creating Reports
-
7/28/2019 Intro MS Access
45/51
Forms and Reports
Make it easier to view, modify, add, and delete data
Creating FormsForm Wizard
Form Design ViewControls in Toolbox allow customization
Wizards for many of them, e.g. Button
Use the View / Properties command to modify form or controlproperties
Datasheet ViewUseful in sub-forms
Creating Reports
-
7/28/2019 Intro MS Access
46/51
Forms and Reports
(Demonstration of forms)
School4.mdb
???????????
-
7/28/2019 Intro MS Access
47/51
Forms and Reports
Make it easier to view, modify, add, and delete data
Creating Forms
Creating ReportsWizard- makes it easy
Design View
Very similar to Form Design View
Differences- more headers and footersReport level
Page level
Data grouping levelCan be modified with Sorting and Grouping command on View menu
Page Preview
Similar to Page Preview in other Office applications
-
7/28/2019 Intro MS Access
48/51
Forms and Reports
(Demonstration of reports)
School5.mdb
???????????
-
7/28/2019 Intro MS Access
49/51
Introduction to database management systems
How to use Microsoft Access
Introduction to Access
Design of an Access databaseConverting design into tables and queries
Forms and reports
Modules, Programming, and the Web
Macros
Security features in Access
Introduction to Microsoft Access
-
7/28/2019 Intro MS Access
50/51
Modules, Programming, and the Web
Modules: Allows automation beyond the simple level ofMacros
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
DisadvantagesMore complexity
Overkill for many simple tasks
Data Access Pages
-
7/28/2019 Intro MS Access
51/51
Modules, Programming, and the Web
Modules: Allows automation beyond the simple level ofMacros
Data Access Pages
Added to Access when WWW arrivedIn essence, a form/report designed for browser
Methods to connect to an Access databaseThe standard method (ODBC)
Data Access Pages
Advantage: you dont leave Access to use Data Access Pages
Disadvantage: limited functionality