microsoft access a hands-on introduction chapter 1

31
Microsoft Access Microsoft Access A Hands-On Introduction A Hands-On Introduction Chapter 1 Chapter 1

Upload: bilal-tufford

Post on 01-Apr-2015

225 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Microsoft Access A Hands-On Introduction Chapter 1

Microsoft AccessMicrosoft Access

A Hands-On IntroductionA Hands-On Introduction

Chapter 1Chapter 1

Page 2: Microsoft Access A Hands-On Introduction Chapter 1

22

What is Microsoft Access?What is Microsoft Access?

A Windows software application.A Windows software application. An application development environment.An application development environment. A data organizer.A data organizer. A collection of Information tools.A collection of Information tools. A A RRelational elational DDataatabbase ase MManagement anagement SSystem.ystem. All of the above.All of the above.

Page 3: Microsoft Access A Hands-On Introduction Chapter 1

33

What is a Database?What is a Database?

A Database is a collection of informationA Database is a collection of information organized for a specific purpose.organized for a specific purpose.

An example might be information aboutAn example might be information about a movie collection. A telephone book isa movie collection. A telephone book is another example. another example. In a given day you might use many objectsIn a given day you might use many objects that could be considered databases.that could be considered databases.

Page 4: Microsoft Access A Hands-On Introduction Chapter 1

44

What is a Database? (contd.)What is a Database? (contd.)

In Access, we work with what is called aIn Access, we work with what is called a Relational database. Access is an RDBMS.Relational database. Access is an RDBMS.

The term Relational means that each tableThe term Relational means that each table in the database contains information aboutin the database contains information about a single subject and only that subject.a single subject and only that subject.

Each table however will typically be relatedEach table however will typically be related to one or more other tables. An exampleto one or more other tables. An example would be a Customers table related towould be a Customers table related to an Orders table. More on this later.an Orders table. More on this later.

Page 5: Microsoft Access A Hands-On Introduction Chapter 1

55

Types of DatabasesTypes of Databases

Flat file: like a spreadsheetFlat file: like a spreadsheet

Flat files are limited in their useFlat files are limited in their use Used for less complicated databasesUsed for less complicated databases Waste disk space as the complexity increasesWaste disk space as the complexity increases

Customer Ship method Invoice Invoice Item Quantity Unit costCustomer Ship method Invoice Invoice Item Quantity Unit cost date number numberdate number numberMendenhall Steel UPS Blue 12/1/05 229901 B4500 2 $2.33 Mendenhall Steel UPS Blue 12/1/05 229901 B4500 2 $2.33 Mendenhall Steel UPS Blue 12/1/05 229901 C2134 4 $3.45 Mendenhall Steel UPS Blue 12/1/05 229901 C2134 4 $3.45 Mendenhall Steel UPS Blue 12/1/05 229901 Z2344 6 $342.33 Mendenhall Steel UPS Blue 12/1/05 229901 Z2344 6 $342.33 Mendenhall Steel UPS Blue 12/1/05 229901 M4098 8 $12.98 Mendenhall Steel UPS Blue 12/1/05 229901 M4098 8 $12.98 Mendenhall Steel UPS Blue 12/1/05 229901 Q1243 10 $132.33 Mendenhall Steel UPS Blue 12/1/05 229901 Q1243 10 $132.33 Mendenhall Steel UPS Blue 12/1/05 229901 P0918 12 $134.95 Mendenhall Steel UPS Blue 12/1/05 229901 P0918 12 $134.95 Gerrity Lumber FedEx 12/1/05 229902 P0918 1 $134.95 Gerrity Lumber FedEx 12/1/05 229902 P0918 1 $134.95 Gerrity Lumber FedEx 12/1/05 229902 M4098 2 $12.98 Gerrity Lumber FedEx 12/1/05 229902 M4098 2 $12.98 Gerrity Lumber FedEx 12/1/05 229902 C2134 3 $3.45Gerrity Lumber FedEx 12/1/05 229902 C2134 3 $3.45

