ba271 week 6 lecture dave sullivan. goal for today… status report – review where we are …...

35
BA271 Week 6 Lecture BA271 Week 6 Lecture Dave Sullivan Dave Sullivan

Upload: evan-bruce

Post on 17-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

BA271 Week 6 BA271 Week 6 LectureLecture

Dave SullivanDave Sullivan

Page 2: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Goal for today…Goal for today…

Status Report – Review Status Report – Review where we are … where we are …

Begin learning about Microsoft Begin learning about Microsoft Access and databasesAccess and databases

Page 3: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Microsoft Access AssignMicrosoft Access AssignmentsmentsTutorial 1 – Introduction To Tutorial 1 – Introduction To Microsoft Access 2003Microsoft Access 2003

Tutorial 2 -- Creating and Tutorial 2 -- Creating and Maintaining a Database Maintaining a Database

Assignment 1: Creating a Assignment 1: Creating a Database Database

Page 4: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Define some key Define some key Access terminologyAccess terminology

FieldField – A single characteristic or – A single characteristic or attribute of a person, place, object, attribute of a person, place, object, event, or idea.event, or idea.

RecordRecord – A set of related field – A set of related field values.values.

TableTable – A collection of records that – A collection of records that identify a category of data, such as identify a category of data, such as Customers, Orders, or Inventory.Customers, Orders, or Inventory.

Page 5: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

FieldsFields are grouped into recordsrecords, and recordsrecords are grouped into a

tabletable.

Illustration of fields, Illustration of fields, recordsrecordsand a tableand a table

Page 6: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

A sample Access A sample Access databasedatabase Nwind.mdb, a database for the Nwind.mdb, a database for the

NorthWind Traders companyNorthWind Traders company

Page 7: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Relating tables using Relating tables using a common fielda common field

The primary key in the Employer table (EmployerID) is the common field that relates this table to the Position table.

PositionID is the primary key in the Position table. The EmployerID field is a foreign key in this table.

Primary keys can only have one occurrence in a table. Foreign keys may have multiple occurrences.

Page 8: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Activities you should Activities you should do:do:

Complete Complete Access Assignment #1Access Assignment #1..

Page 9: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Relational database Relational database and keysand keys

A A relational databaserelational database is a collection of is a collection of tables that are related to one another tables that are related to one another based on a common field.based on a common field.

A A fieldfield, or a , or a collection of fieldscollection of fields, is , is designated as the designated as the primary keyprimary key. . – The The primary keyprimary key uniquely identifies a uniquely identifies a

record in the table. record in the table. When the primary key of one table is When the primary key of one table is

represented in a second table to form a represented in a second table to form a relationship, it is called a relationship, it is called a foreign keyforeign key..

Page 10: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

The components of the The components of the AccessAccessand Database windowsand Database windows

Page 11: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Use the Objects bar Use the Objects bar to to view database view database objectsobjects

The Queries Queries categorycategory has been selected, and a query named Contacts is shown in the window.

To see a list of objects in a category, click that category category on the Objects Objects barbar.

You can also

create newcreate new objects within

each object category.

Page 12: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

The Database The Database windowwindow

The Database windowDatabase window is the main control center for working with an Access database.

The Database window contains a menu barmenu bar, an objects bar, and a groups bar.

– The Objects barObjects bar lists all the objects available in the database

– The list of objects consists of tablestables, queriesqueries, formsforms, reportsreports, pagespages, macrosmacros, and modules.modules.

– You can click on any of the objects in the Objects bar to obtain a list of objects of that type

Page 13: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

A table in A table in datasheet viewdatasheet view

Page 14: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

The navigation bar The navigation bar buttonsbuttons

Page 15: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Learn how Access Learn how Access saves a databasesaves a database

The Save buttonSave button in Access differs from the Save button in other Windows programs.

When you press the Save button in Access, you are saving the design of the Access objects and saving the design of the Access objects and NOT the data itselfNOT the data itself. . – Access saves data as it is entered

For this reason, the location at which you are storing your database must always be accessibledatabase must always be accessible while working with a particular database. – If the database is located on a diskette, the

diskette must be in the diskette drive at all times while working with this particular database

Page 16: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Sample Query Sample Query Datasheet viewDatasheet view

Query Datasheet view looks very similar to Table view. However, the data displayed in a query does not have to be in the same sequence as it appears in table view. You can display fields in any display fields in any order in a queryorder in a query.

Page 17: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

What is an Access What is an Access query?query?

If you want to see just a portion of the data in a table you can create a query.

A queryquery is a question you ask about the data stored in a database table.

Access responds by displaying the data according to your question. – For example, if you ask to see all the

customers from New York, the response would be to display only the records whose state field matches with NY

Page 18: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Open an existing query Open an existing query and create new queriesand create new queries

You can open an existing queryopen an existing query by clicking Queries on the Objects bar and then selecting the query you want to open.

You can also create your own queriescreate your own queries by clicking New on the Database window.

To create a new query, you can use the Simple Query WizardSimple Query Wizard, which will bring you through the selections you want for your query.

Page 19: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Navigating a query and Navigating a query and sorting the resultssorting the results

When you run and get the results of your query, you can reorganize the data by sorting the datasheetsorting the datasheet in either ascending or descending order.– Click the pointer anywhere in the column you

wish to sort– Click the Sort Ascending or Sort Descending

buttons on the Query Datasheet toolbar to sort the results in the desired sequence

You can navigate through the records by using the navigation buttonsnavigation buttons on the Navigations toolbar.

Page 20: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

The Simple Query The Simple Query WizardWizard

The Simple Query Wizard assists you in the creation of a new query.

Page 21: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Selecting fields to Selecting fields to include in a queryinclude in a query

You can create a query that will display only display only selected fieldsselected fields from a table instead of displaying all fields.

