Lab 02

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Suez University – Faculty of Science

COM201-System Analysis and Design


Information Systems Development II (LAB. 2)
2.1 Introduction
This laboratory session continues with the theme of information system development as you create
more components of the Video rentals System using Microsoft Access.

2.1.1 Objectives
By the end of this laboratory session, you should:
1 Be able to demonstrate the following Microsoft Access skills:
 Create forms.
 Create queries to extract information from a database.
 Create reports.
2 Have taken the following steps in the Video Rentals System development:
 Created a new form for entering and editing details of video categories.
 Created a menu form from which the user can access other forms(and later reports).
 Created a report for displaying member details.
 Created a report for displaying overdue rentals.

2.2 Exercises
2.2.1 Creating new forms
During this section, you will create new forms, utilising Microsoft Access wizards. In the previous
session, you explored a Columnar form, which displayed one record at a time. In this section you
will create a Tabular form, which uses a column per field to display multiple records at a time.
Creating a form with the wizard
1. Open your Video rentals System Microsoft Access database (Videostore.mdb) and use the
Form Wizard to create a new form based on the Category table ( Figure 2.1).
2. Use the following information to aid in
your responses to the Wizard:
 Include all fields on the form.
 Use a Tabular layout.
 Use a Standard style.
 Use the form title “Category
Details”.

1
Figure 2.1: Initial Category Details form Figure 2.2: Improved Category form

Improving the appearance of the form


1. Use the skills developed in last week's laboratory session to convert the default Category
Details form (refer to Figure 2.1) into the improved Category Details form (refer to Figure
2.2). Where appropriate make, changes to the background and foreground colours of the
form, labels, and text boxes (which are not clearly illustrated in Figure 2.2).

2.2.2 Utilising unbound controls on forms


This section explores further approaches for adding functionality to forms through the introduction
of unbound controls. Unbound controls are controls that are not connected to the database, such as
unbound text boxes and buttons.
Adding an unbound text box
In this section, you will add a unbound text box to the Category Details form to display the total
number of categories.

Use Figure 2.3 for the following exercises.


1. Enlarge the Form Footer section of the Category Details form to create space to place a text
box.
2. Use the text box control item from the toolbar to place a text box in the newly created space.
3. Change the label of the text box to “Number of Categories:”.
4. Modify the text box to have consistent formatting with the other text boxes on the form.
5. Enter =Count(*) in the Control Source property of the text box. Use the online help to learn
more about the Count function.

2
Figure 2.3: Adding an unbound control to the Category Details form

Creating Menu forms


In this section, you will become familiar with using Microsoft Access’s wizard to create buttons to
open forms.
1. Open the existing Main Menu form in design mode.
2. With the Control Wizard enabled, explore the Command Button Wizard.
3. Use the button control item from the toolbar to add a button to the Main Menu form for
opening the Member Details form (refer to Figure 2.4).
4. Add another button which launches the Category Details form.

Figure 2.4: Adding a button to the main menu form

3
2.2.3 Querying databases
Microsoft Access offers the ability to create queries that extract, summarise and manipulate data
stored in a database in order to produce information required by the users of the system. For
example, the users of the Video rentals System require a list of all the currently hired videos. A
query can be created to produce such a list.
In this section, you will therefore query the Video rentals System database. Later in the course, you
will look at database queries in more detail.
Current rentals
In this section you will create a query to display all the videos that are currently out on hire along
with their associated borrower (i.e. the member who hired the video). In next week's session this
query will be used as the data source for the video rental form.
1 Open the Video rentals System.
2 Switch to the Queries tab of the database window.
3 Create a new query (without using the wizard) and include the Hire and Video tables.
4 From the two tables add the following fields (refer to Figure 2.5):
 Hire: Hire_Num, Member_ID, Video_Code, Issue_Date, Due_Date, and Return_Date
 Video: Title and Status.

Figure 2.5: Design view of the Current Rental query

5. Save the query as “Current Rentals”.

6. Run the query using the Run toolbar icon . Is the query displaying the correct
information (i.e. only current rentals)?
The Current Rentals query presently displays all hires, whether current or passed. To limit the query
to only the current rentals, it is necessary to apply specific criteria. In this case a hire is current if the

4
video status is false (meaning the video is unavailable) and the hire has no Return_Date (it has not
been returned). Is it necessary to include both these criteria?
7. In the criteria row of the Current Rental query, enter the following criteria for the
Return_Date and Status fields:
 Return_Date: Is Null
 Status: False
8. Check that the query now displays the correct information.
9. Have a look at what is going on behind the scenes: From the view menu, select SQL view.
How much of the code can you understand? The code you see is known as Structured Query
Language (SQL) - you will be introduced to it in lectures later in the course.
Overdue rentals
 Create a query named “Overdue Rentals” which satisfies the following criteria:
 Displays the borrower's Member_ID, Surname, First_Name, Title and the video's Title, the
Issue_Date, and Due_Date.
 Only displays hires which are currently outstanding (i.e. have a Due_Date that is less that
the current date (<date()).
 Uses the query's Sort row to sort the results alphabetically by Surname and First_Name.
Note: It maybe necessary to include other fields in order to satisfy the necessary criteria for the
query.

2.2.4 Creating reports


Reports are used to display data stored in a table or multiple tables in a manner that is meaningful
and useful to the user. They can be based directly on a single table or on a query that extracts data
from multiple tables.
In this section, you will use Microsoft Access to create reports based on a single table as well as on
queries. Note that by using Microsoft Access wizards, you can create reports directly from more
than one table – Microsoft Access creates what is known as an internal query behind the scenes to
extract the data to meet the requirements of the report.
A report based on one table - the Current Members Report
1 Explore the “Current Video” query.
2 Switch to the Reports tab in the database window.
3 Create a new report using the Report Wizard based on the Member table. Use the following
information to respond to the wizard:
(a) Select the fields shown in Figure 2.6.
(b) No grouping of levels is required.
(c) Sort the records by surname and first name.
(d) Use the Tabular layout.

5
(e) Use the corporate style.
(f) Enter an appropriate title.
4 Switch your report into Design Mode and explore the available options until you have modified
your report to resemble that illustrated in Figure 2.6.

Figure 2.6: Current Members Report

A report based on multiple tables - Overdue Rentals report


In this section you will create a report that lists all videos out on hire that have not been returned by
their due date similar to that shown in Figure 2.7.

Figure 2.7: Overdue Videos Report

6
1 Use the report wizard, selecting the Overdue Rentals query as the data source.
2 Select only the fields required, as shown in Figure 2.7
3 View the data “by Member”, but note in passing how the report would appear if you selected
“by Hire” or “by Video”.
4 No grouping is required.
5 The videos listed for each member should be listed in alphabetical order of title.

2.2.5 Review
In this week's laboratory session you have:
1 Experienced how a Microsoft Access wizard can rapidly create forms for accessing and
manipulating data stored in tables
2 Explored how forms can make it easy for the user to manipulate data stored in tables
3 Familiarised yourself with the different types of objects that make up a form and how their
properties can be customised to meet the needs of the user
4 Examined how queries can extract information from multiple tables
5 Discovered how reports can be used to present information drawn from tables and queries in a
pleasing useful manner.

End of lab. 2

You might also like