Page 6: Microsoft Access A Hands-On Introduction Chapter 1

66

Types of Databases (Contd.)Types of Databases (Contd.)

Relational:

Contain information that spans multiple topics or subject tables.

Use common information to link the subject tables.

Use less disk space.

Are more complex to design than flat-file systems.

Are more efficient in terms of Data extraction.

Page 7: Microsoft Access A Hands-On Introduction Chapter 1

77

Access as an RDBMSAccess as an RDBMS

With an RDBMS, you have complete control over how you With an RDBMS, you have complete control over how you define, work with and share data.define, work with and share data.

There are three types of capabilities provided; data There are three types of capabilities provided; data definition, data manipulation, and data control. definition, data manipulation, and data control.

You can use an Access database as either a desktop You can use an Access database as either a desktop database serving one user or as a table sharing database database serving one user or as a table sharing database on a network serving many users.on a network serving many users.

Access is also useful as a front-end to a client/server Access is also useful as a front-end to a client/server database such as SQL Server or Oracle.database such as SQL Server or Oracle.

The possibilities are endless!The possibilities are endless!

Page 8: Microsoft Access A Hands-On Introduction Chapter 1

88

Data DefinitionData Definition

You define what Type of data is stored in your database. You define what Type of data is stored in your database. For example text or numbers or a combination of both.For example text or numbers or a combination of both.

You define how the data is related.You define how the data is related. You may also define how the data is formatted and how it You may also define how the data is formatted and how it

is validated.is validated. You also determine the level of data integrity desired.You also determine the level of data integrity desired.

Page 9: Microsoft Access A Hands-On Introduction Chapter 1

99

Data ManipulationData Manipulation

In Access, you can work with your data in many ways.In Access, you can work with your data in many ways. You can select which data fields you want.You can select which data fields you want. You can sort the data and filter it.You can sort the data and filter it. You can work with multiple tables using relationships that You can work with multiple tables using relationships that

you have defined.you have defined. You can summarize data, update and delete data and also You can summarize data, update and delete data and also

copy it to another database if you wish.copy it to another database if you wish.

Page 10: Microsoft Access A Hands-On Introduction Chapter 1

1010

Data ControlData Control

The Data Control feature allows you to define who may The Data Control feature allows you to define who may read, update and insert data.read, update and insert data.

This functionality also allows you to define how data can be This functionality also allows you to define how data can be shared and updated by multiple users at the same time.shared and updated by multiple users at the same time.

A true RDBMS is designed such that if users are sharing A true RDBMS is designed such that if users are sharing data, no two users can be updating the same record data, no two users can be updating the same record concurrently.concurrently.

Another feature is the ability to create transactions which Another feature is the ability to create transactions which are multi-step processes where all steps either succeed or are multi-step processes where all steps either succeed or fail. This ensures data integrity.fail. This ensures data integrity.

Page 11: Microsoft Access A Hands-On Introduction Chapter 1

1111

When Is Access Appropriate?When Is Access Appropriate?

As a self-contained system A fully functional desktop database system for a

single user or for multiple non-concurrent users on a standalone computer.

As a networked multi-user system A multi-user system using Access MDB database

files shared on a network file server.Supports record locking and refreshing.

As a front-end to an external database system A front-end control system for ODBC-compliant

databases.Supports Structured Query Language (SQL) calls.

ODBC = open database connectivity

Page 12: Microsoft Access A Hands-On Introduction Chapter 1

1212

How Access interacts with WindowsHow Access interacts with Windows

Access is a visual design tool.Access is a visual design tool.

-- Supports all Windows design standards.-- Supports all Windows design standards. -- Drag and Drop support.-- Drag and Drop support. -- Supports all Windows Menu standards.-- Supports all Windows Menu standards. -- Is part of Microsoft Office so works-- Is part of Microsoft Office so works seamlessly with all Office applications.seamlessly with all Office applications. -- Includes the Visual Basic Programming-- Includes the Visual Basic Programming language.language.

