viewing tip: while viewing this presentation in your browser, select browse, full screen. then, when...

56
Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select Screen / Pause. Click to Start

Upload: shannon-andrews

Post on 29-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Viewing Tip:While viewing this presentation in your browser, select Browse, Full Screen.

Then, when you want to pause the show, Right Click and select Screen / Pause.

Click to Start

Page 2: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

For this lab you should have followed these steps, in “EXACT” order.

1. Fill in a “Task Sheet” for your database.

2. Fill in 2 “Subject Sheets”. One for each table identified on the Task Sheet.3. Create a new Database with two tables using the data from your two subject sheets.

4. Define a relationship between the two tables.

5. Print a Table Definition for each table created.

6. Print a datasheet for each table.

Page 3: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Using the task sheet, you should identify and record the task at hand with a brief description.

The Task Sheet

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Page 4: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

You should then list all of the unique pieces of information (fields) that you will need in your database.

The Task Sheet

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

CustomerNum

CustomerName

Address

PetID

Pet Name

Page 5: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

You should then list all of the unique pieces of information (fields) that you will need in your database.

The Task Sheet

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

CustomerNum

CustomerName

Address

PetID

Pet Name

At this point, it doesn’t matter what order the data is listed in, just as long as it is listed.

Page 6: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Keeping in mind that Access is a relational database, you should also identify the subject (table) that each piece of data will eventually end up in.

The Task Sheet

CustomerNum

CustomerName

Address

PetID

Pet Name

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Customer

Customer

Customer

Pet

Pet

Page 7: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

The Task Sheet

CustomerNum

CustomerName

Address

PetID

Pet Name

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Customer

Customer

Customer

Pet

Pet

On the task sheet, column #1 is for the field name and column #4 is the table name. If you feel the need to describe a field, use the description column. Ignore the usage column (Column #2) for our labs.

Page 8: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

CustomerNum

CustomerName

Address

PetID

Pet Name

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Customer

Customer

Customer

Pet

Pet

When the task sheet has been completed, count the number of tables identified in column #4 and make up one subject sheet for each table.

The Subject Sheet

Page 9: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Task Sheet

Subject Sheet

Subject Sheet

CustomerNum

CustomerName

Address

PetID

Pet Name

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Customer

Customer

Customer

Pet

Pet

Page 10: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Task Sheet

Subject Sheet

Subject Sheet

CustomerNum

CustomerName

Address

PetID

Pet Name

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Customer

Customer

Customer

Pet

Pet

Notice below that two tables have been identified, the Customer Table and the Pet Table.

Page 11: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Task Sheet

Customer Subject Sheet

Pets Subject Sheet

CustomerNum

CustomerName

Address

PetID

Pet Name

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

Customer

Customer

Customer

Pet

Pet

We would therefore need two Subject Sheets, one for the Customer Subject (table) and one for the Pet Subject (table).

Page 12: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Identify the table name and description of each subject at the top of each subject page.

The Subject Sheet

Customer

Pets

Page 13: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Indicate the relationship to any other tables for each subject.

example:Related Subjects: Name Relationship

Pets Many or One to Many

The Subject Sheet

Pets

Customer One to Many

Page 14: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Task Sheet

Subject Sheet

Subject Sheet

Transcribe the data fromthe task sheet, to each respective subject sheet listing the field name in column #1 and then indicate what the data type is for each field in column #2. Ignore the Validation Rule column for our labs.

Page 15: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

CustomerNum

CustomerName

Address

PetID

Pet Name

Customer

Customer

Customer

Pet

Pet

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

CustomerNum

CustomerName

Customer

Pets

Task Sheet Customer Subject Sheet

Page 16: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

CustomerNum

CustomerName

Address

PetID

Pet Name

Customer

Customer

Customer

Pet

Pet

Track Customer and Pet Visits

To provide a record of Customers and each corresponding pet visit.

Invoicing and Mailing Lists

CustomerNum

CustomerName

Customer

Pets

Task Sheet Customer Subject Sheet

Page 17: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Pets

Pets One to Many

CustomerNum

CustomerName

After all the data has been transcribed to each respective Subject (table) sheet, it’s time to identify the data type for each Data Name. (see page AC 2.05 in your book for the different data types available)

Page 18: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Next, create a new, blank database named Lab1nnnn.mdb, where nnnn is the last 4 digits of your Student ID Number, and using your subject tables, create the tables and fields indicated on the subject sheets. (pay close attention to data types)

Page 19: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

To create a new database, you must first start Microsoft Access. See Page AC 1.07 in your book for instructions on starting the program.

From your task bar, select“Start” “Programs” “Microsoft Access”

Page 20: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

As Access launches, you will see this screen appear.

Page 21: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Select the Blank Access database radio button above, and then click the OK button.

Page 22: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

The next screen that will appear is the “File New Database” Screen. This will ask you two very important questions.

Page 23: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

First, you must tell Access where you want your new database, by selecting the Folder in the “Save In:” box shown above.

Page 24: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Next, you must name your new database in the “File Name:” box below.Remember, if you plan on keeping your database, name it something other than DB1.mdb.

