0% found this document useful (0 votes)
23 views69 pages

Polytechnic University of The Philippines

Uploaded by

jeremy ian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views69 pages

Polytechnic University of The Philippines

Uploaded by

jeremy ian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Republic of the Philippines

POLYTECHNIC UNIVERSITY OF THE PHILIPPINES


Parañaque Campus

INFORMATION MANAGEMENT

MS Access
Laboratory Manual

BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY 2-1

SUBMITTED BY:

Ardina, John Marco


Dazo, Kevin
Dizon, Mark Jasper
Esteban, Ana Marie
Limson, Jeremy Ian
Ogabang, JB Rachine
Orticio, Andrea Mariz
Salvador, Louise Andrei
INTRODUCTION TO MICROSOFT ACCESS: WHAT IS A DATABASE?

EXERCISE 1

Open the CUSTOMERS Database.

1. Delete the record for Cathy Booth.


2. Change Maurice Haas’ total amount of purchases to $59,500.
3. Use the Replace command to change all occurrences of "Oyster Bay" to "Islip".
4. Open the NY CUSTOMERS Report as shown in the following figure after making
the changes in parts (1) through (3).
EXERCISE 2

Open the Bookstore database and modify the database to accommodate the following:

1. Add the book Exploring Microsoft Office 2000 Vol II by


Robert Grauer, published in January 01,1999 by Prentice Hall, selling for ₱
2603.22.
2. Change the price of The Magical Cemi to ₱ 1732.59.
3. Delete The Science of Grapevines Third Edition Book.
4. Open the All Books Report as shown in the following figure after these changes
have been made.

EXERCISE 3

Open the Super Bowl database.

1. On the Objects bar, double-click the Super Bowl table to open it in the
Datasheet view.
2. The data has to be Sorted. Click anywhere in the Year field, then click
the Descending Sort button to display the most recent Super Bowl first.

3. Select the Winner in any year that the AFC won. Click the Filter by Selection
button to display only those records (the years in which the AFC won the game).

4. Click the Remove Filter button. Select any year in which the NFC won, then
click the Filter by Selection button to display the years in which the NFC won.
Remove the filter.
5. Create one additional filter (for example, the years in which your favorite team
won the big game).

CREATING A TABLE

EXERCISE 4
STEP 1 : Create a New Database
● Click the Start button to display the Start menu. Click the Programs menu, then
click Microsoft Access to start the program.
● You should see the Microsoft Access dialog box as shown on the left side. Click
the option button to create a new database using a Blank Access Database.
Click OK.
● Click the drop-down arrow on the Save in: list box. Click the appropriate drive
(drive C or drive A), depending on the location of your data. Double click the
Exploring Access folder to make it the active folder.
● Click in the File Name text box and drag to select db1. Type My First Database
as the name of the database you will create. Click the Create button.
STEP 2 : Create the Table
● The database window for My First Database should appear on your monitor. The
Tables button is selected by default.
● Click and drag an edge or border of the Database window to change its size.
Click and drag the title bar of the Database window to change its position on the
desktop.
● Click the New button to display the New Table dialog box. Click (select) Table
Wizard in the New Table dialog box, then click OK to start the Table Wizard.

STEP 3: The Table Wizard


● If necessary, click the Business Option button. Click the down arrow on the
Sample Tables list box to scroll through the available business tables. Click
(select) Students within the list of sample tables. The tables are not in
alphabetical order, and the Students table is found near the very bottom of the
list.
● The StudentID field is already selected in the Sample Fields list box. Click the >
button to enter this field in the list of fields for the new table.
● Enter the additional fields for the new table by selecting the field and clicking the
> button. The fields to enter are: FirstName, LastName, Address, City, and
StateOrProvince.
● Click the Rename Field command button after the adding the StateOrProvince
field to display the Rename Field dialog box. Enter State to shorten the name of
this field. Click OK.
● Add PostalCode and PhoneNumber as the last two fields in the table. Click the
Next command button when you have entered all the fields.
STEP 4 :
● The next screen in the Table Wizard asks you to name the table and determine
the primary
key.
● Accept the Wizard’s suggestion of Students as the name of the table.
● Make sure that the option button Yes, set a primary key for me is selected.
● Click the Next command button to accept both of these options.
● The final screen in the Table Wizard asks you what to do next.
● Click the option button to Modify the table design.
● Click the Finish command button. The Students table should appear on your
monitor. Pull down the File menu and click Save to save the table.

STEP 5 : Add the Additional Fields


● Click the cell immediately below the last field in the table (PhoneNumber). Type
BirthDate.
● Press the Tab key to move to the Data Type column. Click the down arrow on the
drop-down list box. Click Date/Time.
● Add the remaining fields to the Students table. Add Gender as a text field. Add
Credits as a Number field. Add Points as a Number field.

STEP 6 : Change the Primary Key


● Point to the first field in the table and click the right mouse button to display the
shortcut menu. Click Insert Rows.
● Click the Field Name column in the newly inserted row. Type SSN (for social
security number) as the name of the new field. Press enter. The data type will be
set to Text by default.
● Click the Required box in the Properties area. Click the drop-down arrow and
select Yes.
● Click in the Field Name column for SSN, then
click the Primary Key button on the Table
Design toolbar to change the primary key to
social security number. The primary key symbol
has moved to SSN.
● Point to the StudentID field in the second row.
Click the right mouse button to display the
shortcut menu. Click Delete Rows to remove
this field from the table definition. Save the
table.

STEP 7 : Add an Input Mask


● Click the Field selector column for SSN. Click the Input Mask box in the
Properties area.
● Click the Build button to display the Input Mask Wizard. Click Yes if asked
whether to save the table. Click Social Security Number in the Input Mask Wizard
dialog box.
● Click the Try It text box and enter a social security number to see how the mask
works. If necessary, press the left arrow key until you are at the beginning of the
text box, then enter a social security number (digits only). Click the Finish
command button to accept the input mask.
● Click the field selector column for BirthDate, then follow the steps detailed above
to add an input mask. (Choose the Short Date format.) Click Yes if asked whether
to save the table. Save the table.

STEP 8 : Change the Field Properties


● Click the field selector column for the FirstName field:
• Click the Field Size box in the Properties area and change the field size
to 25.
• Click the Required box in the Properties area. Click the drop-down arrow
and select Yes.

● Click the field selector column for the LastName field:


• Click the Field Size box in the Properties area and change the field size
to 25.
• Click the Required box in the Properties area. Click the drop-down arrow
and select Yes.
● Click the field selector column for the State field:
• Click the Field Size box in the Properties area and change the field size
to 2.
• Click the Format box in the Properties area. Type a > sign to display the
data in uppercase.

● Click the field selector column for the Credits field:


• Click the Field Size box in the Properties area, click the drop-down arrow
to display the available field sizes, then click Integer.
• Click the Default Value box in the Properties area. Delete the 0.

● Click the field selector column for the Points field:


• Click the Field Size box in the Properties area, click the drop-down arrow
to display the available field sizes, then click Integer.
• Click the Default Value box in the Properties area. Delete the 0. Save the
table.

STEP 9 : Add a Validation Rule


● Click the field selector column for the Gender field. Click the Field Size box and
change the field size to 1.
● Click the Format box in the Properties area. Type a > sign to display the data
entered in uppercase.
● Click the Validation Rule box. Type “M” or “F” to accept only these values on data
entry.
● Click the Validation Text box. Type You must specify M or F. Save the table.
STEP 10 : The Datasheet View
● Pull down the View menu and click Datasheet View to change to the Datasheet
view.
● The insertion point is automatically set to the first field of the first record.
● Type 111111111 to enter the social security number for the first record. (The input
mask will appear as soon as you enter the first digit.)
● Press the Tab key, the right arrow key, or the enter key to move to the FirstName
field. Enter the data for Brad Pitt and make up data for other fields.
● Scrolling takes place automatically as you move within the record.
● Enter data for the two other students, but enter deliberately invalid data to
experiment with the validation capabilities built into Access. Save the table.