Page 13: Microsoft Access A Hands-On Introduction Chapter 1

1313

How is Access visual?How is Access visual?

Most Access objects are created with visual design tools.Most Access objects are created with visual design tools. These designers work in a way that could be described as These designers work in a way that could be described as

a Computerized Erector Set.a Computerized Erector Set. Another set of tools available are called Wizards. Wizards Another set of tools available are called Wizards. Wizards

simplify object creation via a multi-step question and simplify object creation via a multi-step question and answer process.answer process.

Wizards are a great tool for creating objects such as tables, Wizards are a great tool for creating objects such as tables, queries, forms and reports.queries, forms and reports.

The end result is maximum creation for minimal work.The end result is maximum creation for minimal work.

Page 14: Microsoft Access A Hands-On Introduction Chapter 1

1414

To SummarizeTo Summarize

How would you best describe Microsoft Access?How would you best describe Microsoft Access? What are some examples of databases you might use in the What are some examples of databases you might use in the

everyday world?everyday world? What does RDBMS stand for?What does RDBMS stand for? What is the non-relational type database called?What is the non-relational type database called? Using Access as a front-end means what?Using Access as a front-end means what? Access is part of what software suite?Access is part of what software suite?

Now that you have a general idea of what Access is and Now that you have a general idea of what Access is and how it works with databases, let’s take a closer look at its how it works with databases, let’s take a closer look at its parts.parts.

We will learn about the major objects contained in Access We will learn about the major objects contained in Access and then drill down and discover how it works with data.and then drill down and discover how it works with data.

Page 15: Microsoft Access A Hands-On Introduction Chapter 1

1515

What are the major objects.What are the major objects.

An Access database or MDB file contains seven major An Access database or MDB file contains seven major objects.objects.

-- Forms-- Forms Visual interfaces for display andVisual interfaces for display and acceptance of data.acceptance of data. -- Tables-- Tables Created with simple point and click,Created with simple point and click, drag and drop functionality.drag and drop functionality.

Page 16: Microsoft Access A Hands-On Introduction Chapter 1

1616

Major objects (Contd.)Major objects (Contd.)

-- Queries-- Queries

Objects that provide views of data fromObjects that provide views of data from

one or more tables.one or more tables.

Created with sophisticated visual Created with sophisticated visual

QQuery uery bby y EExample tool.xample tool.

-- Reports-- Reports

Similar to forms but designed for hardSimilar to forms but designed for hard

copy output.copy output.

Like Queries, also created with visual design tools.Like Queries, also created with visual design tools.

Page 17: Microsoft Access A Hands-On Introduction Chapter 1

1717

Major objects (Contd.)Major objects (Contd.)

-- -- DData ata AAccess ccess PPagesages

Similar to forms, however are accessedSimilar to forms, however are accessed

by user with a Web browser.by user with a Web browser.

-- Macros-- Macros

Provide some rudimentary programming.Provide some rudimentary programming.

-- Modules-- Modules

VBA code that provides additional capability beyond the VBA code that provides additional capability beyond the

other main objects. other main objects.

Page 18: Microsoft Access A Hands-On Introduction Chapter 1

1818

Major objects (Contd.)Major objects (Contd.)

More difficult design tasks must be done with manual More difficult design tasks must be done with manual coding.coding.– Responding to special types of user input.Responding to special types of user input.– More complex data validation.More complex data validation.– Creating buttons and toolbars that respond in special Creating buttons and toolbars that respond in special

ways.ways.– Bulk processing of records.Bulk processing of records.– VBA modules can take your database to the next level.VBA modules can take your database to the next level.

Page 19: Microsoft Access A Hands-On Introduction Chapter 1

1919

Access as a Relational Design ToolAccess as a Relational Design Tool