Page 25: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Finally, click on the “Create” Button below to create your named database in the folder that you selected.

Page 26: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

After clicking on the “Create” button, a new, blank, database will be created and open in the Database window.

Page 27: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

To create a new table, click on the Tables object tab on the left, then click on the New command button on the top. (see page AC 2.06 in your book)

Page 28: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Since we have two Subject Sheets, (Customer and Pets) we should create two tables, one for each, and name them accordingly.

Page 29: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Select the “Design View” option from the “New Table” dialog box and then click on the OK button.

Page 30: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

You are now ready to define your new table using the information from your subject sheet.

Page 31: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Customer Subject Sheet

Pets Subject Sheet

Fill in the required data for each table using the data on it’s respective subject sheet.

Page 32: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

When the two tables have been completed and saved, from the Menu Bar, selectTools / Analyze / Documenter.

Note: do this for each table.

Page 33: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Select the table, and click the OK button.

Page 34: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

This will produce a documentation report of the table in print preview mode. Look it over carefully, it gives you a lot of information regarding your table. (and it is what will be used to grade your lab)

Page 35: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationshipsRelationshipsRelationships

Next it’s time to create our relationship between the two tables.

Page 36: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

Remember or example about the customer and order tables?OneCustomer,hopefullymany orders?

Page 37: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

We can join the two tables together by joining the common field in theOne Side,[Customer].[CustomerNum]to the common field in theMany Side,[ Order].[CustomerNum].

Page 38: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

To do that, we start at the database window, select Tools from the Menu Bar and then select Relationships.

To do that, we start at the database window, select Tools from the Menu Bar and then select Relationships.

Page 39: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

From the resulting “Relationships” window, we select Relationships, and Show Table ...

Page 40: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

From the resulting “Show Table” window, we select Our “One Side” table (customers in this case), and then click “Add”.

From the resulting “Show Table” window, we select Our “One Side” table (customers in this case), and then click “Add”.

Page 41: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

We then select our “Many Side” table, (order in this case) and then again click “Add”.

We then select our “Many Side” table, (order in this case) and then again click “Add”.

Page 42: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

Then, simply click the Close Button.Then, simply click the Close Button.

Page 43: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

We will then be back to our Relationships window with the Customer and Order tables showing.

We will then be back to our Relationships window with the Customer and Order tables showing.

Page 44: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

To create a relationship (join), click on the common field (CustomerNum) in the One Side (left side), hold the button down, and drag to the common field (CustomerNum) in the Many Side (Order Table) and release the button.

To create a relationship (join), click on the common field (CustomerNum) in the One Side (left side), hold the button down, and drag to the common field (CustomerNum) in the Many Side (Order Table) and release the button.

Page 45: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

As soon as we release the mouse button on top of the CustomerNum field in the Order Table, the Edit Relationships window appears. This window first, gives us a chance to verify that we selected the correct fields and the ability to change them if we did not.

As soon as we release the mouse button on top of the CustomerNum field in the Order Table, the Edit Relationships window appears. This window first, gives us a chance to verify that we selected the correct fields and the ability to change them if we did not.

Page 46: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

We then can “Enforce Referential Integrity” if we so desire by simply clicking in the “Enforce Referential Integrity” check box.

We then can “Enforce Referential Integrity” if we so desire by simply clicking in the “Enforce Referential Integrity” check box.

Page 47: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Just what is Referential Integrity?

Simply put, using an example,if you have Referential Integrityenforced, when you enter acustomer number in your ordertable, and that customer number does not exist in your customer table, Access will will give you a message saying that you can not enter that customer number as it does not exist in the customer table.

Page 48: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

If we choose to “Enforce Referential Integrity” we then have two more options available to us, Cascade Update Related Fields and Cascade Delete Related Records.

If we choose to “Enforce Referential Integrity” we then have two more options available to us, Cascade Update Related Fields and Cascade Delete Related Records.

Page 49: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

Notice Access automatically determines the Relationship type.

Notice Access automatically determines the Relationship type.

Page 50: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

If you know that you have a one to many relationship, and this says you have a one-to-one relationship, check the fields above to make sure that you have selected the proper common field in both tables.

If you know that you have a one to many relationship, and this says you have a one-to-one relationship, check the fields above to make sure that you have selected the proper common field in both tables.

Page 51: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

The final step is to click on the Create Button.

The final step is to click on the Create Button.

Page 52: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

If we selected to “Enforce Referential Integrity” we will see a join line showing the one on the left and the infinity sign (many) on the right.

If we selected to “Enforce Referential Integrity” we will see a join line showing the one on the left and the infinity sign (many) on the right.

Page 53: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

If we selected Not to “Enforce Referential Integrity” . . .If we selected Not to “Enforce Referential Integrity” . . .

Page 54: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

we will see a plain join line without the one on the left and the infinity sign (many) on the right.

we will see a plain join line without the one on the left and the infinity sign (many) on the right.

Page 55: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

The final step is to select File and then Save from the Relationships window.

The final step is to select File and then Save from the Relationships window.

Page 56: Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select

RelationshipsRelationships

and then select File and Close.and then select File and Close.