CREATING A FORM
EXERCISE 5
STEP 1 : Open the Existing Database & The Form Wizard
● Start Access. Select My First Database from the list of recently opened
databases, then click OK.
● Click the Forms button in the Database window. Click the New command button
to display the New Form dialog box.
● Click Form Wizard in the list box. Click the drop-down arrow to display the
available tables and queries in the database on which the form can be based.
● You should see the dialog box which displays all of the fields in the Students
table. Click the >> button to enter all of the fields in the table on the form. Click
the Next command button.
● The Columnar layout is already selected. Click the Next command button.
● Click Industrial as the style for your form. Click the Next command button.
● The Form Wizard asks you for the title of the form and what you want to do next.
• The Form Wizard suggests Students as the title of the form. Keep this entry.
• Click the option button to Modify the form’s design.
● Click the Finish command button to display the form in Design view.
STEP 3 : Move the Controls
● If necessary, click the Maximize button so that the form takes the entire screen.
The Form Wizard has arranged the controls in columnar format, but you need to
rearrange the controls.
● Click the LastName control to select the control and display the sizing handles.
(Be sure to select the text box and not the attached label.) Click and drag the
border of the control (the pointer changes to a hand) so that the LastName
control is on the same line control. Use the grid to space and align the controls.
● Click and drag the Address control under as the FirstName the FirstName
control. Click and drag the border of the form to 18 cm. so that the City, State,
and PostalCode controls will fit on the same line.
● Click and drag the State control so that it is next to the City control, then click and
drag the PostalCode control so that it is on the same line as the other two. Press
and hold the Shift key as you click the City, State, and PostalCode controls to
select all three, then click and drag the selected controls under the Address
control.
● Place the controls for PhoneNumber, BirthDate, and Gender on the same line .
Move the controls under same line City, State, and PostalCode. Place the
controls for Credits and Points on the . Move the controls under PhoneNumber.
● Fine-tune the form as necessary to make it more attractive. Move LastName to
align it with State. Also you may make the SSN and PostalCode controls smaller.
Pull down the File menu and click Save to save the form.
STEP 4 : Add a Calculated Control (GPA)
● Click the Text box tool in the Toolbox. The mouse pointer changes to a tiny
crosshair with a text box attached.
● Click and drag in the form where you want the text box (the GPA control) to go.
Release the mouse. You will see an Unbound control and an attached label
containing a field number ( for ex. Text24).
● Click in the text box of the control. The word Unbound will disappear, and you
can enter an expression = [Points]/[Credits] to calculate a student’s GPA. Do not
be concerned if you cannot see the entire entry as scrolling will take place as
necessary. You must enter the field names exactly as they were defined in the
table.
● Select the attached label (Text24), then click and drag to select the text in the
attached label. Type GPA as the label for this control and press enter. Size the
text box appropriately for GPA. Size the bound control as well. Move either
control as necessary. Click the Save button.

STEP 5 : Modify the Property Sheet


● Point to the GPA control and click the right mouse button to display a shortcut
menu. Click Properties to display the Properties dialog box.
● If necessary, click the All tab. The Control Source text box contains the entry =
[Points]/[Credits] from the preceding step.
● Click the Name text box. Replace the original name (Text24) with GPA. Click the
Format box. Click the drop-down arrow, then scroll until you can select Fixed.
Click the box for the Decimal Places. Click the drop-down arrow and select 2 as
the number of decimal places.
● Close the Properties dialog box to accept these settings and return to the form.
STEP 6 : Create the Form Header
● Click and drag the line separating the border of the Form Header and Detail to
provide space for a header.
● Click the Label tool on the Toolbox toolbar (the mouse pointer changes to a cross
hair combined with the letter A). Click and drag the mouse pointer to create a
label within the header. The insertion point is automatically positioned within the
label.
● Type Student Information Form. Do not be concerned about the size or alignment
of the text at this time. Click outside the label when you have completed the
entry, then click the control to select it.
● Click the drop-down arrow on the Font Size list box on the Formatting toolbar.
Click 18. The size of the text changes to the larger point size.
● Click the drop-down arrow next to the Special Effect button on the Formatting
toolbar to display the available effects. Click the Raised button to highlight the
label. Click outside the label to deselect it. Click the Save button to save the
form.

STEP 7 : Add the Date


● Click the Textbox tool on the Toolbox toolbar. The mouse pointer changes to a
tiny crosshair with a text box attached. Click and drag in the form where you want
the text box for the date, then release the mouse.
● You will see an Unbound control and the attached label containing a number
(Text27). Click in the text box, and the word Unbound will disappear. Type =Date(
). Click the attached label. Press the Del key to delete the label.
STEP 8 : The Form View
● Click the View button to switch to the Form view. You will see the first record in
the table that was created in the previous exercise.
● Click the New Record button to move to the end of the table to enter a new
record. Enter data for yourself. The record selector symbol changes to a pencil
as you begin to enter data.
● Press the Tab key to move from one field to the next within the form. All
properties (masks and validation) have been inherited from the Students table
created in the first exercise.
● Pull down the File menu and Close the form. Click Yes if asked to save the
changes to the form. Pull down the File menu and Close the database.
CREATING A MORE SOPHISTICATED FORM
EXERCISE 6

STEP 1 : Modify the Table


● Open My First Database that we have been using throughout the previous works.
If necessary, click the Tables button in the Database window. The Students table
is already selected since that is the only table in the database.
● Click the Design command button to open the table in Design view. Maximize the
window.
● Click the Field Name box under Quality Points. Enter FinancialAid as the name of
the new field. Press the tab, or right arrow key to move to the Data Type column.
Specify the Type as a Yes/No field.
● Click the Field Name box on the next row. Type Campus (There is no need to
specify the Data Type since Text is the default).
● Press the down arrow key to move to the Field Name box on the next row. Enter
Major. Press the tab, or right arrow key to move to the Data Type column. Click
the drop-down arrow to display the list of data types. Click Lookup Wizard.

STEP 2 : The Lookup Wizard


● The first screen in the Lookup Wizard asks how you want to look up the data.
Click the option button that indicates I will type in the values that I want. Click
Next.
● The Number of columns is already entered as one. Click the text box to enter the
first major. Type Business. Press Tab or down arrow key ( do not press the enter
key) to enter the next major.
● Complete the entries as Communication, Education, Engineering, Liberal Arts.
Click Next. The Wizard asks for a label to identify the column (Major is already
entered). Click Finish to exit the Wizard and return to the Design View. Click the
Save button to save the table. Close the table.

STEP 3 : Add the New Controls


● Click the Forms button in the Database window. If necessary, click the Students
form to select it.
● Click the Design command button to open the form from the previous exercise. If
necessary, Click the Maximize button so that the form takes the entire window.
● Pull down the View menu. Click Field List to display the field list for the table on
which the form is based. You can move and size the field list just like any other
Windows object.
● Fields can be added to the form from the field list in any order. Click and drag the
Major field from the field list to the form. The Major control is created as a combo
box because of the lookup list in the underlying table.
● Click and drag the FinancialAid field from the list to the form. The FinancialAid
control is created as a check box because FinancialAid is a Yes/No field in the
underlying table. Save the form.
STEP 4 : Create an Option Group
● Click the Option Group button on the Toolbox toolbar. The mouse pointer
changes to a tiny crosshair attached to an option group icon when you point
anywhere in the form. Click and drag in the form where you want the option
group to place, then release the mouse.
● You should see the Option Group Wizard. Enter Main as the label for the first
option, then press the Tab key to move to the next line. Type North and press Tab
to move to the next line. Enter South as the third and last option. Click Next.
● The option button to select Main (the first label that was entered) as the default is
selected. Click Next. Main, North, and South will be assigned the values 1, 2, and
3, respectively (Numeric entries are required for an option group ). Click Next.
● Click the drop-down arrow to select the field in which to store the value selected
through the option group, scroll until you can select Campus. Click Next. Make
sure the option button is selected as the type of control.
● Click the Option button for the Sunken style to match the other controls on the
form. Click Next.
● Enter Campus as the caption for the group. Click the Finish command button to
create the option group on the form. Click and drag the option group to position it
on the form under GPA control.
● Point to the border of the option group on the form, click the right mouse button
to display a shortcut menu, and click Properties. Click the All tab. Change the
name to Campus.Close the dialog box. Close the field list. Save the form.

