Section DB DATABASE - Microsoft Access

Transcription

Section DB DATABASE - Microsoft Access
Section DB
DATABASE - Microsoft Access
About Access 2007
Access 2007 is part of Microsoft Office 2007. It is an important productivity tool for
business. Microsoft Access provides an inexpensive yet powerful database solution for
small-scale projects.
Databases are designed to offer an organized mechanism for storing, managing and
retrieving information. They do so through the use of tables. If you‘re familiar with
spreadsheets like Microsoft Excel, you‘re probably already accustomed to storing data in
tabular form. It‘s not much of a stretch to make the leap from spreadsheets to databases.
In this set of labs you will learn the basics of Microsoft Access 2007. You will learn
how to create database objects like table, queries, forms, and reports.
In preparation of completing this set of labs you should review the pages pertaining to
the ―Database and Information Management‖ chapter in the textbook.
1
Lab Assignments:
DB-1 Review a PowerPoint presentation on Access 2007
DB-2 Take a good look at Access 2007
DB-3 Create a database and database objects using Access templates
DB-4 Setup Tables- Inventory Database for WorldCraft
DB-5 Create Forms- Inventory Database for WorldCraft
DB-6 Create Queries- Inventory Database for WorldCraft
DB-7 Format and Print an Order Report- Inventory Database for WorldCraft
DB-8 Assessment
Folder:
133DB
Input:
Access_2007_Intro.ppsx Practice.accdb
Output:
Training Contacts.accdb
WorldCraft Inventory.accdb
Gateway Criteria: The next page of this section is an Assessment Hand-In Sheet which must be
turned in with all Access 2007 Labs. Your instructor will announce the “Possible Points”
associated with each lab assignment.
2
ASSESSMENT.
Name:
Date:
Lab
SECTION DB: DATABASE
_______________________________________________
_______________________ Section: _______________
Description / Check List
Possible Points
Earned Points
________
________
________
________
________
________
________
________
________
________
________
________
________
________
________
________
________
________
DB-1 Review a PowerPoint presentation
Open and view Access_2007_intro.ppsx
DB-2 Take a good look at Access 2007
Open Access
The Navigation Pane, the ribbon
Quick Access Toolbar, The Microsoft Office Button
Print (DB-2 #1): Access Print Screen
DB-3 Create a database and database objects
Create a database and a table
Create and format a form and report
Print (DB-3 #1): Print ―Contacts‖ table
Print (DB-3 #2): Print ―Training Tasks‖ table
Print (DB-3 #3): Print ―Training Task‖ form
Print (DB-3 #4): Print ―Contact AddressBook‖ report
Print (DB-3 #5): Print ―Contact Phone List‖ report
DB-4 Setup Tables
Setup tables
Print (DB-4 #1): Print relationships report
DB-5 Create Forms
Create a form
Print (DB-5 #1): Print ―WorldCraft Suppliers‖ table
Print (DB-5 #2): Print ―WorldCraft Products‖ table
DB-6 Create Queries
Create ―Asia Jewelry‖ query
Create ―Items to Order‖ query
Print (DB-6 #1): ―Asia Jewelry‖ query
Print (DB-6 #2): ―Items to Order‖ query
Print (DB-6 #3): modified ―Items to Order‖ query
DB-7 Format and Print an Order Report
Modify ―Items to Order‖ query.
Create and format ―WorldCraft Products‖ report
Print (DB-7 #1): Print the ―WorldCraft Products‖ report
DB-8 Assessment
Create and Print: One minute paper
TOTAL: Total of Points for All Assigned Labs
3
Lab DB-1
Take a good look at Access 2007 via a PowerPoint presentation.
1. Open and view the file ―Access_2007_intro.ppsx‖.
If this file is not in your 133DB folder on your USB drive then go to the CST site and
download it at:
http://www.delta.edu/cstfiles/CST-133/
On this webpage you will find it in the Tutorials section.
2. Preview the presentation.
3. Nothing needs to be printed as part of this lab (DB-1). Just sit back and relax as you take in
the information on the slides. You will practice in Access 2007 the concepts learned in this
presentation within labs DB-2 and DB-3.
4
Lab DB-2
Take a good look at Access 2007
Exercise 1: The Getting Started page
Open Access
1. Open Microsoft Access 2007 from the Start menu on your computer.
2. You see Getting Started with Microsoft Office Access.
3. Find the Template Categories pane on the left. Scan that list. Don't click anything yet.
4. Look at the middle of the page. Here you can create a blank database, or select a
template to download a pre-built database. Because you haven't clicked a template
category, you see Featured Online Templates.
5. Look farther down. Templates aren't the only things that you can get from Microsoft
Office Online. Scan that section to see what's available.
6. Look at the Open Recent Database pane on the right. It contains the name of
databases recently opened.
5
Exercise 2: The Navigation Pane
Pull down the Office button and Open the file called Practice.accdb form your
133DB folder. Close the Access Help window if it comes up.
If the file is not in your 133DB folder get it here:
http://www.delta.edu/cstfiles/CST-133/
Copy it to your 133DB folder.
Close the Access Help window if it comes up.
1. Look for the Navigation Pane on the left. If the pane is not open, you will see only its
title. To open the pane, press F11. (It‘s a toggle key)
2. Notice three tables, Book Details, Customer Details, Publisher Details, and Form called
Customer Details. These are objects in the data base. All objects will be accessed
through this Navigation Pane.
Navigation
Pane
6
3. At the top of the open pane is a downward-pointing triangle in a circle. Click it to see a
list of the views available in the Navigation Pane.
4. Scan through that list to get an idea of the choices you can make here. If you make
changes be sure to reset the two options back to Object Type and All Access Objects
as shown in the picture above.
Exercise 3: The Ribbon
1. In the Ribbon, click the Home tab if it is not already selected.
2. Here you see groups and commands for very frequent activities, such as View and
Paste, New and Delete, Find and Replace. Scan the groups and commands to get a
sense of what's here and how it's organized.
7
3. Now click the Create tab.
4. Here the groups are organized by database objects. Notice how quick it is to create a
new table, form, report, or query with the commands you see. Point at Form Design on
the ribbon within the Forms group to read what you can do with that command and
similar commands on this tab.
Exercise 4: The Quick Access Toolbar
1. Right-click Form Design.
8
2. Click Add to Quick Access Toolbar. Look at the Quick Access toolbar, and you'll see
the added command there.
3. Repeat this process with Table Design and Report Design to add them to the Quick
Access Toolbar.
4. On the Quick Access Toolbar, right-click any one of the commands you just added.
Click Remove from Quick Access Toolbar. This icon is now removed from the quick
access toolbar
Exercise 5: The Microsoft Office Button
1. Click the Microsoft Office Button
and scan the menu.
2. Note the Recent Documents list. You don't have to be on the Getting Started page to
view and use this list.
2
9
3. Point at menu commands to see which ones have submenus.
4. Click Access Options. Have a look around, and then close this window.
Keyboard shortcuts
Have you been wondering? Here's how to see them.
1. Press the ALT key. Look at the Ribbon. Those letters tell you the shortcuts. (If you
don't see letters, press ALT a bit more slowly.)
2. Press H. You have selected the Home tab.
3. Notice how many more letters you see.
4.
Press the Alt-Print-Screen keys on the keyboard to copy the Access window
to the clip board. Then open WordPad, paste the screen and print the document. With
a pen or pencil write DB-2 #1 on the printout. Place it in your folder.
5. If you're interested, press onward and keep exploring the shortcuts.
6. Close Access 2007 by clicking the Office button
then Exit Access.
6
10
Lab DB-3
Create a database and database objects
Exercise 1:
Exercise 2:
Exercise 3:
Exercise 4:
Exercise 5:
Create a database.
Create a table.
Enter data into tables
Create and format a form.
Create and format a report.
Exercise 1: Create a database
1. Open Microsoft Access 2007 from the Start menu on your computer.
Note: If you are continuing from DB-2 you will want to close out of Access as DB-2
suggests, then reopen it as stated in this step. If you do not do this, you will not see the
screen below.
2. In the Template Categories pane on the left, click Business.
3. You see the Business database templates in the middle of the page. Click Contacts.
3.
2.
4.
11
4.
On the right side of the page, you see information about the Contacts
database template. In the File Name box, name your database Training
Contacts.accdb. Then click the folder icon next to the name and be sure to select the
133DB folder on your USB drive, click ok. Then to save to your USB drive Click
Download (or Create Button). (If a Microsoft Office dialog box come up click
continue)
5. There's your database, with the Contact List form open. (If you see a window asking
you for feedback, close it.)
5
Exercise 2: Create a table
1. Press F11 to open the Navigation Pane. Click the downward-pointing triangle in a
circle at the top of that pane.
2. In the list that opens, click Object Type. These are the objects created for you in this
pre-built database.
12
3. Suppose you want a table in which you can list tasks that you're assigning to these
contacts. On the Ribbon, click the Create tab.
4. In the Tables group, click Table Templates. In the list of templates, click Tasks.
4
5. Access 2007 adds a table to the Training Contacts database. The table opens in
Datasheet view called Table1, and you can see from the field names that this table is
designed for tasks.
6. Above the field names is a tab for this new table, with the table's temporary name in it
(Table1). Right-click that tab, click Save, and name the table Training Tasks when
you save it. Click OK.
7. The name in the tab changes. Next to this tab is another for the Contact List form. You
can use either these tabs or the Navigation Pane to switch from one database object to
another.
8
8. At this point, if you notice a field List box you may close it by clicking on the close ―x‖
to the upper-right of the box. You may or may not see this.
13
9. Also, if you see a Security Warning like the one shown click the close ―x‖ to the far
right of the warning to close it.
10. Right click the Training Tasks tab then select close to close it.
11. Do the same for the Contact List tab to close it.
12. You should now have no open database objects and the Navigation Pane should be
open.
Exercise 3: Enter data into tables
1. At this point you have two Tables listed in the Navigation Pane, called Contacts and
Training Tasks. They currently have no data stored in them.
2. Let‘s input some data in the Contacts table. Open the table Contacts by double
clicking the table in the Navigation Pane. You should now see the Contacts tab open
showing the table.
3. Enter these two records listed below along with ONE additional friend (or made-up
person). Start by clicking on the Company name field and key “Delta College”, press
the tab key to move to the next field, then key the last name “Wyzkiewicz” and so on
till you get to the last field… Then start keying the second record (always tab past ID
because it is automatically generated and is the key field. It will always be a unique
number probably starting with 1, 2, 3, and so on…) Lastly key a third record of your
choice.
Field Name
First Record
ID:
(leave blank – tab past)
Company:
Delta College
Last Name:
Wyzkiewicz
First name:
Kevin
E-Mail Address:
[email protected]
Job Title:
Instructor
Business Phone:
(989) 686-9420
Home Phone:
(989) 456-7890
Mobile Phone:
(989) 123-4567
Fax Number:
(989) 456-7890
Address:
123 Circle Drive
(fields continued on next page)
Second Record
Third Record (yours)
(leave blank – tab past)
Northwood
Smith
Jane
[email protected]
Instructor
(555) 123-4567
(555) 686-1234
(555) 686-4321
(555) 123-4576
123 Square Drive
14
City:
State/Province:
Zip/Postal Code:
Country/Region:
Web Page
Notes:
Attachments:
Bay City
MI
48123
USA
www.delta.edu/kmwyzkie
(leave blank – tab past)
(leave blank – tab past)
Note: The webpage field
Midland
is clickable because the
MI
field is a hyperlink data
48321
type.
USA
(leave blank – tab past)
(leave blank – tab past)
(leave blank – tab past)
(Shown as Paper clip symbol)
4. When you are finished, the table Contacts is now populated with three records. It
should look something like this.
5. Print the table Contacts. Follow the steps below to prepare the document for printing.
a) Click the Office button
b) Mouse over Print.
c) Select Print Preview
d) In the page layout group within the ribbon select Landscape.
e) Click the Margins button then select Narrow.
f) Your table should now print on two pages.
g) Click the print button in the print group. Click the OK button in the print
dialog box.
h)
Put the printed document in your folder and label it DB-3 #1
i) In the Close Preview group click Close Print Preview to get out of the print
preview screen.
15
6. Now let‘s input some data in the Training Tasks table.
7. In the Navigation Pane double click the Training Tasks table to open it. Notice that it
is an empty table.
8. Just like the previous table, enter the two records listed below. Again the ID field is the
key field and does not need data entered. Just tab past it and an auto-number will be
assigned. Save time when entering the Priority and Status fields by entering the data
by using the pull-down arrow within the field instead of typing in these fields.
Field Name
First Record
Second Record
ID:
Title:
Priority:
Status:
% Complete:
Description:
Start Date:
Due Date:
Attachments:
(leave blank – tab past)
Office 2007 Training
(1) High
In Progress
50%
Office essentials
8/16/2007
8/27/2007
(leave blank – tab past)
(leave blank – tab past)
Windows Vista Training
(2) Normal
In Progress
25%
Vista Level 1
8/16/2007
1/1/2008
(leave blank – tab past)
(note: Attachments shown as a Paper clip symbol)
9. Print the table Training Tasks. Follow the steps below to prepare the document for
printing.
a) Click the Office button
b) Mouse over Print.
c) Select Print Preview
d) In the page layout group within the ribbon select Landscape.
e) Click the Margins button then select Narrow.
f) Your table should now print on one page.
g) Click the print button in the print group. Click the OK button in the print
dialog box.
h)
Put the printed document in your folder and label it DB-3 #2
i) In the Close Preview group click Close Print Preview to get out of the print
preview screen.
16
Exercise 4: Create and format a form
1. If the Training Tasks table is not open, click its tab or select it in the Navigation Pane
to open it. On the Ribbon, if the Create tab is not selected, click it.
2. In the Forms group, click Form. This will create a new form.
2
3. Easy, wasn't it? The new form has controls matching the fields in the table you based it
on. And the new form has the same name on its tab as the table you based it on.
4. You should also note that it uses the same data as the underlying table you based it on.
Any records you type in the Training Tasks table will show up in the Training Tasks
form.
5. Save the form the same way you saved the table (right-click the Training Tasks tab
then save), and then you will see Training Tasks under Forms in the Navigation Pane.
5
6. The new form is open in Layout view, and you can see Form Layout Tools on the
Ribbon, with the Format and Arrange tabs.
17
7. Click the Priority label within the Form. In the Font group, click Bold
and Font
Color
to make the label more visible (Red). You see the changes in the form as you
make them. Have a little more fun if you like.
7
8. Change over to Form view. Form view allows you to page through the records while
not allowing any editing of control objects. You do this by clicking on the View button.
But first, note the View button has two positions. Do not click the view button yet,
simply mouse over it now. Note the two positions, upper and lower positions.
Upper
Lower
9. The Upper button is a toggle between Form view and Layout view. These are the most
important views in this object.
10. But let‘s do this. Now click on the lower portion of the view button, you will see a pulldown menu. This shows all views available for an object. Select Form view from the
list.
10
18
11. Page through the two records in the Form by pressing the PageUP and PageDown keys
several times on your keyboard. You will move from field-to-field then to other
records in the form. Again, note the same data you typed in the table now comes
through the form.
12. Click the lower portion of the view button then select Design View from the pull down
menu. Design view allows you to change many graphical aspects of the form.
13. In the Form Header located at the top, Click to insert the word ―Important‖ before the
words ―Training Tasks‖. The new heading should say ―Important Training Tasks‖.
14. Click the lower portion of the view button and select Form view. You should be in
form view now. Look at the picture below. (note : depending on your screen size your
form data may not be in two columns as shown.)
15.
Print the form. Click the Office button
then Print. Click OK in the print
dialog box. It should fit on one page. Put the printed document in your folder and
label it DB-3 #3
19
Exercise 5: Create and format a report
1. Without closing the Training Tasks form, click the Create tab.
2. In the Reports group, click Report.
3. There it is, in Layout view, with the Report Layout Tools — the Format, Arrange,
and Page Setup tabs — visible on the Ribbon. And the object tab says Training
Tasks.
4
4. If you see a property sheet like the one above, it is not needed. You can close it by
clicking the close (x) button to the right. This property sheet is used to set properties of
each control on the report and is not needed at this point.
5. The form is currently in Layout view. It shows the actual printed page borders.
6. Save the Report by right-clicking the Training Tasks tab, then select save from the list.
Use the default name Training Tasks, click OK.
7. Note, in the Reports section of the Navigation Bar you will see the Training Tasks
report.
7
20
8. Open another report. Open the Contact Address Book report by double-clicking it the
Navigation Bar within the report section. This is a pre-formatted report that shows only
address information. You will notice that this report is alphabetized by last name with
some nice formatting. This is a good example showing you some of the features with
reports in Access.
9.
Print the report. Click the lower portion of the View button then select Print
Preview. You are now in print preview. Click the Print button at the top in the ribbon.
Put the printed one page document in your folder and label it
DB-3 #4.
10. Click the Close Print Preview button in the ribbon at the top.
11. Open another report. Open the Contact Phone List report by double-clicking it in the
Navigation Bar within the report section. This is a pre-formatted report showing only
contact phone numbers. Again, you will notice that the report is alphabetized. Both
reports are based on the data from the Contacts Table.
12.
Print the report. Click the lower portion of the View button then select Print
Preview. You are now in print preview. Click the Print button at the top in the ribbon.
Put the printed one page document in your folder and label it
DB-3 #5.
13. Click the Close Print Preview button in the ribbon at the top.
14. Close and save all objects in your database. Do this by right-clicking each tab and
select Close. Be sure to do this to each tab. If asked to save any work click Yes.
14
15. Click the Office button
then Exit Access button.
21
Lab DB-4
Setup Tables - Inventory Database for WorldCraft
To survive and compete in the business world, companies and organizations need fast and
reliable access to information about their products or services, customers, suppliers, and
personnel. Suppose you own an adventure tour company and decide to offer a special incentive
to all the clients who signed up for a tour in July of 2010. You could comb through all your files
to find the clients, or you could use a relational database program, such as Access, to locate,
organize, and print out a list of the clients who joined a tour in July 2010 or during any other
time period you choose. Relational database program stores information in related tables that
you can use to perform queries and find the information you need. To create a database, you
first identify categories – called fields – that describe and organize the contents of your database,
such as customers or inventory. Then you formulate queries or questions to retrieve the
information you need. In this next set of labs, you will learn how to use Microsoft Access to set
up a database and then ask questions to find the information you need to perform specific tasks.
Inventory Database for WorldCraft
Based in Dublin, Ireland, WorldCraft is a distributor of handcrafted items made by artisans from
all over the world. As the office manager, you need to create a database that includes the
Products table with records for 15 products and the Suppliers table with records for four
suppliers. To build the database you Set Up the Tables (DB-4 lab), Create Forms (DB-5 lab),
Create Queries (DB-6 lab), and then Format and Print an Order Report (DB-7 lab).
Set Up the Tables
You need to set up the Suppliers table as the ―one‖ table and the Products table as the ―many‖ table,
which means that one supplier can supply many products. This is the most common type of
relationship in a relational database.
1. Open Microsoft Office Access 2007 from the start menu, click Blank database, click the Browse
button
, navigate to the 133DB folder on your USB drive, type WorldCraft Inventory in the File
name text box then click Create.
1
A new database is now created for you.
22
2. Create a new table called ―WorldCraft Suppliers‖ by doing the following:
a. Click the View button in the Views group
b. Type WorldCraft Suppliers
c. Then press [Enter] key or click OK.
3. Set up three field names in the newly created table by doing the following:
a. Replace ID with Supplier ID within the Field Name column, then press the down arrow
key to move the insertion point to the line below Supplier ID.
b. Type Supplier Name, then press the down arrow key to move down
c. Type Email Address on the third row, press [Tab] key to move to the Data Type column,
click the Data Type list arrow
, select Hyperlink.
d. Close the table, by clicking the Close ‗WorldCraft Suppliers‘ button, this is the X (close
button) to the far right of the tab.
e. Click yes to save the table.
4. Create a new table called ―WorldCraft Products‖ by doing the following:
a. Click the Create tab
b. Click Table in the Tables group
c. Click the View button in the Views group, then type WorldCraft Products as the table
name, press [Enter] key or click OK, type Product ID, press the down arrow key
d. then enter the remaining field names as shown below:
4d
5. Create a Lookup by completing the following steps: (A lookup allows a user to select items
from a defined list. This minimizes data entry errors.)
a. Click the Region Data Type list arrow
b. Click Lookup Wizard
c. The lookup Wizard will appear.
d. Click the “I will type in the values
5a
23
that I want option” button
e. Click Next
f. Press [Tab] key, type Africa, press the down arrow key
g. Enter the remaining regions as shown below:
h. Then click next then finish after typing the remaining regions
5g
6. Create another Lookup by completing the following steps:
a. Click the Category Data Type list arrow
b. Click Lookup Wizard
c. The lookup Wizard will appear.
d. Click the “I will type in the values
that I want option” button
e. Click Next
f. Create the list of lookup values shown
below:
g. Then click next then finish after typing.
6a
6f
24
7. Create an additional Lookup, but the information from this lookup will come from a table. Do
this by completing the following steps:
a. Click the Supplier Name data Type list arrow
b. Select Lookup Wizard, then click Next to accept that you want the values to come from
an existing table.
c. Click Next, click Supplier Name in the Available Fields section.
d. Click the Select Single Field button
, this will move Supplier Name over to the
Selected Fields section.
e. Click next, click next, click next, click Finish, then click Yes to save the table.
8. Assign more data types to the fields in the WorldCraft Products table:
a. Click the Units in Stock data Type list arrow
b. Select Number
c. Click the Unit Price Data Type list arrow
d. Select Currency
e. Click Currency in the Field Properties section below
f. Click the list arrow for it, then select the Euro currency style. (€)
9. Close and save the table by completing the following steps:
a. Click the save button
in the Quick Access Toolbar.
b. Close the table, by clicking the X (close button) to the far right of the WorldCraft
Products tab.
10. When you created the last Lookup in step 7 above Access created a relationship between the
two tables WorldCraft Supplies and WorldCraft Products. These relationships can control how and
what data can be entered into your database. You can view relationships within Access by
completing the following steps:
a. Click the Database Tools tab.
b. Click the Relationships button within the Show/Hide group.
c. Double-click the line between the two tables (be sure to double-click on the line)
d. Click the Enforce Referential Integrity check box. Then click OK.
e. Compare your Relationships with the one below.
The Infinity sign represents the
―many‖ side: One Supplier can
supply many Products
25
11.
Print the relationship diagram by completing the following steps:
a. Click the Relationship Report button within the Tools group.
b. Click the Print button within the Print group. Click OK. Place the print out in you folder
and label it DB-4 #1.
c. close the relationship report by clicking the Close button (X) to the far right of the
Relationships for WorldCraft Inventory tab. If asked to save click No.
d. Close the relationship window by clicking the close button (X) to the far right of the tab.
26
Lab DB-5
Create Forms - Inventory Database for WorldCraft
You need to create forms into which you can enter the data for the WorldCraft Suppliers table
and the WorldCraft Products table.
1. Open the WorldCraft Inventory database created in DB-4 if it is not open already. If you see
a ―Security Warning‖ when opening, click the options… button then select Enable this Content,
click OK. Doing this will remove the warning. You may not see this Warning in the Delta
computer labs.
2. Create a form based on the WorldCraft Suppliers table by completing the following steps:
a. Click WorldCraft Suppliers: Table within the Navigation pane.
b. Click the Create tab
c. Click the Form button in the Forms group. A form will be created.
d. Change the format by clicking the More button
in the AutoFormat group, then select
the Trek format. Look at the screen tips as you mouse over the formats.
3. Enter three records into the newly created Form:
a. Click the View button in the Views group, press [Tab] key, type America Arts in the
Supplier Name field.
b. press [Tab] until the insertion point appears after Email Address, then type
[email protected] in the email field.
c. Press [Tab] twice, type Kenya Crafts in the Supplier Name field
d. In the Email Address field enter [email protected] as the email address.
e. Press [Tab] twice, type Rainforest Cooperative with the email address
[email protected] , then press the [Tab] key.
4. Close and save the form by completing the following steps:
a. Click the close button (X) to the far right of the WorldCraft Suppliers form tab.
b. Click Yes to save the form. In the save as dialog box keep the default name and click OK.
5. Create another form based on the WorldCraft Products table by completing the following
steps:
a. Click WorldCraft Products: Table within the Navigation pane.
b. Click the Create tab
27
c. Click the Form button in the Forms group. A form will be created.
d. Change the format by clicking the More button
the Trek format.
in the AutoFormat group, then select
e. Click the ProductID label, click the Bold button
below.
in the Font group. Look at figure
f. Double-click the Format Painter button
labels to apply bold.
in the Font group, then click each of the
5f
5e
6. Enter records into the newly created Form by completing the following steps:
a. Click the View button in the Views group, press [Tab] key
b. Type Carved Polar Bear, press [Tab]
c. Type N to show North American, press [Tab]
d. Type A to show Art, press [Tab]
e. Type A to show America Arts, press [Tab]
f. Type 15, press [Tab]
g. Type 250, press [Enter]
h. Click the Previous record button
toward the bottom near the status bar to move back
to record 1. Compare your Form showing record 1 with the graphic below.
28
Notice how you minimize typing time when you create lookup fields for as many fields as
possible.
7. Enter more records in to the Form:
a. Click the Next record button
to start a new record, press [Tab]
b. Type Coral Pendant, press [Tab]
c. Type As to select Asia, press [Tab]
d. Type J for Jewelry, then press [Tab].
The supplier you want is not listed. Often when you create a database, you need to go back and
add data to related tables. So let‘s close this Form and add a needed record to one of your tables.
e. Close the database by clicking the close button (X) to the far right of the WorldCraft
Products Form tab.
f. If prompted to save, use the default name and click OK.
g. Double click WorldCraft Suppliers in the Navigation bar to show the WorldCraft
Suppliers form.
h. Click the New button in the records group, press [Tab]
i. Type Far East Imports for the Suppliers Name and [email protected] as the
Email Address.
j. Close (X) the Form.
8. Enter the rest of the records in the WorldCraft Products form by completing the following
steps:
a. Double click WorldCraft Products within the Navigation bar to show the WorldCraft
Products form.
b. Go to record 2 by clicking the next record button
.
c. Complete the rest of the record by entering Far East Imports for the Supplier Name, 9
for the Units in Stock, and 220 for the Unit Price, press [Enter]
29
d. Enter data for records 3 to 15 as shown in the table below (on the next page).
e. Then close the final Form.
9. Print the data by completing the following steps:
a. Open the WorldCraft Suppliers:Table by double-clicking it in the Navigation pane.
b. Select all fields pressing the (Ctrl-a) keys on the keyboard. All fields will be selected.
c. Point to one of the borders within the field heading until the pointer turns into a double
headed arrow, then double click on the border. The fields should all size to fit the largest
entry. If that didn‘t work drag each border and size to fit each field so no data is cut off.
9c
d.
Print the table by clicking the Office button then select Print, click OK.
e. Put the printed document in your folder and label it DB-5 #1. Place it in your folder.
f. Close the table. If you are asked to save it click Yes.
g. Open the WorldCraft Products:Table by double-clicking it in the Navigation pane.
h. Make sure no data is cut off.
i. Click the Office button then go to Print then Print Preview.
30
j. Change to Landscape orientation by clicking on the Landscape button within the Page
layout group.
k.
Print the table by clicking the Print button within the Print group. Label it DB-5
#2. Place it in your folder. Close the table. If you are asked to save it click Yes.
31
Lab DB-6
Create Queries - Inventory Database for WorldCraft
We will now create two queries in the WorldCraft database to extract specific data.
First, you view the records that relate to each of the four suppliers, and then you use the two
tables that you‘ve created to ask two questions, called queries. You create a query to find out
how many products you have from Asia in the Art category, then you create a query to determine
the number of products with fewer than 10 items in the inventory.
1. Open the WorldCraft Inventory database if it is not open already. If you see a ―Security
Warning‖ when opening, click the options… button then select Enable this Content, click OK.
You may not see this Warning in the Delta computer labs.
2. Double click the WorldCraft Suppliers to open the form, then click the lower Next record button
several times to view all the records associated with each of the four suppliers. See figure.
2
As a result of the one-to-many relationship you created between the Suppliers table and the
Products table, you can create queries that list all the products purchased from a specific supplier.
3. After viewing all four suppliers and there associated products close the WorldCraft Suppliers
form.
32
4. Now let‘s create our first query by completing the following steps:
a. Click the Create tab
b. Click the Query Wizard button in the Other group, then click OK to accept Simple Query
Wizard.
c. Verify that Table:WorldCraft Products is selected in the Tables/Queries text box
d. Click the Select All Fields button
to select all the fields in the Products table
e. Click Next
f. Click Next to accept a Detail query
g. Select the contents of the Title text box, press the delete key to delete the current text.
Type Asia Jewelry as the query name.
h. Click the Modify the query design option button, then click Finish. The query is now in
Design view. See figure below.
4i
4j
i. Click the [Region] Criteria cell, type Asia as shown in figure above. Access automatically
inserts quotations ―‖ around the criteria.
j. Click the [Category] Criteria cell, type Jewelry as shown in figure above.
k. Click the Run button in the Results group to display a datasheet showing the results of the
query. See figure below.
Note: The results show all Jewelry products in Asia.
33
5. Print the query results by completing the following steps:
a. Click the Office button
b. Select Print then slide over to Print Preview
c. Click the next page button
to see the next page. Note, in the current orientation it
will not fit on one sheet.
d. Click the Landscape button in the Page layout group.
e.
Click the Print button in the Print group. Click Ok . Place the printed results in
your folder and label it DB-6 #1.
6. Close the query by clicking the close button (X) to the far right of the Asia Jewelry tab, then
click Yes to save the query. (Note: the newly created Asia Jewelry query icon in the Navigation
pane.)
7. Let‘s create another query by completing the following steps:
a. Click the Create tab
b. Click the Query Wizard button in the Other group
c. Click OK to select the ―Simple Query Wizard‖
d. Select the Table: WorldCraft Products within the Tables/Queries pull-down menu.
e. Add all the fields by clicking the add all fields button
, click Next.
f. Click Next
g. Change the title of the query to Items to Order, and click the Modify the query design
option button.
h. Click Finish. You should now see the query in Design view.
i. Click [Units In Stock] Criteria cell, type <10. This is similar to steps 4i and 4j above.
j. Click the Run button in the Results group to show the results of the query.
k. A datasheet listing all the products with fewer than 10 units in stock appears. These are
the items that you need to order.
8. Print the query results by completing the following steps:
a. Click the Office button
b. Select Print then slide over to Print Preview
c. Click the next page button
to see the next page. Note, in the current orientation it
will not fit on one sheet.
d. Click the Landscape button in the Page layout group.
e.
Click the Print button in the Print group. Click Ok . Place the printed results in
your folder and label it DB-6 #2.
f. Click the Close Print Preview button in the Close Preview group. Do not close the query.
34
g. Click the save button in the quick access toolbar to save the query.
9. Let‘s add a calculated field to the query by completing the following steps: (calculated fields are
never stored in tables. They are always calculated when needed within queries.)
a. Click the View button to change back to Design view.
b. Click in the blank cell to the right of [Unit Price]
9b
c. Click Builder button
in the Query Setup group.
d. Type the formula: Units to Order: (10-[Units in Stock]) in the Expression builder towards
the top of the window. Double check that all characters are typed correctly. If one character
is miss-typed the calculations will be incorrect.
Formula: Units to Order:(10-[Units in Stock])
The first part ―Units to Order:‖ is the label
portion of the formula. It shows up as the field
heading when the query is run.
9d
This formula calculates how many units you
need to order if fewer than 10 items are in
stock. For example, if 8 units are in stock, you
need to order 2 units so that you always have at
least 10 units.
e. Click OK to except the typed expression. The expression is now entered in the column.
f. View the results by clicking the Run button. Review the new calculated field.
g. Change back to Design view by clicking the View button in the Views group.
10. Let‘s add another calculated field in the query by completing the following steps:
a. Click in the blank cell to the right of Units to Order. (See figure below).
b. This time we will not use the Expression builder to enter the formula, instead we will type
in the formula directly into the cell. The expression builder is optional but can minimize on
typing errors by creating formulas by clicking on objects.
35
c. Type: Total:[Units to Order]*[Unit Price]
d. Because of the small text area, as you type the text will scroll off the screen. Be sure to
type it correctly.
10a
10c.
Formula: Total: [Units to Order]*[Unit Price]
―Total‖ will be the field heading.
This Formula multiples ―Units to Order‖ by the ―Unit
Price‖ calculating the amount needed for each item to
be ordered.
e. View the results by clicking the Run button. Review the second calculated field.
f. Observe the Total field, check to see if the calculations are correct. Note the dollar unit
sign ($). We will need to change this to euros (€).
g. Change back to Design view by clicking the view button.
h. Click anywhere in the Total column, then right-click, select Properties…
i. In the property sheet, select the Format pull-down then select Euro. Close the Property
Sheet by clicking the close box (X).
j. View the query results by clicking the Run button. Confirm the Euro sign replaced the
dollar sign.
11. Print the query results by completing the following steps:
a. Click the Office button
b. Select Print then slide over to Print Preview
c. Click the next page button
to see the next page. Note that even in Landscape
orientation it will not fit on one page.
d.
Click the Print button in the Print group. Click Ok . Place the printed results in
your folder and label them DB-6 #3.
e. Click the Close Print Preview button in the Close Preview group.
f. Close the query results datasheet.
g. Be sure to save the query if asked.
36
Lab DB-7
Format and Print an Order Report - Inventory Database for WorldCraft
The primary purpose for reports is to control what data appears on a printed page. In this lab, you
will learn how to create a report using the Report Wizard. You will also learn how to format and
customize a report with options in the Report Layout Tools.
Before creating the report you will modify the ―Items to Order‖ query so it includes two fields
from the Suppliers table; then format and print an Order report.
1. Open the WorldCraft Inventory database if it is not open already. If you see a ―Security
Warning‖ when opening, click the options… button then select Enable this Content, click OK.
You may not see this Warning in the Delta computer labs.
2. Modify the ―Items to Order‖ query to include two additional fields from the Suppliers table by
completing the following steps:
a. Double-click Items to Order query within the Navigation Pane to open it.
b. Switch to Design view by clicking the View button
c. Click the Show Table button in the Query Setup group,
d. Click WorldCraft Suppliers, click Add, click Close
e. Scroll to the right to view the next available blank column in the grid
f. Double-click Supplier Name in the WorldCraft Suppliers table to add it to the grid.
g. Double-click Email Address in the WorldCraft Suppliers table to add it to the grid.
h. Click the Run button to display the query results. Note the newly added fields in the
results.
i. Change back to Design view by clicking the View button.
j. Sort the query by SupplierName in ascending order. To do this, click SupplierName
Sort cell list arrow, click Ascending
2j
37
k. Click Run button.
The list of 10 products to order includes the names and e-mail addresses of the suppliers
to contact sorted by supplier name.
l. Save the query by clicking the disk icon
in the Quick Access Toolbar. Note an
additional Items to Order query icon in the Navigation bar under WorldCraft Suppliers.
This is because both tables now are included in the query results.
m. Close the query by clicking the close button (X) to the far right of the Items to Order
tab. Be sure not to close Access.
3. Create the report by completing the following steps:
a. Click the Create tab
b. Click the Report Wizard button in the Reports group, the Report Wizard dialog box
opens.
c. Select and move the following fields from the Query:Items to Order available fields
side to the selected fields side. Do this by clicking the field to be moved, then click the
button to move it to the other side. Move these fields in this order: Product Name,
Region, Category, Units in Stock, Units to Order, Unit Price, Total, WorldCraft
Suppliers.Suppliers Name, and Email Address. See figure below to see finished results
after completing this step.
d. Click Next
e. Click Next
38
f. Click WorldCraft Suppliers.Supplier Name in the list of groupings then click the
button.
g. Click Next
h. Click Next
i. Click the Landscape option button, then click Next
j. Select the Trek report style, click Next.
k. Then click Finish to preview the report.
The report is shown in Print Preview. Too much space appears between some of the fields.
l. Click the Close Print Preview button in the Close Preview group this view is called
Design view. We will not use this view.
m. Click the View list arrow (lower portion of the view button) in the Views group, select
Layout View. This view is new for Access 2007. We will use this view to make changes
in the design of the report.
4. In the following step you will make changes to the design and layout of the report:
a. You can change your mind in the report formatting process and remove or add fields.
Click Region within the report, then press the Delete key on the keyboard to remove it.
4a
b. Click [WorldCraft Suppliers].[Supplier Name] within the report.
4b
c. Simplify this field heading to say ―Supplier‖. Do this by Double-clicking it anywhere
inside the box then remove all text, then type Supplier.
39
d. Click American Arts within the report under the newly created Supplier heading.
Increase the font size to 14 pt. This will increase the font size for all data in the
column.
e. Click Total heading within the report. Center in by clicking the Center button
the font group.
in
f. Click the WorldCraft Products title in the top of the report and add your first and last
name. (Example: WorldCraft Products – Your Name)
g. Increase the Font size of this title ―WorldCraft Products – Your Name‖ to 24 pt.
h. Lastly, adjust the column widths so all data is visible and columns are attractively
spaced with no data cut off. After adjusting, the report should fit on one sheet in
Landscape orientation. The gray dashed lines show page edges. See figure below.
5. Print the report by completing the following steps:
a. Change to Print Preview by clicking the View button list arrow (bottom portion of the
View button in the Views group), select Print Preview.
b. Click the Zoom list arrow within the Zoom group. Select 75%
c.
Click the Print button in the Print group, click OK. Place your one page
printout in your folder and label it DB-7 #1.
d. Save the report by clicking the disk icon
in the Quick Access Toolbar.
40
e. Close the report by clicking the close button (X) to the far right of the WorldCraft
Products tab.
f. Close Access by clicking the Office button then click Exit Access.
41
Lab DB-8
Assessment
The 1 Minute Paper
Use the WordPad or Word application to write a simple and quick recap of your thoughts
concerning the DB set of labs. Place your name and ―Database lab Feedback at the top‖ – use
12-point.
Please answer the following questions:
1. Did you understand the directions?
2. Did you complete the labs in a reasonable length of time?
3. Are you interested in learning more about Access?
4. How can we improve this set of labs?
Print your document and label it DB-8. Place it in your folder.
42