True relational modelTrue relational model– Access implements a true relational database model.Access implements a true relational database model.– Allows Access to function as a frontend to other Allows Access to function as a frontend to other

client/server database systems.client/server database systems. Integrated dataIntegrated data

– All data tables and indexes are integrated into an All data tables and indexes are integrated into an Access file.Access file.

Integrated formsIntegrated forms– Access databases contain not only the data, but also Access databases contain not only the data, but also

the forms and reports for that system in the same file.the forms and reports for that system in the same file.

Page 20: Microsoft Access A Hands-On Introduction Chapter 1

2020

The Windows WayThe Windows Way

Windows programs are event drivenWindows programs are event driven– Windows is a multitasking operating system.Windows is a multitasking operating system.– Windows uses an event-driven model to allow programs Windows uses an event-driven model to allow programs

to respond to the user.to respond to the user.– Access programming requires responding to Windows Access programming requires responding to Windows

events using event procedures.events using event procedures.– Some examples of events are: Mouse Clicks, a Some examples of events are: Mouse Clicks, a

Keypress, selecting an item in a Listbox, a Form Keypress, selecting an item in a Listbox, a Form opening or closing.opening or closing.

– The list is seemingly endless.The list is seemingly endless.

Page 21: Microsoft Access A Hands-On Introduction Chapter 1

2121

The Windows Way (Contd.)The Windows Way (Contd.)

Working with Access means working with objects.Working with Access means working with objects.– Everything in Access is an object.Everything in Access is an object.

TablesTables FormsForms QueriesQueries Reports Reports PagesPages MacrosMacros ModulesModules

This object paradigm requires a new approach to This object paradigm requires a new approach to programming to fully exploit the features of Access objects.programming to fully exploit the features of Access objects.

Page 22: Microsoft Access A Hands-On Introduction Chapter 1

2222

Where is the Data?Where is the Data?

Database (MDBFILE)

Tables in database Records in Table

Fields in Record

Page 23: Microsoft Access A Hands-On Introduction Chapter 1

2323

TablesTables

Tables contain data about a particular subject.Tables contain data about a particular subject.

-- Orders-- Orders

-- Order Items-- Order Items

-- Vendors-- Vendors A table is a container of records.A table is a container of records.

-- A record contains data about one Order, one Order-- A record contains data about one Order, one Order

Item, one Vendor.Item, one Vendor. A record is a container of fields.A record is a container of fields.

-- A field for example in an Order record might contain-- A field for example in an Order record might contain

one piece of information such as ShipDate.one piece of information such as ShipDate. All records in a table contain the same fields.All records in a table contain the same fields.

Page 24: Microsoft Access A Hands-On Introduction Chapter 1

2424

FieldsFields

Each field contains information about a specific thing such Each field contains information about a specific thing such as VendorNumber, OrderDate, ItemCost.as VendorNumber, OrderDate, ItemCost.

Each field contains a specific type of data such as Text, Each field contains a specific type of data such as Text, Currency, Yes/No, Numeric and more…Currency, Yes/No, Numeric and more…

Some fields might contain small amounts of data and Some fields might contain small amounts of data and others many hundreds or even thousands of characters of others many hundreds or even thousands of characters of data.data.

Access allows many different data types.Access allows many different data types.

Page 25: Microsoft Access A Hands-On Introduction Chapter 1

2525

Creating order out of chaosCreating order out of chaos Data entered into a table winds up in what is called Natural Data entered into a table winds up in what is called Natural

Order. That is, each record is added just following the Order. That is, each record is added just following the previous record. previous record.

Natural Order bears no resemblance to the way we Natural Order bears no resemblance to the way we typically need to view our data.typically need to view our data.

Page 26: Microsoft Access A Hands-On Introduction Chapter 1

2626

Creating order out of chaos (Contd.)Creating order out of chaos (Contd.) As you can see, natural order is not very useful so Access As you can see, natural order is not very useful so Access