STEP 5 : Add a Command Button


● Click the Command button tool. The mouse pointer changes to a tiny crosshair
attached to a command button when you point anywhere in the form.
● Click and drag in the form where you want the button to go, then release the
mouse. This draws a button and simultaneously opens the Command Button
Wizard.
● Click the Record Operations in the categories list box. Choose Add New Record
as the operation. Click Next.
● Click the Text option button in the next screen. Click Next. Type Add Record as
the name of the button, then click the Finish command button. The completed
command button should appear on your form. Save the form.

STEP 6 : Create the Additional Command Buttons


● Click the Command button tool. Click and drag in the form where you want the
second button to go.
● Click Record Navigation in the categories list box. Choose Find Record as the
operation. Click Next command button. Click the Text option button in the next
screen. Click Next command button.
● Type Find Record as the name of the button, then click the Finish command
button. The completed command button should appear on your form.
● Repeat these steps to add the command buttons to delete record (Record
Operations) and close the form (Form Operations). Save the form.

STEP 7 : Reset the Tab Order


● Click anywhere in the Detail section. Pull down the View menu. Click Tab Order
to display the Tab Order dialog box. Click the AutoOrder command button so that
the Tab key will move to fields in left-to-right, top-to-bottom order as you enter
data in the form. Click OK to close the Tab Order dialog box. Save the form.

STEP 8 : The Page Setup Command


● Point to any blank area in the Detail section of the form. Click the right mouse
button to display a shortcut menu, then click Properties to display the Properties
dialog box for the Detail section. Click the Format tab. Click the text box for
Height. Enter 9 to change the height of the Detail section to 9 cm. Close the
Properties dialog box.

● If necessary, click and drag the right border of the form so that all controls are
fully visible. Do not exceed a width of 20 cm. for the entire form.
● Pull down the File menu. Click Page Setup to display the Page Setup dialog box.
If necessary, click the Margins tab. Change the left and right margins to 25 mm.
Click OK to accept the settings and close the Page Setup dialog box.

STEP 9 : The Completed Form


● Click the View button to switch to the Form view and display the first record in the
table.
● Complete the record by adding appropriate data for the Major, FinancialAid, and
Campus fields that were added to the form in this exercise.
● Click the Add Record command button to create a new record. Click the text box
for Social Security Number. Complete the data, The record selector changes to a
pencil as soon as you begin to enter data to indicate the record has not been
saved.
● Press the Tab key or the enter key to move from field to field within the record.
Click the arrow on the drop-down list box to display the list of majors, then click
the desired major.
● Complete all of the information on the form. Press enter to move to the next
record. Click the Close Form command button on the form. Click Yes if you see a
message asking to save changes to the form design.

CREATING A REPORT
Exercise 7:

STEP 1: The Report Wizard


● Start Access. Open Our Students database.
● Click the Reports button in the Database Window, then click the Create report by
using wizard command button to create the report.
● You should see the dialog box, which displays all of the fields in the Students
table. Click the LastName field in the Available Fields list box, then click the >
button to enter this field in the Selected Fields.
● Enter the remaining fields (FirstName, PhoneNumber, and Major) one at a time,
by selecting the field name, then clicking the > button. Click the Next Command
button when you have entered the four fields.
● The first screen asks whether you want to choose any grouping levels. Click Next
without specifying a grouping level.
● The next screen asks whether you want to sort the records. Click the drop-down
arrow to display the available fields, then select the LastName. Click Next.
● The tabular layout is selected, as is Portrait orientation. Be sure the box is
checked to Adjust field width so all fields fit on a page. Click Next.
● Choose Corporate as the style. Click Next.
● Enter Student Master List as the title for your report. The option button to Preview
the Report is already selected. Click the Finish command button to exit the
Report Wizard and view the report.

STEP 2: Preview the Report


● Click the maximize button so the report takes the entire window.
● Click the drop-down arrow on the Zoom Control boz so that you can view the
report at 75%.
● Click the scroll arrows on the vertical scroll bar to view the names of additional
students. Click the Close button to close the Print Preview window and change to
the Report Design view.

STEP 3: Modify an Existing Control


● Click and drag the border of control containing the Now function from the report
footer to the report header.
● Size the control as necessary, then check that the control is still selected and
click the Align Right button on the Formatting toolbar.
● Point to the control, then click the right mouse button to display a shortcut menu
and click Properties to display the Properties sheet.
● Click the Format tab in the Properties sheet , Click the Format property, then click
the drop-down arrow to display the available formats. Click Short Date, then
close the Properties sheet.
● Pull down the File menu and Save to save the modified design.

STEP 4: Add an Unbound Control


● Click the Label tool on the Toolbox toolbar, then click and drag in the report footer
where you want the label to go and release the mouse. You should see a flashing
insertion point inside the label control (If you see the word Unbound instead of
the insertion point, it means you selected the Text box tool rather than the Label
tool; delete the Text box and begin again).
● Type Prepared by followed by your name. Press enter to complete the entry and
also select the control. Point to the control, click the right mouse button to display
the shortcut menu, then click Properties to display the Properties dialog box.
● Click the down arrow on the scroll bar, then scroll until you see the Font Size
property. Click in the Font Size box, click the drop-down arrow, then scroll until
you can change the font size to 9. Close the Property sheet.

STEP 5: Change the Sort Order


● Pull down the View menu. Click Sorting and Grouping to display the Sorting and
Grouping dialog box. The students are currently sorted by last name.
● Click the drop-down arrow in the Field Expression box. Click Major (The
ascending sequence is selected automatically).
● Click on the next line in the Field Expression box, click the drop-down arrow to
display the available fields, then click LastName to sort the students
alphabetically within major.
● Close the Sorting and Grouping dialog box. Save the report.
● Close the database. Exit Access if you do not wish to continue with the next
exercise at this time.

CREATING A QUERY – GROUPING RECORDS


EXERCISE 8

STEP 1 : Create the Query


● Start Access and open the Our Students database.
● Click the Queries button in the Database window. Double click Create Query in
Design view to display the Query Design Window.
● The Show table dialog box appears; the Tables tab is already selected as is the
Students table.
● Click the Add button to add the table to the query (the field list should appear).
Click Close to close the Show Table dialog box.
● Click the Maximize button. Make the field list larger, to display more fields at one
time.
● Click and drag the Major field from the field list to the query. Click and drag the
LastName, Gender, FinancialAid, QualityPoints, and Credits fields (in that order)
in similar fashion.
● Click the Sort row for the Major field. Click the down arrow to open the drop-down
list box. Click Ascending.
● Click the Sort row for the LastName field. Click the down arrow to open the
drop-down list box. Click Ascending.

STEP 2 : Add a Calculated Control


● Click in the first blank column in the field row. Enter the expression
=[QualityPoints]/[Credits] .
● Press Enter. Access has substituted Expr1: for the equal sign you typed initially.
Drag the column selector boundary so that the entire expression is visible.
● Pull down the File menu and click Save to display the dialog box. Enter GPA By
Major for the Query Name. Click OK.

STEP 3 : Run the Query