In the Simple Query WizardSimple Query Wizard dialog box, select which fields you want included in the query. – Move all the fields into the Selected Fields box– Move the fields one at a time – Remove fields out of the Selected Fields box by

pressing one of the remove buttons If you wanted to select all the fields except one, you

can move them all to the selected fields list and then remove the one fieldremove the one field you don't want.

Once you have made your selections, press Next to move to the next dialog box in the Wizard.

Page 22: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Access Form ViewAccess Form View

The navigation bar has the same buttons seen in Table and Query Datasheet view.

Forms display one Table or Query record at a time.

Page 23: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Create an Access formCreate an Access form

A formform allows you to view your data one one record at a timerecord at a time. .

Forms are useful for maintainingmaintaining, viewingviewing, and printingprinting records in a database.

You can create your own form in the Forms Forms Design windowDesign window or you can use the Forms WizardForms Wizard to create a form.

The easiest way to create a form is to use the AutoForm Wizard. AutoForm Wizard.

Page 24: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Use the AutoForm Use the AutoForm WizardWizard

The AutoForm WizardAutoForm Wizard uses a table (or query) you select as the basis to create a form that displays all the fields of the table (or query).

Once you have created your form, you can view the records one record at a view the records one record at a timetime. .

The form has a navigation bar just like the navigation barnavigation bar you have already used in the Table or Query Datasheet view.

Page 25: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

The Report Preview The Report Preview windowwindow

When a report has been created, you can preview it on the screen. You can navigate through the pages in the report by using the

navigation navigation buttonsbuttonsat the bottom of the preview.

Page 26: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

You can create a reportreport, which is a printed version of your data, that is formatted according to your specifications.

The datadata in the report can consist of data from a single table from a single table or multiple multiple tablestables.

Access has a Reports WizardReports Wizard that allows you to easily create a report.

The report can be based on a tablebased on a table or it can be based on a querybased on a query. – If the report is based on a query, it will contain

the same fields that were selected for the query

Create, preview, and Create, preview, and navigate a reportnavigate a report

Page 27: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Backup and restore Backup and restore a databasea database

You may want to create a backupbackup of your data so that if you lose or damage your database, you can recover from the backup.

You can use a backup tool, such as the Microsoft backup tool, or some other backup program.

To restoreTo restore the data from the backup, you need

to use the same backup tooluse the same backup tool according

to the instructions associated with that tool.

Page 28: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Compacting reduces Compacting reduces database storage database storage sizesize

Compacting a database reduces the space used by the database, making the space available for other uses.

Page 29: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Setting the Setting the Compact on Close Compact on Close optionoption

Select the General tab of the Options dialog box.

Click the check box to insert a check mark so the database will be compacted every time it is closed.

Page 30: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Compacting a Compacting a databasedatabase

It is a good idea to periodically compact and compact and repairrepair a database to recover wasted spacerecover wasted space created by adding, deleting, and modifying records.

Access has a Compact and Repair feature:

– Open a database

– Click on ToolsTools and then OptionsOptions

– On the Options menu, select Compact on CloseCompact on Close. . Selecting this option will cause your database option will cause your database to be compacted and repaired every time you to be compacted and repaired every time you close itclose it

Page 31: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Convert an existing Convert an existing databasedatabaseto Access 2002 to Access 2002 formatformat

It is possible to convert a database created in Access 2000 to an Access 2002 database.

To convert an Access 2000 database to Access 2002 format:

– Make certain the database to be converted is closeddatabase to be converted is closed

– Click ToolsTools on the menu bar, then point to Database Database UtilitiesUtilities

– Point to Convert databaseConvert database and choose the format to format to convert toconvert to

– Enter the nameEnter the name of the database to convert, and a name name for the converted databasefor the converted database to be stored under

Page 32: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Steps to complete Steps to complete Tutorial Tutorial 11described on pages described on pages AC1.27 to 1.28AC1.27 to 1.28

4. 4. Copy “Seasons.mdbSeasons.mdb” to your classwork folder

Rename “Table 1Table 1” as “EmployersEmployers”

5. 5. Open “EmployerEmployer” table

6.6.Open Help – “set page setup options for set page setup options for printingprinting”

Select “for a table, query, form or reportfor a table, query, form or report”

Read explanation & close

Page 33: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Steps to complete Steps to complete Tutorial 1Tutorial 1described on pages described on pages AC1.27 to 1.28AC1.27 to 1.28

7.7.Create Query w/wizardTable = “EmployersEmployers” Fields = in this order: >City>City

>Employer Name>Employer Name>Contact First Name>Contact First Name>Contact Last Name>Contact Last Name>Phone fields>Phone fields

Next>>Name = “Employer Phone List Employer Phone List ”Modify Query Design…Sort “City City ” ascending

Page 34: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Steps to complete Steps to complete Tutorial Tutorial 11described on pages described on pages AC1.27 to 1.28AC1.27 to 1.28

8. 8. AutoformAutoform WizardCreate Form using “EmployersEmployers” tableAll FieldsColumnar formatStandard = OKName form “Employer InfoEmployer Info”“Open form to view or enter infoOpen form to view or enter info”Click on Help “What’s thisWhat’s this” & point to Record # boxGoto Record #42

Page 35: BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft

Steps to complete Steps to complete Tutorial Tutorial 11described on pages described on pages AC1.27 to 1.28AC1.27 to 1.28

12. Auto Report Wizard on “Employers TableEmployers Table”

Save as ”EmployersEmployers” 13. Set option to compact “SeasonsSeasons” database on

close14. Convert to:

Access 2002 format & save as “Seasons 2002Seasons 2002”

Access 97 format & save as “Seasons 97Seasons 97”

View differences in the file sizes with a file manager

15. 15. ExitExit Access