allows us to assign indexes to fields. This enhances allows us to assign indexes to fields. This enhances speed of retrieval and sorting of records.speed of retrieval and sorting of records.

1 Anders Maria Obere str 57

2 Moos Hannah Forster str 57

3 Handel Ernst Kirchgasse Rd

4 Simpson Patrik Cerrito 333

5 Devon Ann 35 King George

6 Wang Yang 29 Haupt str

7 Cruz Aria 6 West Main

8 Onyon Dale 49 N Calvert st

1 Anders

7 Cruz

5 Devon

3 Handel

2 Moos

8 Onyon

4 Simpson

6 Wang

Natural table order

Table

Internal index

Record pointer

Page 27: Microsoft Access A Hands-On Introduction Chapter 1

2727

IndexesIndexes

Indexes provide:Indexes provide:

-- Quick retrieval of records.-- Quick retrieval of records.

-- Quick sorting of records.-- Quick sorting of records.

-- Faster query response.-- Faster query response. Indexes are actually internal tables that contain field Indexes are actually internal tables that contain field

contents and a record pointer. When the database is contents and a record pointer. When the database is opened, Access places the indexes in memory for opened, Access places the indexes in memory for efficiency.efficiency.

An index specified for the Last Name field in a Customers An index specified for the Last Name field in a Customers Table would be useful for rapid retrieval of a given Table would be useful for rapid retrieval of a given customer record.customer record.

Indexes can be specified as unique or duplicates allowed. Indexes can be specified as unique or duplicates allowed.

Page 28: Microsoft Access A Hands-On Introduction Chapter 1

2828

Primary keyPrimary key

A field or combination of fields that uniquely A field or combination of fields that uniquely identify a record.identify a record.

A given table can only have one Primary key.A given table can only have one Primary key. Multiple fields would only be needed in the Multiple fields would only be needed in the

event that one field cannot guarantee event that one field cannot guarantee uniqueness.uniqueness.

Access does not require a table to have a Access does not require a table to have a Primary key, however most tables will have Primary key, however most tables will have one.one.

Access can create one for you if necessary.Access can create one for you if necessary. Although not a requirement, Primary Key Although not a requirement, Primary Key

fields are usually the first fields in each table.fields are usually the first fields in each table. Internally, Primary keys are really indexes Internally, Primary keys are really indexes

that are required to be unique.that are required to be unique.

Page 29: Microsoft Access A Hands-On Introduction Chapter 1

2929

Primary keys in Table relationshipsPrimary keys in Table relationships

Page 30: Microsoft Access A Hands-On Introduction Chapter 1

3030

Primary keys in table relationships (contd.)Primary keys in table relationships (contd.)

Primary keys are used to create relationships with other Primary keys are used to create relationships with other tables.tables.

This is sometimes called a This is sometimes called a Parent/Child relationshipParent/Child relationship.. The Primary key of one table is linked to a field in the The Primary key of one table is linked to a field in the

second table. second table. The field in the second (child) table must be the same data The field in the second (child) table must be the same data

type as the Primary key field of the first (parent) table.type as the Primary key field of the first (parent) table. This field in the child table is sometimes called a This field in the child table is sometimes called a Foreign Foreign

Key.Key. As you may have noticed in the relationships screen, the

linked fields were spelled the same. This is not a requirement however, but a useful design goal.

These sorts of challenges are what make working with databases so interesting and enjoyable.

Page 31: Microsoft Access A Hands-On Introduction Chapter 1

3131

What we have coveredWhat we have covered

What is Access.What is Access. What is a database.What is a database. The ways we can work with data.The ways we can work with data. The visual emphasis of Access.The visual emphasis of Access. Access as a Access as a RRelational elational DDataatabbase ase MManagement anagement SSystemystem The major Access objects.The major Access objects. Tables as data containers.Tables as data containers. Primary keys and indexes.Primary keys and indexes. Table relationships.Table relationships.