● Pull down the Query menu and click Run ( or click the Run button on the Query
Design toolbar). You will see the dynaset.
• Students are listed by major and alphabetically by last name within major.
• The GPA is calculated to several places and appears in the Expr! Field.
STEP 4 : Modify the Query
● Click the View button in order to modify the query.
● Click and drag to select Expr1 in the Field row for the calculated field (Do not
select the column). Type GPA to substitute a more meaningful field name.
● Point to the column and click the right mouse button to display a shortcut menu.
Click Properties to display the Field Properties dialog box. Click the General tab if
necessary.
• Click the Description text box. Enter GPA.
• Click the Format text box. Click the drop-down arrow to display the available
formats. Click Fixed. Set Decimal places to 2.
• Close the Field Properties dialog box.
● Click Save button to save the modified query.

STEP 5 : Rerun the Query


● Click the Run button to run the modified query. You will see a new dynaset
corresponding to the modified query.
• Students are listed by major and alphabetically within the major.
• The Gpa is calculated to two decimal places and appears under GPA field.
● Click the QualityPoints field for Chistopher Gibson. Replace 60 with 70. press
enter. The GPA changes automatically to 2.
● Pull down the Edit menu and click Undo Current Field/Record (or click the Undo
button on the Query toolbar). The GPA returns to its previous value.
● Tab to the GPA field for Chistopher Gibson. Type 2. Access will beep and prevent
you from changing the GPA because it is a calculated field as indicated on the
status bar.
● Click the Close button to close the query and return to the Database window.
Click Yes if asked whether to save the changes.

STEP 6 : The Report Wizard


● You should see the Database window. Click the Reports button, then double click
Create Report by using Wizard to start the Report wizard.
● Select GPA By Major from the Tables/Queries drop-down list. The available fields
list displays all of the fields in the GPA By Major query.
• Click the Major field in the Available fields list box. Click the > button.
• Add the LastName, Gender, FinancialAid, and GPA fields one at a time.
• Do not include the QualityPoints or Credits fields. Click Next.
● You should see the screen asking whether you want to group the fields. Click
(select) the Major field, then click the > button. The Major field appears above the
other fields to indicate that the records will be grouped according to the value of
the Major field. Click Next.
● The next screen asks you to specify the order for the detail records. Click the
drop-down arrow on the list box for the first field. Click LastName to sort the
records alphabetically by the last name within each major. Click Next.
● The Stepped Option button is already selected for the report layout, as is Portrait
Orientation. Be sure the box is checked to Adjust field width so all fields fit on a
page. Click Next.
● Choose Compact as the style. Click Next.
● GPA By Major (which corresponds to the name of the underlying query) is
already entered as the name of the report. Click the Option button to Modify the
report’s design. Click Finish to exit the Report Wizard.
STEP 7 : Sorting and Grouping
● You should display the Report Design view. Maximize the report window.
● Move, size and align the column headings.
● Pull down the View menu. Click Sorting and Grouping to display the Sorting and
Grouping dialog box.
● The Major field should already be selected. Click the Group Footer property, click
the drop down arrow, then click Yes to create a group footer for the Major field.
● Close the dialog box. The Major footer has been added to the report. Click the
Save button to save the modified report.

STEP 8 : Create the Group Footer


● Click the Text Box button on the Toolbox toolbar. The mouse pointer changes to a
tiny crosshair with a text box attached.
● Click and drag in the group footer where you want the text box (which will contain
the average GPA) to go. Release the mouse.
● You will see an Unbound control and an attached label containing a field number(
such as Text 19).
● Click in the text box of the control (Unbound will disappear). Enter =Avg(GPA) to
calculate the average of the GPA for all students in this group.
● Click in the attached Unbound control, click and drag to select the text (Text 19),
then type Average GPA for Major as the label for this control. Size, move and
align the label.
● Point to the Average GPA control, click the right mouse button to display a
shortcut menu, then click Properties to display the Properties dialog box. If
necessary, click the All tab, then scroll to the top of the list to view and/or modify
the existing properties:
• The Control Source text box contains the entry =Avg([GPA]) from the preceding
step.
• Click the Name text box. Replace the original name ( Text 19 ) with Average
GPA for Major.
• Click the Format box. Click the drop-down arrow and select Fixed.
• Click the box for the Decimal places. Click the drop-down arrow and select
(click) 2.
● Close the Properties dialog box to accept these settings and return to the report.
Click the Save button on the toolbar.
STEP 9 : Create the Report Footer
● The report footer is created in similar fashion to the group footer. Click and drag
the bottom of the report footer to extend the size of the footer.
● Click the Text Box button on the Toolbox toolbar, then click and drag in the report
footer where you want the text box to go. Release the mouse. You will see an
Unbound control and an attached label containing a field number (such as
Text21).
● Click in the text box of the control (Unbound will disappear). Enter =Avg(GPA) to
calculate the average of the grade point averages for all students in the report.
● Click in the attached label, click and drag to select the text (Text21) , then type
Average GPA for All Students as the label for this control. Move, size and align
the label appropriately.
● Size the text box, then format the control:
• Point to the control, click the right mouse button to display a shortcut menu,
then click Properties to display the Properties dialog box. Change the properties
to Fixed Format, with 2 decimal places. Change the name to Average GPA for All
Students.
● Close the Properties dialog box to accept these settings and return to the report.
Click the Save button on the toolbar.

STEP 10 : View the Report


● Click the Print Preview button to view the completed report. The status bar shows
you are on page 1 of the report.
● Click the Zoom button to see the entire page. Click the Zoom button a second
time to return to the higher magnification, which lets you read the report.
● Pull down the File menu and click Print to display the Print dialog box. The All
option button is already selected under Print Range. Click OK to print the report.
● Pull down the File menu and click Close to close the GPA By Major report. Click
Yes if asked to save design changes to the report.
● Close Our Students database.
CROSS TAB AND ACTION QUERIES
EXERCISE 9

STEP 1: Create the Make-Table Query


● Open Our Students database. Click the Queries button in the Database Window,
then double click Create query in Design view.
● The Show Table dialog box appears automatically with the Tables tab already
selected. If necessary, select the Students Table, then click the Add button to add
the table to the query. Close the Show Table dialog box. Maximize the query
window.
● Click the SSN (the first field) in the Students table. Press and hold the Shift key,
then scroll (if necessary) until you can click Major in the table. Click and drag the
selected fields form the field list to the design grid.
● Scroll in the design grid until you can see the Credits field. Click in the Criteria
row for the Credits field and enter >=120.
● Click the drop-down arrow next to the Query Type button on the toolbar and
select (click) the make-table query. Enter Graduating Seniors as the name of the
table you will create.
● Verify that the option button for Current Database is selected then click OK.

STEP 2: Run the Make-Table Query


● Click Run button to run the make-table query. Click Yes in response to the
message indicating that you are about to paste one record (for the graduating
seniors) into a new table.
● Do not be concerned if you do not see the Graduating Seniors table at this time;
i.e., unlike a select query, you remain in the Design view after executing the
make-table query. Save the query as Archive Graduating Seniors.
● Click the Tables button in the Database window, then open the Graduating
Seniors table you just created. The table should contain one record (for Kim
Zimmerman) with 120 or more credits. Close the table.

STEP 3: Create the Delete Query


● Click the Queries button in the Database window, then click the Archive
Graduating Seniors query to select the query. Pull down the Edit menu. Click
Copy to copy the query to the clipboard.
● Pull down the Edit menu a second time, then click the Paste command to display
the Paste As dialog box. Type Purge Graduating Seniors as the name of the
query, then click OK.
● The Database window contains the original query (Archive Graduating Seniors)
as well as the copied version (Purge Graduating Seniors) you just created.

STEP 4: Complete and Run the Delete Query


● Open the newly created query in the Design view. Maximize the window. Click
the drop down arrow next to the Query Type button on the toolbar and select
(click) the Delete Query.
● Click and drag the box on the horizontal scroll bar until you can see the Credits
field. The criteria, >=120, is already entered because the Delete query was
copied originally from Make Table query and the criteria are identical.
● Click the Run button to execute the query. Click Yes when warned that you are
about the delete one record from the specified table. Once again, you remain in
the design view after the query has been executed. Close the query window.
Click Yes if asked to save the changes.
● Open the Students table. The record for Kim Zimmerman is no longer there.
Close the students table.

STEP 5: Create the Append Query


● Click the Queries button then double click Create query in design view. The
Show Tables dialog box opens and contains the following tables:
o The Students table that you have used throughout the lab sessions.
o The Graduating Seniors table you just created.
o The Transfer Students table that will be appended to the Students table.
● Select the Transfer Students table then click the Add button add this table to the
query. Close the Show Table dialog box. Maximize the window. Click and drag
asterisk from the field list to the query design grid.
● Click the drop-down arrow next to the Query type button on the toolbar and
select (click) Append Query to display the Append dialog box. Click the
drop-down arrow on the Append to Table name list box and select the Students
table.
● Click the Run button. Click Yes when warned that you are about to add 4 rows
(from the Transfer Students table to the Students table).
● Save the query as Append Transfer Students. Close the query window.
● Open the Students table. Two records have been added (Limson, and Dazo).
Close the table.

STEP 6: Create an Update Query


● Click the Query button in the Database window. Select (click) the GPA by Major
Query, press Ctrl+C to copy the Query, then press Ctrl+V to display the paste as
the dialog box. Enter Update Financial Aid. Click OK.
● Open the newly created query in the design view. Click the drop-down arrow next
to the Query Type button on the toolbar and select (click) Update Query. The
Query grid changes to include an Update To: row and the Sort row disappears.
● Click in the Criteria row for the GPA field and enter >=3. Click in the Update to
Row for the FinancialAid field and enter Yes. The combination of these entries
will change the value of the Financial Aid field to “yes” for all students with a GPA
of 3.00 or higher.
● Click the Run button to execute the query. Click Yes when warned that you are
about to update one record. Close the query window. Click Yes if asked whether
to save the changes.

STEP 7: Check Your Progress


● Click the Tables button in the Database window. Open (double click) the
Students, Graduating Seniors, and Transfer Students tables one after another.
You have to return to the Database window each time you open a table.
● Pull down the Window menu and click the Tile Vertically command to display the
tables. The arrangement of your tables may be different from ours.
● Check your progress by comparing the tables to one other:
o Check the first record in the Transfer Students table, Jeremy Limson and Kevin
Dazo, and note that it has been added to the Stıdents table via the Append
Transfer Students query .
o Check the record in the Graduating Senior table, Kim Zimmerman, and note
that it has been removed from the Students table via the Purge Graduating
Seniors query.
o The Students table reflects the table the current student database. The other
two tables function as back up.
● Close the Students, Transfer Students, and Graduating Seniors tables.
STEP 8: Create a Crosstab Query
● Click the Queries button in the Database window, click New, click the Crosstab
Query Wizard in the New Query dialog box and click OK to start the wizard.
● Click the Queries option button and select the GPA by Major query. Click Next.
o Click Major in the available field list, then click > to place it in the selected fields
list. Click Next.
o Click Gender as the field for column headings. Click Next.
o Click GPA as the field to calculate and select the Avg.function. Clear the check
box to include to row sums. Click Next.
o The name of the query is suggested for you, as is the option button to view the
query. Click Finish.
● The results of the crosstab query are shown. The query lists the average GPA for
each combination of major and gender. The display is awkward, however, in that
the GPA is calculated to an unnecessary number of decimal places.
● Click the View Button to display the Design view for this query. Right click in the
GPA column to display a context-sensitive menu, click Properties to display the
Field Properties dialog box, click in the Format row, and select Fixed. Set the
number of decimals to two.
● Click the Run button to re-execute the query, This time the GPA is displayed to
two decimal places. Save the query. Close the Query window.
● Close the Our Students database. Exit Access.

CREATING A RELATIONAL DATABASE


EXERCISE 10

STEP 1: Open the Relationships Window


● Start Access. Open the Look Ahead database.
● The Tables button should be selected. The database contains Employees,
Locations, and Titles tables.
● Pull down the Tools menu and click the Relationships command to open the
Relationships window. (The tables are not yet visible
in this window.)
● Pull down the Relationships menu and click the
Show Table command to display the Show Table
dialog box. Click the Locations table then click the
Add button to add this table to the Relationships
window.
● Double click the Titles and Employees tables to add
these tables to the Relationships window.
● Close the Show Table dialog box.
STEP 2: Create the Relationships
● Maximize the Relationships windows so that you have more room in which to
work.
● Click and drag the title bar of each table so that the positions of the tables match.
Click and drag the bottom (and/or right) border of each table so that you see all
of the fields in each table. Click and drag the LocationID field in the Locations
table field list to the LocationID field in the Employees field list. You will see the
Edit Relationships dialog box. Check the box to Enforce Referential Integrity.
Click the Create button to create the relationship.
● Click and drag the TitleID field in the Titles table field list to the TitleID field in the
Employees field list. You will see the Edit Relationships dialog box. Check the
box to Enforce Referential Integrity. Click the Create button to create the
relationship.
● Click the Save button on the Relationship toolbar to save the Relationships
window, then close the Relationships window.

STEP 3: Enter Your Own Record


● Double click the Employees table to open the table. Maximize the window. Pull
down the Insert menu and click the New Record command on the Table
Datasheet toolbar.
● Enter data for yourself, using your own social security number, and your first and
last name. Enter an invalid LocationID (e.g., L44) then complete the record.
● Press the enter key when you have completed the data entry, then click OK when
you see the error message. Access prevents you from entering a location that
does not exist.
● Click in the LocationID field and enter L01, LocationID for Miami. Press the down
arrow key to move to the next record, which automatically saves the current
record. Close the Employees table.

STEP 4: Simplified Data Entry


● Click the Forms button in the Database window, then double click the Employees
form to open this form. Click the Add Record button then click the text box for the
Social Security Number.
● Enter the data for Bob Grauer one field at a time, pressing the Tab key to move
from one field to the next. Click the down arrow when you come to the location
field to display the available locations, then select Miami.
● Press the Tab key to move to the Title field and choose Account Rep. Complete
the data for Bob’s record by entering $150,000, M, and Excellent in the Salary,
Gender, and Performance fields, respectively.
● Click the Close Form button when you have finished entering the data.
STEP 5: View the Employee Master List
● Click the Reports button in the Database window. Double click the Employee
Master List report to open the report.
● This report lists selected fields for all employees in the database. Note that the
two new employees, you and Bob Grauer, are in alphabetical order. Both
employees are in the Miami Office.
● Close the Report window.

STEP 6 : Change the Locations Table


● Click the Tables button in the Database window, then double click the Locations
table to open this table. Maximize the window.
● Click the plus sign next to location L04 (Miami) to view the employees in this
office. The plus sign changes to a minus sign as the employee records for this
location are shown. Your name appears in this list as does Bob Grauer’s. Click
the minus sign and the list of related records disappears.

● Click and drag to select Miami (the current value in the Location field). Type
Orlando and press the Tab key. Enter the corresponding values for the other
field: 1000 Kirkman Road, FL, 32801 and (407) 555-55555 for the address, state,
zip code, and office phone, respectively.
● Close the Locations table. You have moved the Miami Office to Orlando.

STEP 7 : View the Employees by title Report


● Click the Reports button in the Database window, then double click the
Employees by Title report to open the report.
● This report lists employees by title, rather than alphabetically. Note that you and
Bob Grauer are both listed as Account Reps in the Orlando office; i.e., the
location of the office was changed in the Locations table and that change is
automatically reflected for all employees assigned to that office.
○ Close the report window. Close the Database window. Exit Access.
ADDING A SUBFORM TO A FORM
EXERCISE 11

STEP 1: Open the GardenCorparation database.


STEP 2: On the Access toolbar, click the Relationships button to open the Relationships
window.
STEP 3: If the Show Table dialog box isn’t displayed, click the Show Table button on the
toolbar, and then double-click Categories and Products in the list displayed.
STEP 4: Close the Show Table dialog box to view the Relationships window, which
looks like this:

STEP 5: Point to the CategoryID in one table, and drag it on top of CategoryID in the
other table. Access displays the Edit Relationships dialog box, which lists the fields you
have chosen to relate and offers several options, as shown here:
STEP 6: Click the Enforce Referential Integrity check box, click the other two check
boxes, and then click Create.
Access draws a line representing the one-to-many relationship between the CategoryID
fields in each of the tables.
Tip: When the Cascade Update Related Fields check box is selected, changing a
primary key value in the primary table automatically updates the matching value in all
related records. When the Cascade Delete Related Records check box is selected,
deleting a record in the primary table deletes any related records in the related table.
You can edit or delete a relationship by right clicking the line and clicking the appropriate
command on the shortcut menu.

STEP 7: Close the Relationships window, clicking Yes when prompted to save its layout.
STEP 8: Open the Categories form in Design view.
STEP 9: Maximize the Form window, and drag the Form Footer section selector down
about 2.5 cm to give yourself some room to work.
STEP 10: If the toolbox isn’t displayed, click the Toolbox button .
STEP 11: Make sure the Control Wizards button in the toolbox is active (has a border
around it).
STEP 12: Click the Subform/Subreport button , and drag a rectangle in the lower portion
of the Details section. A white object appears on the form, and the first page of the
Subform Wizard opens.
STEP 13: Leave Use existing Tables and Queries selected, and click Next.
STEP 14: In the Tables/Queries list, click Table:Products.
STEP 15: Add the ProductName, CategoryID, QuantityPerUnit, UnitPrice, and
UnitsInStock fields to the Selected Fields list by clicking each one and then clicking >
button.
Step 16: Then click Next to display this third page of the wizard. Because a field in the
subform is related to a field in the main form (CategoryID), the wizard selects Show
Products for each record in Categories using CategoryID as the Choose from a list
option. Tip: If the wizard can’t figure out which fields are related, it selects the Define my
own option and displays list boxes in which you can specify the fields to be related.

STEP 17: Click Next to accept the default selection, and then click Finish to accept the
default name for the subform and complete the process. Access displays the Categories
form in Design view, with an embedded Products subform. The size and location of the
subform is determined by the original rectangle you dragged on the form.
STEP 18: Adjust the size and location of the objects on your form so that it resembles
the one as follows.
STEP 19: Notice the layout of the subform, and then click View to switch to Form view.
The format of the subform has totally changed. In Design view, it looks like a simple
form, but in Form view, it looks like a datasheet.
STEP 20: Switch back to Design view, make any necessary size adjustments, and if
necessary, open the Properties dialog box.
STEP 21: Click the Form selector in the upper left corner of the subform twice. The first
click selects the Products subform control, and the second click selects the form. A
small black square appears in the button.
STEP 22: On the Format tab of the Properties dialog box, change both Record
Selectors and Navigation Buttons to No. While on this tab, notice the Default View
property, which is set to Datasheet. You might want to return to this property and try the
other options after finishing this exercise.

STEP 23: Switch back to Form view, and drag the dividers between column headers
until you can see all the fields (You can quickly adjust the width of columns to fit their
data by double-clicking the double arrow between column headings).
STEP 24: Click the navigation buttons to scroll through several categories. When you
are through, click the First Record button to return to the first category (Bulbs). As each
category is displayed at the top of the form, the products in that category are listed in
the datasheet in the subform.
STEP 25: Click the category name to the right of the first product. The arrow at the right
end of the box indicates that this is a combo box.
STEP 26: Click the arrow to display the list of categories, and change the category to
Cacti.

STEP 27: Click the Next Record navigation button to move to the next category (Cacti).
You can see that the first product is now included in this category.
STEP 28: Display the list of categories, and restore the first product to the Bulbs
category.
STEP 29: You don’t want people to be able to change a product’s category, so return to
design view. Then in the subform, click the CategoryID combo box control, and press
Delete key. Important: You included the CategoryID field when the wizard created this
subform because it is the field that relates the Categories and Products tables. The
underlying Products table uses a combo box to display the name of the category
instead of its ID number, so that combo box also appears on the subform.
STEP 30: Save the form, then switch back to Form view, and adjust the width of the
subform columns and the size of the Form window.

STEP 31: Close the Categories form, saving your changes to both the form and the
subform. Close the database.

IMPORTING AND EXPORTING ACCESS OBJECTS


EXERCISE 12

STEP 1: Import the Excel worksheet


● Start Access. Click the link to More Files in the task pane or pull down the File
menu and click the Open command.
● Open the Investment database in the Exploring Access folder.
● The database does not contain any tables yet. The tables will be imported from
Excel.
● Pull down the File menu, click the Get External Data command, then click Import
to display the Import dialog box.
● Click the down arrow on the Look in list box and change to Exploring Access
folder.
● Click the down arrow on the Files of type list box and select Microsoft Excel.
Select the Investment Data workbook. Click the Import button to start the Import
Spreadsheet Wizard.
STEP 2: The Import Spreadsheet Wizard
● In the first step of the Import Spreadsheet Wizard, the option button to Show
Worksheet is selected. The Clients worksheet is also selected. Click Next.

● Access will use the column headings in the Excel workbook as field names in the
access table, provided you check the box indicating that the first row contains
column headings. Click Next.
● Select the option button to store the data in a new table. Click Next.
● You do not need information about the individual fields. Click Next.
● Select the option to choose your own primary key. Click the drop-down arrow on
the list box, and select SSN. Click Next.
● Access indicates that it will import the data to a Clients table. Click The Finish
button, then click OK. The Clients table appears within the Database window.
● Repeat the steps to import the Consultants table into the Investment database
from the Investment Data workbook. Use the ConsultantID field as the primary
key for this table.
STEP 3: Create the Relationship
● Pull down the Tools menu and click the Relationship command.
● Pull down the Relationship menu and click the Show Table command. Click
(select) the Clients table, then click the Add button.
● Double click the Consultants table to add this table to the Relationship window.
Close the Show Table dialog box.
● Click and drag the title bar of each table. Click and drag the bottom border of
each table so that you see all of the fields in each table.
● Click and drag the ConsultantID field in the Consultants table field list to the
ConsultantID field in the Clients field list. You will see the Edit Relationships
dialog box.
● Check the box to Enforce Referential Integrity. Click the Create button to create
the relationship.

● Click the Save button.


STEP 4: Create the Multiple Table Query
● Click the Queries button in the Database window. Double click the icon to Create
query in the design view to open the Design window. The Show Table dialog box
appears automatically.
● Press and hold down the Ctrl key to select the Clients and Consultants tables,
then click the Add button to add these tables to query. Close the Show Table
dialog box.
● Click the Maximize button. Click and drag the title bars of each table to arrange
the tables, click and drag the bottom of each field list until you can see all of the
fields in the table.

STEP 5: Complete the Multiple-Table Query


● The Table row should be visible within the design grid. If not, pull down the View
menu and click Table Names to display the Table row.
● Double click the LastName and Status fields from the Consultants table to add
these fields to the design grid. Double click the LastName, Assets, and Account
Type fields from the Clients table to add these fields as well.
● Click the Sort row under the LastName field from the Consultants table, then click
the down arrow to open the drop-down list box. Click Ascending.

● Click the Save button on the Query Design toolbar. Save the query as Assets
Under Management. Click OK.

● Click the Run button to run the query.


STEP 6: Export the Query
● You should see the dynaset created by the query as shown below. The query
lists all of the client records grouped by the last name of the financial consultant.

● Pull down the File menu, click (or point to) Export command to display the Export
Query dialog box. Click the down arrow in the Save as type list box to select
Microsoft Excel 97 2003.
● Select the Investment Data workbook and click the Export All button to save the
query as a worksheet in the Investment Data workbook. Click Yes if asked
whether to replace the file. Close the Query window.
● Click the Tables button. Select the Clients table. Pull down the File menu, Click
the Export command, and change the file type to Microsoft Excel 97-2003. Select
(click) the Investment Data workbook. Click Export. Click Yes if asked whether to
replace the file.
● Export the Consultants table in similar fashion. Exit Access.
STEP 7: View the Excel Workbook
● Click the Start button, click (or point to) the Programs command, then select
Microsoft Excel. Click the Open button, change to the Exploring Access folder,
then open the Investment Data workbook.
● Click the Assets_Under_Management tab to see the worksheet. Format the
worksheet to improve its appearance.
● There are two client worksheets, Clients and Clients1, corresponding to the
original and modified client data. Click the Clients1 tab.
● There are also two consultant worksheets, Consultants and Consultants1. Click
the Consultants1 tab.
● Press and hold down the Ctrl key as you click the tab for each worksheet to
select all five worksheets. Pull down the File menu, click the Page Setup
command. Click the Sheet tab. Check the boxes to print Gridlines and Row and
Column headings. Click OK.
● Click the Print button to print the workbook. Save the workbook. Exit Excel.

THE SWITHCHBOARD MANAGER


EXERCISE 13

STEP 1: The Sports Objects Database


● Start Access. Change to the Exploring Access folder as you have been doing
throughout the text.
● Open the Sports Objects database, and then click the various buttons in the
Database window to view the contents of this database. This database contains
the various objects (forms, queries, and reports) in the soccer application, but not
the tables.
• Click the Tables button. There are currently no tables in the database.
• Click the Queries button. There is one query in the database.
• Click the Forms button. There are six forms in the database.
• Click the Reports button. There is one report in the database.
● Pull down the File menu, click Database Properties, then click the Contents tab
to see the contents of the database. The Database Properties command enables
you to see all of the objects on one screen.

● Click OK to close the dialog box.


STEP 2: The Link Tables Command
● Pull down the File menu. Click Get External Data, then click Link Tables from the
cascaded menu. You should see the Link dialog box (which is similar in
appearance to the Open dialog box).
● Select the Exploring Access folder, the folder you have been using throughout
the text. Scroll (if necessary) until you can select the Sports Tables database,
and then click the Link command button.

● You should see the Link Tables dialog box in Figure. Click the Select All
command button to select all three tables, then click OK.
● The system (briefly) displays a message indicating that it is linking the tables,
after which the tables should appear in the Database window.

● Click the Tables button in the Database window. The arrow next to each table
indicates that the table physically resides in another database. (You may have to
relink the tables if you move the database to another computer.)
STEP 3: Import the About Sports Form
● Pull down the File menu, click the Get External Data command, and then click
Import to display the Import dialog box. Select the Exploring Access folder, the
folder you have been using throughout the text.
● Scroll (if necessary) until you can select the About Sports database, then click
the Import button to display the Import Objects dialog box in Figure. Click the
Forms button, select the About Sports form, and click OK. The system pauses as
the About Sports form is brought into this database.

● Once the importing is complete, the Database window changes to display the
forms in this database, which now includes the About Sports form. Open the form
in the Design view, then modify its contents to include your name and school.
Save your changes, then close the form.
STEP 4: Start the Switchboard Manager
● Minimize the Database window. Pull down the Tools menu, click the Database
Utilities command, and choose Switchboard Manager.
● Click Yes if you see a message indicating that there is no valid switchboard. You
should see the Switchboard Manager dialog box in Figure.
● Click the Edit command button to display the Edit Switchboard Page dialog box.
Click the New command button to add an item to this page, which in turn displays
the Edit Switchboard Item dialog box.

● Click in the Text list box and type &About Sports, which is the name of the
command as it will appear in the switchboard.

● Click the drop-down arrow on the Command list box. Choose the command to
open the form in either Add or Edit mode (it doesn't matter for this form).

● Click the drop-down arrow in the Form list box and choose About Sports.

● Click OK to create the switchboard item. The Edit Switchboard Item dialog box
closes and the About Sports item appears in the Main Switchboard.
STEP 5: Complete the Switchboard
● Click the New command button in the Edit Switchboard Page dialog box to add a
second item to the switchboard. Once again, you see the Edit Switchboard dialog
box.
● Click in the Text list box and type &Players. Click the drop-down arrow on the
Command list box and choose Open Form in Edit Mode. Click the drop-down
arrow in the Form list box and choose Players.
● Click OK to close the Edit Switchboard Item dialog box. The &Players command
appears as an item on the switchboard.
● Create two additional switchboard items for &Coaches and &Teams in similar
fashion. Your switchboard should contain four items as shown in Figure. Click
Close to close the Edit Switchboard Page dialog box. Click Close to close the
Switchboard Manager dialog box.

STEP 6: Test the Switchboard


● Click the Restore button in the Database window to view the objects in the
database, then click the Forms tab. The Switchboard form has been created
automatically by the Switchboard Manager.
● Double click the Switchboard form to open the Main Switchboard. Do not be
concerned about the design of the switchboard at this time, as your immediate
objective is to make sure that the buttons work. (We modify the design of the
switchboard at the end of the exercise.) Maximize the window.
● Click the About Sports button (or use the Alt+A shortcut) to display the About
Sports form as shown in Figure. Click the OK button to close the form.

● Click the Players button (or use the Alt+P shortcut) to open the Players form.
Click the Maximize button so that the Players form takes the entire window.
STEP 7: Add Your Record
● Click the Add Player button on the bottom of the form (or use the Alt+A shortcut)
to display a blank record where you will enter data for yourself as shown in
Figure.
● Click the text box to enter your first name. (The PlayerlD is an AutoNumber field
that is updated automatically.) Enter your name, then press the Tab key to move
to the next field.
● Continue to enter the appropriate data for yourself, but please assign yourself to
the Comets team. The team is entered via a drop-down list. Type C (the first
letter in Comets) and Comets is entered automatically from the drop-down list for
teams.
● The player rating is a required field (all players are evaluated for ability in order to
balance the teams) and must be A, B, C, or D.

● Click the Close Form button to return to the switchboard.


STEP 8: Complete the Data Entry
● You should once again see the switchboard. Click the Coaches button (or use the
Alt+C shortcut) to open the Coaches form.
● Click the Add Coach button at the bottom of the form. Click the text box to enter
the coach's first name. (The CoachID is entered automatically.)
● Enter data for your instructor as the coach. Click the appropriate option button to
make your instructor a Head Coach. Assign your instructor to the Comets. Click
the Close Form button to return to switchboard.
● Click the Teams command button on the switchboard to open the Teams form
and move to Team T02 (the Comets). You should see your instructor as the head
coach and yourself as a player as shown in Figure.
● Pull down the Edit menu and click Select Record (or click the selection area),
then click the Print button to print the roster for your team.
● Click the Close Form button to return to the switchboard.
STEP 9: Insert the Clip Art
● Change to the Design view. Right click in the Picture area of the form to display a
context sensitive menu, and then click the Properties command to display the
Property sheet. Click the All tab.
● The Picture property is currently set to "none" because the default switchboard
does not contain a picture. Click in the Picture box, and then click the Build
button to display the Insert Picture dialog box.
● Click the down arrow in the Look In box to change to the Exploring Access folder,
then select the SoccerBall. Click OK.
● Size the picture as appropriate. The dimensions of the soccer ball should be
changed to a square—for example, 1.7 inches X 1.7 inches. Close the property
sheet.
● Right click below the picture in the Detail area of the form. Point to the Fill/Back
Color command from the context-sensitive menu to display a color palette.
Choose the same shade as appears on the rest of the form. (It is the fifth square
from the left in the second row.)
● Click the Undo button if the color does not match. Save the form.
STEP 10: Complete the Design
● Delete the label that contains the title of the switchboard, "Sports Objects". (You
will have to delete two labels, because the switchboard manager automatically
creates a shadow.)
● Click and drag the Label tool to create a new unbound control for the title of the
switchboard. Enter Any Sports League as the title. Use 18-point Arial bold, in
white for the formatting.
● Click the Label tool, then click and drag to create a text box under the picture.
Enter your name in an appropriate font, point size, and color. Move and/or size
the label containing your name as appropriate.
● Press and hold the Shift key as you click each text box in succession. The boxes
appear to be empty, but the text will be drawn from the Switchboard Items table.
● Be sure that you selected all text boxes. Click the drop-down arrow on the
Font/Fore Color button and change the color to white. Change the font and point
size to Arial and 10pt, respectively. Save the form.
● Change to the Form view to see the result of your changes. Exit Access if you do
not want to continue with the next exercise at this time.
MACROS AND PROTOTYPING
EXERCISE 14

STEP 1: Create the AutoExec Macro


● Start Access. Open the Sports Objects database from the previous exercise.
Click the Macros button in the Database window.
● Click the New button to create a new macro. If necessary, click the Maximize
button so that the Macro window takes the entire screen.
● Click the drop-down arrow to display the available macro actions. Scroll until you
can select Maximize. (There are no arguments for this action.)

● Click the Action box on the second line, click the drop-down arrow to display the
macro actions, then scroll until you can click the OpenForm action. Click the text
box for the Form Name argument in the lower section of the Macro window.

● Click the drop-down arrow to display the list of existing forms and select
Switchboard (the form you created in the previous exercise).

● Click the Save button to display the Save As dialog box in Figure 1. Type
AutoExec as the macro name and click OK. Click the Run button to run the
macro and open the switchboard.
● Close the switchboard. Close the AutoExec macro.
STEP 2: Create the Prototype Macro
● You should be back in the Database window, which should display the name of
the AutoExec macro. Click the New button to create a second macro.
● Type Ms (the first two letters in the MsgBox action), then press enter to accept
this action. Enter the comment shown in Figure 2.
● Click the text box for the Message argument, then press Shift+F2 to display the
zoom box so that you can see the contents of your entire message. Enter the
message “The object will be implemented in the next version. In the meantime,
you can gain an appreciation for the "look an feel" of the system by stepping
through the various commands on the switchboard” in Figure 2. Click OK.
● Click the text box for the Type argument, click the drop-down arrow to display the
list of message types, and select Information.

● Click in the text box for the Title argument, and enter "Under Development".

● Click the Run button to test the macro. You will see a message indicating that
you have to save the macro. Click Yes to save the macro, type Prototype as the
name of the macro, and click OK.
● You will see a dialog box containing the message you just created. Click OK.
Close the macro.

STEP 3: Create the Close Database Macro


● Click the New button once again to create the third (and last) macro for this
exercise. Specify the MsgBox action as the first command in the macro. Enter
the comment shown in Figure 3, and enter the Message “It is not a question of it
will happen, but when. Hard disks fail, files are lost, and viruses can infect a
system. Thus, you are urgent to back up your database at the end of every
session.”
● Enter an appropriate message that stresses the importance of backup. Select
Warning as the message type. Enter an appropriate title for the message box.
● Click the Action box on the second line. Type Cl (the first two letters in Close)
and press enter. Enter the indicated comment as shown in Figure 3.

● Click the text box for the Object Type argument. Click the drop-down arrow and
choose Form as the Object type. Click the Object Name argument, click the
drop-down arrow, and choose Switchboard as the Object (form) name.

● Click the Action box on the third line. Type Cl (the first two letters in Close) and
press enter. Click the comments line for this macro action and enter the comment
shown in the figure. No arguments are necessary.
● Save the macro as Close Database, then close the macro. If necessary, press
the Fll key to return to the Database window, where you should see three
macros: AutoExec, Close Database, and Prototype.

STEP 4: Create the Report Switchboard


● Minimize the Database window to give yourself more room in which to work. Pull
down the Tools menu, click the Database Utilities command, and choose
Switchboard Manager to display the Switchboard Manager dialog box.
● Click New. Enter Report Switchboard as the name of the switchboard page. Click
OK. The Create New dialog box closes and the Report Switchboard page
appears in the Switchboard Manager dialog box.

● Select the Report Switchboard, click Edit to open the Edit Switchboard Page
dialog box. Click New to open the Edit Switchboard Item dialog box.
● Add the first switchboard item. Click in the Text list box and type Report 1 as
shown in Figure 4.
● Press the Tab key to move to the Command list box and type the Run M (the first
several letters in Run Macro). Press Tab to move to the Macro list box and type P
(the first letter in the macro name, "Prototype").
● Click OK to create the switchboard item. The Edit Switchboard Item dialog box
closes and Report 1 appears on the Report Switchboard page.
● Add Report 2 as the next switchboard item. Specify the Run macro command
and choose AutoExec as the macro.

● Add an additional item that will return the user to the main switchboard. Click
New to open the Edit Switchboard Item dialog box. Click in the Text list box and
type "&Return to Main Menu..."
● Press the Tab key to move to the Command list box, where the Go to
Switchboard command is entered by default. Press the Tab key to move to the
Switchboard list box, and type M (the first letter in the "Main Switchboard"). Click
OK to create the switchboard item. Close the Edit Switchboard Page.

STEP 5: Modify the Main Switchboard


● Select the Main Switchboard in the Switchboard Manager dialog box, click the
Edit button to open the Edit Switchboard Page dialog box, then click New to open
the Edit Switchboard Item dialog box as shown in Figure 5.
● Add a new switchboard item to open the Report Switchboard. Click in the Text list
box and type "&Report Menu ...", the name of the command as it will appear in
the switchboard.
● Press the Tab key to move to the Command list box, where "Go to Switchboard"
is already entered, then press the Tab key a second time to move to the
Switchboard list box. Type R (the first letter in the "Report Switchboard"). Click
OK to create the switchboard item.

● The Edit Switchboard Item dialog box closes and "&Report Menu" appears on
the main switchboard.
● The main switchboard needs one last command to close the database. Thus,
click New to open the Edit Switchboard Item dialog box. Type &Exit as the name
of the command.
● Press the Tab key to move to the Command list box and type R (the first letter in
"Run Macro"). Press the Tab key a second time to move to the Macro list box,
and type C (the first letter in the "Close Database" macro). Click OK to create the
switchboard item.

● The main switchboard should contain six items— &About Sports, &Players,
&Coaches, and &Teams from the first exercise, and &Report Menu and &Exit
from this exercise.
● Close the Edit Switchboard Page dialog box. Close the Switchboard Manager.
STEP 6: Test the Main Switchboard
● Click the Restore button in the Database window to view the objects in the
database, click the Forms button, then double click the Switchboard form to open
(Figure 6).
● Click the Exit button (or use the Alt+E shortcut).
● You should see an informational message similar to the one shown in the figure.
(The message is displayed by the MsgBox action in the Close Database macro.)

● Click OK to accept the message. The Close Database macro then closes the
database.
● Pull down the File menu, then click Sports Objects from the list of recently
opened databases. The AutoExec macro executes automatically, maximizes the
current window, and displays the main switchboard.
STEP 7: Test the Report Switchboard
● Click the Report Menu button (or use the Alt+R keyboard shortcut) on the main
switchboard to display the Report switchboard in Figure 7.
● Click the buttons for Report 1, Report 2.

● Click the Return to Main Menu button to exit the Report Menu and return to the
main switchboard.
● To continue working, click the Close button on the title bar (or pull down the File
menu and click the Close command) to close the form and continue working on
this database. (You should not click the Exit command button as that would close
the database.) You should be back in the Database window, where you can
continue with the next hands-on exercise.
● To close the database, click the Exit button (or use the Alt+E shortcut).
● Either way, you have demonstrated the "look and feel" of the system to the extent
that you can step through the various menus. Good work.

You might also like