0% found this document useful (0 votes)
24 views

1 Operate Database Application

Operate Database Application

Uploaded by

getnetzd7
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)
24 views

1 Operate Database Application

Operate Database Application

Uploaded by

getnetzd7
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

Web Development and Database Administration

LEVEL II

Module Title: Operating Database Application

Course Code: EIS WDDBA2 01 1221

LEARNING GUIDE

Unit of Competence: Operate Database Application


Module Title: Operating Database Application

Introduction LO1- Creating Database Objects

This learning guide is developed to provide you the necessary information regarding the following
content coverage and topics –
• Opening and designing DB application and principles
• Creating DB objects

This guide will also assist you to attain the learning outcome stated in the cover page. Specifically, upon
completion of this Learning Guide, you will be able to –
• Open and design database application incorporating basic designprinciples
• Create database object according to database usage, as well as user requirements
• Modify database object as required
• Add and modify data in a table according to information requirements
• Add, modify and delete records as required
• Save and compile database objects

Learning Activities

1. Read the specific objectives of this Learning Guide.


2. Read the information written in the Information Sheet 1.
3. Accomplish the Self-check 1.
4. If you earned a satisfactory evaluation, proceed to Operation Sheet 1. However, if your rating is
unsatisfactory, see your teacher for further instructions.
5. Read the Operation Sheet 1 and try to understand the procedures discussed.
6. Submit your accomplished Self-check 1. This will form part of your training portfolio.
7. Read the Operation Sheet 2 and try to understand the procedures discussed.
8. Accomplish the Self-check 2.
9. If you earned a satisfactory evaluation proceed to LAP Test.
However, if your rating is unsatisfactory, see your teacher for further instructions.
10. Submit your accomplished Self-check 2. This will form part of your training portfolio.
11 Do theLAP test (if you are ready) and show your output to your teacher.
*Your teacher will evaluate your output either satisfactory or unsatisfactory. If unsatisfactory, your teacher shall

Database Application andPrinciples


advise you on additional work. But if satisfactory you can proceed to the next topic.

Information Sheet – 1 Opening and designing DB application and principles


Data
- stored representations of meaningful objects and events Types of Data:
 Structured: numbers, text, dates
 Unstructured: images, video, documents

Information
- data processed to increase knowledge in the person using the data

Database
- organized collection of logically related data

Naming conventions

Why use a naming convention?


A naming convention should be used in the process of working with databases because of several reasons:
• It provides a clear structure, each component using the standard naming rules.
• The database logic can be understood by anyone knowing the naming convention.
• Maintenance work is reduced, as future developers will not have to waste time figuring out what each
field is.
Whatever the naming convention, make sure it becomes a standard across the company and is followed by
everyone in your department. The following paragraphs presents the conventions InterAKT uses and
recommends for developing web applications. In no way are they imposed, or the only ones possible to use.
The following conventions apply to all of the elements of a database:
General conventions
• All names used throughout the database should be lowercase only. This will eliminate errors related to

case-sensitivity.
• Separate name parts by underlines, never by spaces. This way, you improve the readability of each name
(e.g.
product name instead of productname). You will not have to use parentheses or quotes to enclose names
using spaces as well. The use of spaces in a database name is allowed only on some systems, while the
underline is an alphanumeric character, allowed on any platform. Thus, your database will become
platform independent.
• Do not use numbers in the names (e.g. product_attribute1). This is proof of poor design, indicating a
badly divided table structure. If you need a many-to-many relation, the best way to achieve it is by using a
separate linking table. See how here. Moreover, using numbers to differentiate between two columns that
store similar information might be an indication that you need an extra table, storing that information. For
instance, having a location1 column in a manufacturers table and a location2 column in a distributors
table could be solved by creating a separate table that stores all locations, and that is referenced by both
the manufacturers and distributors tables via foreign keys.
• Do not use the dot (.) as a separator in names. This way you will avoid problems when trying to perform
queries, as the dot is used to identify a field in a specific column.
In SQL language, manufacturer_man.address_man means the address column from the table that stores
information about manufacturers.
• Do not use any of the reserved words as names of database elements. Each database language uses some
words as names for internal functions, or as part of the SQL syntax.
For instance, using order as the name of a table that stores product orders from an online shop is bad
practice, because order is also used in SQL language to sort records (ascending or descending).
• When naming the elements, do not use long or awkward names. Keep them as simple as you can, while
maintaining a clear meaning. It's also a good idea to use names which are close to the natural language.
Example, description_3rd is certainly a better name for a column that stores product descriptions than
dscr_pr or some generic name as field_1.
Database names
Each database must have a name of its own, which should also follow some conventions:
• Use the project name as the name of the database.
• Prefix the database name with the owner name, separated by an underscore. The owner might be a person
(e.g. the project manager) or the application for which the database is created.
For example, acme_catalog can be a good name for the database storingthe product catalog of the ACME
company.
Table names
Tables are some of the most common elements used in an application, as they store the columns, and as such are
mentioned in each query. Therefore, the following conventions should apply to tables:
• Table names contain the name of the entity that is being defined, followed by a three letter acronym of
that name (e.g.
category_ctg). Optionally, you can use the same prefix for all tables in the same database.
For example, acme_product_prd, acme_manufacturer_prd, acme_category_prd can be tables from the
acme_catalog database.
• Prefix tables that define the same larger entity with a 2 or 3-letter acronym that identifies it.
For example, e.g. hr_applicant_app, hr_job_job and hr_resume_rsmareall tables that belong to the
Human Resources Department of a large corporation database.
• Do not use generic prefixes, such as tbl_, or db_, as they are redundant and useless.
• Use short, unambiguous names for each table, restricted to one word, if possible. This way tables can be
distinguished easily.
• Use singular for table names. This way, you avoid errors due to the pluralization of English nouns in the
process of database development. For instance, activity becomes activities, box becomes boxes, person
becomes people or persons, while data remains data.
• Use clear names. Do not overdo it using abbreviations and acronyms. While using a shorter name might
help the developers, it makes the meaning less clear to other members of the team. Using clear names
makes the design selfexplanatory.
• Prefix lookup tables with the name of the table they relate to. This helps group related tables together (e.g.
product_type, product_status), and also helps prevent name conflicts between generic lookup tables for
different entities. You can have more than one generic lookup table for an existing master table, but
which address different properties of the elements in the table.
Column names
Columns are attributes of an entity, describing its properties. Therefore, the name they carry should be natural,
and as meaningful as possible. The following conventions are recommended:
• All keys are used for indexing and identifying records. Therefore, it's a good practice to put the id particle
in their name.
This way, you'll know the field is used as a key.
• The primary key is used to uniquely identify each record. That is why its name should be made up of the
id particle, followed by the table name acronym.
For instance, for the table product_prd, the primary key is id_prd.
• The foreign key name should be composed by the id particle, followed by the acronym of the referred
table, and then by the acronym of the table it belongs to.
For example, the idctg_prd foreign key belongs to the products table (product_prd), but it refers to the
categories table (category_ctg). This way, the table being referenced is obvious from the key name.
• Each column name should be followed by the 3-letter table acronym. This way, each column has a unique
name across the database. Without the table acronym, you would end up having two columns called
"name", one storing the product name and the other the manufacturer name. Instead, name_prd and
name_man can easily be distinguished.
• Date columns should use the “date_” prefix, and the Boolean type columns should use the “is_” prefix.
For instance, date_birth stores the birth date of a person, while is_confirmed could indicate the order

Creating DB objects
status for a product in a shop, using true/false values (or 0/1).

A table is a database object that you use to store data about a particular subject, such as employees or products.
A table consists of records and fields.
Each record contains data about one instance of the table subject, such as a particular employee. A record is also
commonly called a row or an instance.
Each field contains data about one aspect of the table subject, such as first name or e-mail address. A field is also
commonly called a column or an attribute.
A record consists of field values, such as Contoso, Ltd. or someone@example.com. A field value is also
commonly called a fact.
TABLES

QUERIES

A record

A field

A field value
A database can contain many tables, each storing information about a different subject. Each table can contain
many fields of
different types of data, such as text, numbers, dates, and hyperlinks.

A query is a way of asking questions about the data in the tables according to certain criteria.
FORMS

Forms are used mainly to display the records in the table in a user-friendly way.

REPORTS
Reports are used to print information from the database. They provide professional – looking output from
the table or query.

MACROS

A macro is a set of one or more actions that perform a particular operation. Macros can be created to add
buttons to print a report, open a form and other commonly used tasks.

SETTING UP THE TABLES

Stages in setting up a table:


• Define the field names that make up the table and declare the data type for each.
• Set thefield properties for each field name.
Defining the Field Names and Data Types
The field name should be identified in each table and define what sort of data to expect.
Example : In a Student table, the Student’s Name can be a Field Name. You need to tell whether the
Data Type is text, number, date/time, currency, etc. In this case it is text.

Setting the Field Properties


Once the table is named, and each field is defined with its data type, the fields can be further controlled by
setting the Field Properties. These properties will define how data can be stored and displayed.
Example: A date could be displayed 01/25/2012, 25th June 2012 or 25 – Jun – 2012.
Further Information on setting up tables
Data Types

Data Type Meaning

Text This is the default setting. Used for shorter text entries. Can be combination of
text, numbers, spaces and symbols. Maximum length 255 characters but you
can set it to less using the Field Size property.

Memo Used for longer text entries. Maximum length 65,535 characters

Number Used to store numeric data

Date/Time This stores a date or a time or a date and a time. There are several formats for a
date/time field.

Currency Monetary values. Normally in the UK this will be set to pounds and work to 2
decimal places
AutoNumber An AutoNumber field will number records automatically as you enter more
data. The field acts as a counter. Duplicates are avoided and so AutoNumber
fields are ideal as the key field.
An AutoNumber cannot be edited and when an AutoNumber record is deleted
Access does not allow you to go back and reuse this number.
Yes/No Only allows logical values such as Yes/No. True/False

OLE Object An object linked to or embedded in MS Access table. This might be an image
or a sound or a file created in another package such as MS Excel or MS Word
Hyperlink A hyperlink address. This can be linked to:
An object in you Access file e.g, another table
Another logically stored file
A Web page
An email address
Lookup Wizard This data type creates a lookup table so that you can choose a value from drop-
down box.
Field Properties

Property Description

Field Size This is used to fix the maximum length of a text field. The default is 50
characters. The maximum length is 255.

Format This fixes how data can be displayed, for example dates can be displayed
in many different forms such as 26/01/2012 or 26 Jan 2012 or 26 January
2012

Input Mask This sets a pattern for the data to be entered into this field.

Caption This is the field label in a form or report. You are likely to need to use
this property.

Default Value This is the value entered into the field when the record is created. It is
usually left blank but can be very powerful.

Validation Rule This defines the data entry rules

Validation Text This is the error message if data is invalid.

Required This indicates whether an entry must be made or not. If an entry is


required, it is best not to set this property until the database is fully
working.

Indexed This allows data to be stored in the order of this field which speeds up
searches.

Allow Zero Length This is used with text fields to decide whether records in that field are
allowed to contain zero length or empty text strings

Unicode Compression This is a method of compressing the data entered in this field.

IME Mode Input Method Editor, allows special character input

Operating Database Applications11|P a g e


Smart Tags Access 2003 option

Setting Input Masks


Input masks make data entry easier. They display on screen a pattern for the data to be entered into a
field.
They are suitable for data that always has the same pattern such as dates, times, currency and also for
codes like stock numbers or postcodes.
Characters for input masks are likely to use are as follows:
0 A number (0 – 9) must be entered.
9 A number (0 – 9) may be entered.
# A number, + or – sign or space may be entered
L A letter A – Z must be entered
? A letter A – Z may be entered
A A letter or digit must be
entered a A letter or digit may
be entered &
Any character or space must be entered
C any character or space may be entered
< All characters to the right are changed to lower
> All characters to the right are changed to lower

Examples of input masks:


A National Insurance number in UK must be in the form AB123456C.
All letters are in capitals.
Its input mask would be >LL000000L. (It must be 2 letters followed 6 numbers and 1 letters.)

A postcode consists of one or two letters, then one or two numbers, then a space, a number and two
letters. All the letters must be capital letters. Examples are B11BB or DE13 0LL The input mask would
be >L?09 0LL

Operating Database Applications12|P a g e


Car registration numbers such as FW57 STZ could have>LL00 LLL as an input mask.

A driving license number in the form BESWO150282 MB9BM could have >LLLLL#000000#LL0LL
as an input mask.

Product Codes of the format A2C-123-456. A possible input mask might be AAA-000-0000.

Input masks are very powerful and need a lot of thought. It is possible to use the Input Mask Wizard to set
up an input mask for a field. At this stage you may wish to ignore input masks unless you know the exact
format of the input data.

The Format Field Property


The format supplied with Access will suit practically all your needs. However, it is possible to set a
custom format of your own. Two commonly used examples follow:
< will change text entered in the field to upper case
> will change text entered in the field to lower case

The Default Field Property


Default values are added automatically when you add a new record.

You can also use expressions in the field property. Typically = Date() will return t current date from your
PC.

In a Library Book Loaning system, the default value for the Date of Loan field could be set to =Date()
and similarly for the Date of Return, the default value could be set to = Date() + 14 (assuming a 14 day
loan period).

Operating Database Applications13|P a g e


Setting validation rules
Validation rules allow you to control the values that can be entered into a field.
By setting the validation text property you can choose the message that is displayed if the validation rule
is broken.
You set up a validation rule by typing an expression into the field properties.

The user will be forced to only enter


numbers between (and including) 1

If they do not, the Validation Text message is displayed as shown below:

A number of comparison operators are available:


Operator Meaning
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
= Equal to
<> Not equal to
IN Test for ‘equal to’ any item in a list
BETWEEN Test for a range of values; the two values separated by the AND
operator
LIKE Test a Text or Memo field to match pattern string of characters

Operating Database Applications14|P a g e


E
>8000 Please enter a salary greater than 8000
<#01/01/01# You must enter dates before January 1, 2001
>Date() The date returned must be after today’s date.
“S” or “M” or “L” Sizes can only S, M, or L
Between 0 and 36 Goal scored cannot be greater than 36.
Like “A????” Code must be 5 characters beginning with A.
<20 Age of student must be less than 20.
IN(“A”, “B”, “C”) Grades must be A, B or C
Validation Rule Settings Possible Validation Text
X
A
M
P
L
ES

Operating Database Applications15|P a g e


Self-Check 1 Written Test

Name: ______________________________________ Date: ________________________________________

Time started: _______________________________ Time finished: _______________________________

Directions: Answer all the questions listed below.

I. Matching Type. Write the letter of the term in found in column B that matches the description in
column A. Write your answer in the space provided b to the terms in column B. Write the letter of
before each item. (10 points)

COLLUMN A COLUMN B

_______1. A value that is added automatically when a new record is added in the a.
Input masks database.
_______2. An input masks character which means that any character or space may
be b. LIKE entered.
_______3. Collection of related data. c. Field
_______4. Defines what sort of data to expect in a field. d. Information
_______5. It is also commonly called a column or attribute. e. Report
_______6. It is the error message if the data entered is invalid. f. Validation text
_______7. It provides a professional – looking output from the table or query. g. Database
_______8. Tests a text or memo field to match pattern string of characters. h. IN
_______9. Tests for ‘equal to’ any item in a list. i. C
j.
AND
_______10. Used to display on screen a pattern for the data to be entered into a field.
k. Data type
l. Default Value

Operating Database Applications16|P a g e


II. Answer the following with what are asked for.

1. Enumerate the different database objects. (7 points)

2. What are the three things to consider in establishing a naming convention? (3 points)

Answer Key:
I. Matching Type
1. L
2. I
3. G
4. K
5. C
6. F
7. E
8. B
9. H
10. A

II.
1. Tables
2. Queries
3. Forms
4. Reports
5. Macros

Operating Database Applications17|P a g e


6. Modules
7. Page

8. It provides a clear structure, each component using the standard naming rules.

9. The database logic can be understood by anyone knowing the naming convention.

10. Maintenance work is reduced, as future developers will not have to waste time figuring out what each
field is.

Operation Sheet 1 Setting Up and Entering the Data in the Student Table

1. Load Microsoft Access. Click on Create New File …


2. Select Blank Database(See Figure below)
Note: Figure below may not be the same if you are using another version of MS Access.

3. Use the Save in drop-down box to locate where you want to save your database. Name the file
ITSMSchool and click Create.
The Database Window loads, this is the control centre from which you can design tables, queries, forms, reports
and macros.

Operating Database Applications18|P a g e


4. Click on Tables and click on New.
5. Click on the Design View and click on OK.
The Table Design window appears as shown below:

DEFINING THE FIELD NAMES AND DATA TYPE


1. Enter the first Field Name: StudentID and press TAB or RETURN to move to the Data Type field.
After entering the Field Name you will notice Field Properties are displayed in the lower half of the
window, we will enter these later.
2. Click on the drop-down and select AutoNumber

Operating Database Applications19|P a g e


Operating Database Applications20|P a g e
5. Set the studentID field to be the key field by clicking on the row selector for this field and clicking on the
Primary Key icon of the Table Design toolbar or click on Edit, Primary Key. A small picture of a key
appears to the left of the Field Name.

6. YourTable Design window should appear as in the figure below. Save the table by closing the window
or by choosing File, Save. The Save As dialogue box will appear, name the table Student.

EDITING TABLE STRUCTURE

During the course if setting up the table it is probable you will make mistake or decide to make a change to
your table’s structure.
Inserting a Field
Click on the row selector of the field below the insertion point.
Press the Insert key on the keyboard or click the Insert Row icon on the toolbar.
Deleting a Field
Click on the row selector of the field to delete.
Press the Delete key on the keyboard or click the Delete Rows icon on the toolbar.
Moving a Field

Operating Database Applications21|P a g e


Click on the row selector of the field you wish to move.
Click again new and drag it to its new position – a black line marks the insertion point.
Changing the primary key field
You can only have one primary key. If you have set the wrong field as the primary key, remove it as follows:
• Click on the row selector of the correct field.
• Click on Edit, PrimaryKey or click the PrimaryKey icon on the toolbar.

SELECTING THE FIELD PROPERTIES


When you click on a field in Design View its field properties are displayed in the lower half of the
window.
We will go through each field in the Student table and set its field properties including input masks where
appropriate.
STUDENTID
1. From the Database Window click on Tables, select Student and click on Design.
2. The StudentID field should be the one selected. If not, click in the row selector for StudentID.
3. In the Field Properties set t Field Size to Long Integer.

TITLE
The Title field can only have the values Mr, Mrs, Miss and Ms. We can use the Lookup Wizard
whenever we want to restrict the data entered into a field to certain values.
1. Click on the Title field name.
2. In the Data Type column click on Lookup Wizard.

Operating Database Applications22|P a g e


3. Click on ‘I will type in the values that I want.’ and click on Next.

Operating Database Applications23|P a g e


4. Enter Mr, Mrs, Miss and Ms into the column, press TAB to move to the next row.

5. Click on Next and then click Finish.

6. In the Field Properties set the Field Size to 6

Operating Database Applications24|P a g e


7. If you click on the Lookup tab you will see the screen shown below:

SURNAME, FIRSTNAME, ADDRESS1 AND ADDRESS2

1. Select the Field Name: Surname and set the Field Size to 20, repeat for Firstname.
2. Select the Field Name: Address1 and set the Field Size to 30, repeat for Address2.
TELNO
Select the Field Name: TelNo and set the Field Size to 15.

DATEOFBIRTH
The student table uses three Date/Time fields. We will use the Short Date format for each.
1. Select the DateOfBirth field.
2. Click on the Format box in the Field Properties.
3. A drop-down list appears. Choose Short Date

It is also possible to use the Input Mask wizard to set a placeholder _ _ / _ _ / _ _ _ _ for each date
entered.

Operating Database Applications25|P a g e


4. Click on the Input Mask property box and click the three dots icon at the end of the row or the Build
icon on the Table Design toolbar, you will be asked to save you table first. The Input Mask Wizard
window is shown:

5. Select the Short Date option and click Next.

6. A choice of placeholders is offered.. Click on Next and then click on Finish

Operating Database Applications26|P a g e


7. Repeat this for the two Date / Time fields, TheoryTestDate and PracticalTestDate
GENDER
The Gender field can only have the values M and F. We can use the Validation Rule box in the Field
Properties only to allow M or F.
1. Click the Gender Field Name
2. In the Validation Rule box enter M or F.
3. In the Validation Textbox enterGender must be either M or F. This is the error message that will
appear if the user tries to enter anything other than M or F into this field.
4. Save your table as Student.

ENTERING THE DATA


In the Database Window select Student and click Open on the toolbar to open the table in Datasheet
View

Operating Database Applications27|P a g e


Note: You can switch between modes by selecting View, Design View from the menu.
Enter the details of the student, Jan Carlo, as given below. Use TAB or ENTER to move between fields.

You will notice a number of features as you enter the data.


• The StudentID which is an AutoNumber field is entered automatically.
• The Title field has a drop-down box set up by the lookup table wizard.

• Data entered into the Gender field is validated and any invalid entries rejected.

• Placeholders appear in the fields where you have to set input masks to make data entry easier.
• Enter data into Yes/No fields by ticking the check box for Yes and leaving unchecked for No

Operating Database Applications28|P a g e


• When you have entered the last field in a record, a blank record appears underneath to enter the
next record.
Don’t worry if your table finishes with a blank record. MS Access will ignore it.
• Data is saved as soon as it is entered. Adjust the column widths by dragging out the column dividers.
Navigation buttons appear at the bottom of the screen allowing you to scroll through the records

Complete the table Student by entering the following data:

When you finished entering the data, close the table by clicking on the Close icon. You will return to the
Database Window with the name of the table highlighted.

USEFUL KEYS FOR ENTERING DATA:


Key Action
TAB key, ENTER or Right Arrow Move to the next field
SHIFT + TAB key or Left Arrow Move to previous field
Down Arrow Move to the next record
Up arrow Move to the previous record
HOME Move to start of field
END Move to end of field

Operating Database Applications29|P a g e


Operating Database Applications30|P a g e
Self-Check 2 Setting Up and Entering the Data in the Tables

Name: ______________________________________ Date:


________________________________________

Time started: _______________________________ Time finished:


_______________________________

SET-UP AND ENTER DATA IN PRODUCT TABLE:


Field Name Data Type Other Information
ProductCode Text Field Size: 4
Set as Primary Key field
Set Input Mask
Product Type Text 20
Size Number Integer
CostPerDay Currency
Status Text Field Size: 10 Lookup: Availableor Not
Available
PictureofProduct OLE
Description Text Field Size: 30

Save the table as Product and switch to Datasheet View mode to enter:
ProductCode Size CostPerDay Status PictureofProduct Description
Product
Type
BB01 Bouncy 15 80.00 Available For Rent
Boxing

Operating Database Applications31|P a g e


BR02 Bungee 12 150.00 Available For Rent
Run
FB06 Forest 13 45.00 Available For Rent
Bouncer

SET-UP AND ENTER DATA IN HIRE TABLE:


Field Name Data Type Other Information
HireNumber AutoNumber Set as Primary Key field

ProductCode Text Field Size: 4


CustNumber Text Field Size: 3
Date of Delivery Date/Time Format: Short Date and set Input
Mask
DaysRequired Number Integer
Set Validation to : 1 to 14 days

Save the table as Hire and enter this data

Product Code CustNumber Date of Delivery Days Required

BB01 001 07/12/2011 12

BB01 002 01/01/2012 7

FB06 001 02/01/2012 10

BR02 003 02/17/2012 6

SET-UP AND ENTER DATA IN CUSTOMER TABLE:


Field Name Data Type Other Information

CustNumber Text Set as Primary Key field


Field Size: 3

Operating Database Applications32|P a g e


Title Text Field Size: 4, Mr, Ms, Mrs
Surname Text Field Size: 20
Firstname Text Field Size: 20
Address Text Field Size: 30
Default Value: DebreBirhan
TelNo Text Field Size:

Save the table as Customer and enter this data:


CustNumber Title Surname Firstname Address TelNo

001 Mr Bitanga Rex DebreBirhan 0922123984

002 Ms Dulin Jeymie Bahir Dar 0922585331

003 Mrs de la Cruz Cassandra DebreBirhan 0911345677

Self-Check 2 Setting Up and Entering the Data in the Tables

Name: ______________________________________ Date:


________________________________________

Time started: _______________________________ Time finished:


_______________________________

SET-UP AND ENTER DATA IN SUBJECT TABLE:


Field Name Data Type Other Information
SubjectCode Text Field Size: 5
Set as Primary Key field
Set Input Mask

Operating Database Applications33|P a g e


DescTitle Text 20
StartTime Date/Time Short Time
Set Input Mask
EndTime Date/Time Short Time
Set Input Mask
Day Text Field Size: 8
Lookup: Monday, Tuesday, Wednesday,
Thursday, Friday
Room Text Field Size: 3
Set Input Mask

Save the table as Subject and switch to Datasheet View mode to enter:
SubjectCode DescTitle StartTime EndTime Day Room
IT001 Communications 1 07:30 12:00 Monday J41
CR002 Basic Construction 13:30 17:00 Tuesday A12
EE016 Digital Design 8:00 12:00 Friday B14

SET-UP AND ENTER DATA IN STUDENT TABLE:


Field Name Data Type Other Information

IDNumber Text Set as Primary Key field


Field Size: 13
Set Input Mask
Surname Text Field Size: 20
Firstname Text Field Size: 20
Address Text Field Size: 30
Default Value: DebreBirhan
TelNo Text Field Size: 10

Operating Database Applications34|P a g e


Save the table as Student and enter this data:

IDNumber Surname Firstname Address TelNo

ITSM-LV-02/03 Bitanga Rex DebreBirhan 0922123984

ITSM-LV-01/03 Dulin Jeymie Bahir Dar 0922585331

ITSM-LV-03/03 de la Cruz Cassandra DebreBirhan 0911345677

SET-UP AND ENTER DATA IN ENROL TABLE:


Field Name Data Type Other Information
EnrolNumber AutoNumber Set as Primary Key field
IDNumber Text Field Size: 13
SubjectCode Text Field Size: 5
EnrolmentDate Date/Time Format: Short Date and set Input
Mask

Save the table as Enrol and enter this data

EnrolNumber SubjectCode EnrolmentDate


IDNumber

1 ITSM-LV- IT001 02/15/2012


02/03

2 ITSM-LV- IT001 02/15/2012


01/03

3 ITSM-LV- CR002 02/17/2012


03/03

Operating Database Applications35|P a g e


Setting Up and Entering the Data in the
Self-Check 2
Tables

4 ITSM-LV-02/03 EE016 02/18/2012

SET-UP AND ENTER DATA IN INSTRUCTOR TABLE:


Field Name Data Type Other Information
InstructorID AutoNumber Set as Primary Key field
Title Text Lookup Table values : Mr, Ms, Mrs,
Miss
Field Size: 6
Surname Text Field Size: 20
Firstname Text Field Size: 20
Address Text Field Size: 30
HomeTelNo Text Field Size: 15
MobileNo Text Field Size: 15

Save the table as Instructor and switch to Datasheet View mode to


enter:
InstructorID Title Surname Firstname Address HomeTelNo MobileNo
1 Mr Jones Derek Pilton 0919932125 0917656734
2 Mr Smith Tony Blakeway 0918908657 0916308789
3 Mr Batchelor Andrew Makati 0917676533 0920786456

Operating Database Applications36|P a g e


SET-UP AND ENTER DATA IN LESSON TYPE TABLE:
Field Name Data Type Other Information
LessonType Text Set as Primary Key. Field Size : 25
Cost Currency

Save the table as LessonType and enter this data

Lesson Type Cost

Introductory 150

Pass Plus 200

Standard 400

Test 300

SET-UP AND ENTER DATA IN LESSON TABLE:

Field Name Data Type Other Information


LessonNo AutoNumber Set as Primary Key field
StudentID Number Long Integer
InstructorID Number Long Integer
Date Date/Tme Format: Short Date and set Input Mask
StartTime Date/Time Format: Short Date and set Input Mask
LenghtOfLesson Number Integer and set validation rule as: Between 1 and 8.
Text – Please enter a number between 1 and 8. Set
the default value = 1
CollectionPoint Text Default value = “Home Address”
Field Size 30

Operating Database Applications37|P a g e


DropOffPoint Text Default value = “Home Address”
Field Size 30
LessonType Text Lookup table values: Introductory, Standard, Pass
Plus, Test
Field Size 25

Save the table as Lesson and enter this data:


LessonNo StudentID InstructorID Date StartTime CollectionPoint LessonType
LenghtOfLesson DropOffPoint
1 1 1 28/07/2008 9:00 1 Home Address Standard
Home Address
2 2 1 28/07/2008 11:00 2 Home Address Standard
Home Address
3 3 1 28/07/2008 14:00 Home Address Home Standard
1 Address

Operating Database Applications38|P a g e


Operation Sheet 2 Defining the Relationships

Adding the Tables


1. In the Database Window, open the Relationships window by any of these three methods:
• Right click anywhere in the window and select Relationships.
Click on the Relationships icon on the Database
toolbar if showing
• Click on Tools, Relationships from the menu bar.

2. Click on Instructor and click Add.


3. Add the other three tables and then Close the window.
4. In the Relationships window rearrange the position of the tables by dragging and resizing the table
windows.

Operating Database Applications39|P a g e


SETTING THE LINKS
1. Click on the InstructorID in the Instructor table.
2. Drag it on top of InstructorID in the Lesson and let go. The EditRelationships dialogue box appears.

3. Check the Enforce Referential Integrity box but DO NOT check the Cascade Delete Records box.
Click on Create.
** A link called the Relationship Line is set up between the two tables.
4. Click on the StudentID field in the Student table and drag it on top of the of the StudentID field in the
Lesson.
5. Check the Enforce Referential Integrity box and click on Create.
6. Repeat the process for the LessonType field, dragging it from LessonType table to Lesson and check
Enforce Referential Integrity.

Operating Database Applications40|P a g e


The Relationship window should now look like the figure below:

Note: The number 1 and the infinity symbol (∞) mean that all three relationships are one-to-many. A
StudentID appear only one time in the Student table as it is a unique ID. However, a StudentID can
appear many times in the Lesson table as the student needs many lessons.
Similarly, the InstructorID can only appear once in the Instructortable but many times in the Lesson.
The LessonType can appear only once in LessonType table but many times in Lesson table.
7. Save the layout by clicking File, Save from the menu.
REFERENTIAL INTEGRITY
Referential integrity is a system of rules that MS Access uses to ensure that relationships between records
in related tables are valid and that you don’t accidentally delete or change related data.

CASCADING UPDATES AND DELETES


Cascading updates and deletes affect what MS Access does with the data when you update or delete a
record in a table that is related to other records in other tables.
If cascade delete is set, then when you delete a record in the Primary table all related data in other tables
is deleted.

DELETING RELATIONSHIPS
If you wish to delete a relationhip:
1. Open the Relationship window as before.
2. Click in the RelationshipLine of the relationship you wish to delete and press delete key. Alternately,
you can right click on it and choose delete.

Operating Database Applications41|P a g e


Note: If you wish to delete a field that contains a relationship, you will have to delete the relationship first.
EDITING RELATIONSHIPS
You can edit relationships by going to the Relationship window and double clicking on the Relationship
Line of the relationship you wish to edit.

Information Sheet 2 Creating Other Database Objects

RELATIONSHIPS
Keeping data separated in related tables produces the following benefits:
• ConsistencyBecause each item of data is recorded only once, in one table, there is less opportunity for
ambiguity or inconsistency.
For example, you store a customer's name only once, in a table about customers, rather than storing it
repeatedly (and potentially inconsistently) in a table that contains order data.

• Efficiency Recording data in only one place means you use less disk space. Moreover, smaller tables
tend to provide data more quickly than larger tables. Finally, if you don't use separate tables for
separate subjects, you will introduce null values (the absence of data) and redundancy into your tables,
both of which can waste space and impede performance.

• Comprehensibility The design of a database is easier to understand if the subjects are properly
separated into tables.

FORMS
A form is a type of a database object that is primarily used to enter or display data in a database. Most forms
are bound to one or more tables and queries in the database. A form's record source refers to the fields in
the underlying tables and queries.

Forms may be created by either:


• Form wizard

Operating Database Applications42|P a g e


• Design view

Creating Forms using a wizard


Creation of a form by using a wizard is the Ms Access pre-defined way of creating a form by simply
following the series of steps and choosing which field and format you would want for your form.

Creating Forms using design view


Creation of a form by design view is a user customized way of making data entry forms, Switchboard
form and even custom dialog box. Each control in the design view of a form was being dragged from the
control toolbox.

QUERIES
A query is a derived item in the database meant to answer specific questions that relate to the information
in the database. It is the means to retrieve relevant information in one or more tables. Queries are handy
during data processing.

Queries may be created by either:


• Query wizard
• Design view
• SQL View

Creating Queries using a wizard


Creation of a query by using a wizard is a fastest and easy way to extract information you need from
one or more tables.

Creating Queries using design view


Creation of a query by design view is a user customized way of setting-up criteria to filter the
necessary information you need from one or more tables.

Operating Database Applications43|P a g e


Creating Queries using SQL view
Creation of a form by SQL view is another option but not normally being use by Ms Access
programmers. It requires an understanding of the Structured Query Language statements.

REPORTS
Reports provide a means of organizing and summarizing data. Reports are often used to present an
overview highlighting main points and trends. A report can be a simple list, a status report or a monthly
production report.

A report is made from the data available.

Reports may be created by either:


• Report wizard
• Design view
Creating Reports using a wizard
Creation of a report by using a wizard is a fastest and easy way to create a report by following the series
of steps and choosing a pre-defined template for your report.

Creating Reports using design view


Creation of a report by design view is a user customized way setting-up your report so to meet the users
desired output and format.

MACROS
Macros in Access can be thought of as a simplified programming language which you can use to add
functionality to your database. For example, you can attach a macro to a command button on a form so
that the macro runs whenever the button is clicked. Macros contain actions that perform tasks, such as

Operating Database Applications44|P a g e


opening a report, running a query, or closing the database. Most database operations that you do manually
can be automated by using macros, so they can be great time-saving devices.
A macro is essentially a list of actions that you apply to objects to respond to events. Each action carries
out one task. You create your actions in the order you want them to execute. In addition, you specify the
arguments of the actions, giving the program additional information as needed.
You can set conditions for each action in a macro to determine whether it runs or not. Run a macro by
applying it to the event property of an object. Once the specified event occurs the macro will run by
running the all the specified actions. Actions that have conditions applied to them may or may not run
depending on whether or not they passed the conditional tests.
Once you've created your macros you'll see them listed in the Macros tab in the Database window. This
way you can attach any macro to any event property in your database.
MODULES

Modules, like macros, are objects you can use to add functionality to your database. Whereas you create
macros in Access by choosing from a list of macro actions, you write modules in the Visual Basic for
Applications (VBA) programming language. A module is a collection of declarations, statements, and
procedures that are stored together as a unit. A module can be either a class module or a standard module.
Class modules are attached to forms or reports, and usually contain procedures that are specific to the form
or report they're attached to. Standard modules contain general procedures that aren't associated with any
other object. Standard modules are listed under Modules in the Navigation Pane, whereas class modules are
not.

Now that you know how to put together a program, you are ready to give it a try. To create a VBA
procedure, you follow many of the same steps you follow when you created macros. The general steps in
VBA programming are as follows:
1. Identify the task you want to accomplish.
2. Plan the steps needed to accomplish that task.
3. Create the programming code necessary to implement the steps.
4. Test the program.
5. Refine the program.

Operating Database Applications45|P a g e


6. Repeat steps 4 and 5 until the program works correctly.
You create VBA programming code by using the VBA Editor, which is described in the following
section.

What is the VBA Editor?


You create VBA programs using the VBA Editor. To start the VBA Editor, first click your mouse on
the Modules button in the Database window. Then, click your mouse on the New button. Access, in
turn, displays the VBA Editor, as shown in Figure 20-1.

The VBA Editor

Notice that there are several different parts to the VBA Editor. In the upper left corner is what the
editor refers to as the Project window. This is where you can see the different elements of your project
and any modules that have been defined in the workbook. Just below the Project window is the
Properties window. Here you can specify different attributes of whatever you have selected in the
Project window. For most simple development needs, you will never do much with the Properties
window. To the right of the Properties window, and at the very bottom of the screen, is the immediate
window. This is where you can either test parts of your procedures during development or you can
find the immediate results of various commands. The Immediate window comes in very handy during
testing and debugging, when they are necessary.

Operating Database Applications46|P a g e


Note: If a window is not displayed within the VBA Editor, you can display it by choosing one of the
options from the View menu. For instance, if you want to display the Project window, choose Project
Explorer from the View menu.
The Module window, which is the largest window on the screen, is where you do your programming.
At the top of the Module window are the two drop-down lists. The one on the left is called the Object
box. The one on the right is the Procedure box. You use the Object box to select which object you
want to work with. When you first create a module, the object is set to the word General, meaning you
are working on a general module, not on one associated with a particular object in a form or report.

The Procedure box is where you indicate the name of the procedure on which you want to work. If
you choose or specify a different procedure in this box, the information Access shows in the Module
window changes to reflect the VBA statements you have assigned to that procedure.

The top level of a module is the Declarations section; It begins with the procedure name you indicate
in the Procedure box when you first create a module. Take a look at the Module window (Figure 20-
1). It contains the programming code already defined for the declarations section. In this instance,
there is only one line of code defined--a statement that indicates the database's default sort order.

To enter programming statements into a procedure, you type them in the Module window. As you
enter information, Access checks to make sure it can understand what you type. In other words,
Access checks the syntax of what you enter. You use the correct syntax when you follow the VBA
rules of grammar.

You can cut, copy, and paste sections of code using standard Windows mouse or keyboard techniques.
You can perform these operations either in the same procedure or between different procedures.

Operating Database Applications47|P a g e


DATA ACCESS PAGES
A data access page is a special type of Web page designed for viewing and working with data from the
Internet or an intranet— data that is stored in a Microsoft Access database or a Microsoft SQL Server
database. The data access page may also include data from other sources, such as Microsoft Excel.
Using a data access page is similar to using a form: You can view, enter, edit, and delete data in a
database. However, you can also use a page outside a Microsoft Access database, so users can update or
view data over the Internet or an intranet.
Parts of a data access page
• The body - The body is the basic design surface of a data access page. On a page that supports
data entry, you can use it to display informational text, controls bound to data, and sections.
• Sections - You use sections to display text, data from a database, and toolbars.
Two types of sections are typically used on pages that support data entry: group header and record
navigation sections. A page can also have footer and caption sections.
• Group header and footer Used to display data and calculate values.
• Record navigation Used to display the record navigation control for the group level. A record
navigation section for a group appears after the group header section. You can't place bound
controls in a record navigation section.
• Caption Used to display captions for text boxes and other controls. It appears immediately
before the group header. You can't place bound controls in a caption section.
Each group level in a data access page has a record source. The name of the record source is displayed
on the section bar for each section used for a group level.
Designing different types of data access pages
You design data access pages in Design view in Microsoft Access. The page is a separate file that
is stored outside Access; however, when you create the file, Access automatically adds a shortcut
to the file in the Database window. Designing a data access page is similar to designing forms and
reports— you use a field list, the toolbox, controls, and so on. However, there are some significant
differences in the way that you design and interact with data access pages as opposed to forms and
reports. How you design the page depends on what it will be used for:
• Interactive reporting. This type of data access page is often used to consolidate and group
information that is stored in the database, and then publish summaries of the data. For example, a

Operating Database Applications48|P a g e


page might publish the sales performance for each region in which you do business. Using expand
indicators, you can go from a general summary of the information, such as a list of all the regions
and their combined sales total, to specific details on individual sales within each region. The data
access page might provide toolbar buttons for sorting and filtering the data, as well as for adding,
editing, and deleting the data in some or all group levels.
• Data analysis. This type of data access page may include a PivotTable list, similar to a
Microsoft Excel PivotTable report, that lets you reorganize the data to analyze it in different ways.
The page might contain a chart that you can use to analyze trends, detect patterns, and compare
data in your database. Or it might contain a spreadsheet, in which you can enter and edit data and
use formulas to calculate as you do in Excel.
Using data access pages in Internet Explorer
A data access page is connected directly to a database. When users display the data access page in
Internet Explorer, they are viewing their own copy of the page. That means any filtering, sorting,
and other changes they make to the way the data is displayed— including changes they make
within a PivotTable list or spreadsheet— affect only their copy of the data access page. However,
changes that they make to the data itself— such as modifying values, and adding or deleting
data— are stored in the underlying database, and therefore are available to everyone viewing the
data access page.
Note To view and work with the data access page on the Internet or an intranet, users need
Microsoft Internet Explorer 5.01 with Service Pack 2 (SP2) or later.
Using data access pages in Microsoft Access
You can also work with a data access page in Page view in Access. Data access pages can
supplement the forms and reports that you use in your database application. When deciding
whether to design a data access page, form, or report, consider the tasks that you want to perform.

Operation Sheet 3 Setting up Forms using Wizard


Be sure to open first ITSMSchooldatabase.

Setting up the Student Form using


1. Click on the Student table.

Operating Database Applications49|P a g e


2. On the Create tab, in the Forms group, click Form Wizard.

3. The Form Wizard window opens with the available fields.

The single arrow allows you to select one


field at a time and the left arrows allow you to
deselect fields. Use the single arrow to choose
selected fields in the different order from that
shown.

4. Click the double arrow (>>) to put all available fields across to the
selected fields and click on Next.

5. Select Columnarfrom the range of layouts shown and click Next.

6. Place Student as title of the form. Select Open the form to view or enter information. Click Finish to
save your form.

Setting up the Lesson Type form using Form Wizard

Operating Database Applications50|P a g e


1. On the Create tab, in the Forms group, click Form Wizard.
2. Click the double arrow (>>) to put all available fields across to the selected fields and click on Next.
3. Select LessonType table from the drop-down list and click OK.
4. The form is generated automatically and opens in Form View as shown below. Save the form in the usual
way calling it LessonType.

THE DIFFERENT FORM VIEWS


There are three(3) different views to a form:
• Form View
• Datasheet View
• Design View

FORM VIEW
Form View allows to view and edit records one at a time. Enter Form View form the Database Window by
selecting the form and clicking on Open.

DATASHEET VIEW
Datasheet View allows you to view and edit the records all on one screen. The form LessonType is shown in
Datasheet View.

DESIGN VIEW
Design View allows you to edit the form. Enter the Design View from the Database Window by selecting
form and clicking on Design.

Operating Database Applications51|P a g e


SWITCHING BETWEEN VIEWS
There are a number of ways switching between Form View, Design View and Datasheet View windows. The
easiest way is to select from one of the first three options on the View menu using view icon.

WORKING ON FORM DESIGN VIEW


Form Design View
1. In the Database Window click on Forms and select Student. From the menu choose Edit, Copy.
2. Click in the Database Window and choose Edit, Paste. Name the form StudentCopy.
Note: The two steps above are only done because we want to start working on a copy of a form so that if
you make a mistake it will not affect the final system.
3. Open StudentCopy in Design View by selecting StudentCopy and clicking on Design.

Operating Database Applications52|P a g e


The form opens with the following features showing:
• A Form Header section – this area can contain text, headings, titles and graphics. Toggle the Form
Head off and back on by choosing from the menu View, Form Header.
• A Detail Section – this contains the controls that display the data in your tables.
• A number of Controls each made up of a Label containing field name and a text box which will
contain the data in Form View.
• A Toolbox from which you can add text, lines, shapes, controls, buttons and other features. Toggle
the Toolbox
WORKING WITH CONTROLS
The Detail section is initially made up of controls which display the data from your tables. The controls
are made up of text boxes, check boxes and attached labels.
In the Database Window click on Forms and select StudentCopy again. Click on Design to open the
form in Design View.
Selecting Controls
• To resize, move, delete, copy or change the properties of a control, first you must select it.
• Simply click anywhere on the control and it will be highlighted with sizing handles as shown below:

• To select more than one control, simply drag out a rectangle across the controls you wish to select or
Select the first control and hold down SHIFT while selecting further controls. Resizing
Controls
• Click on the control to select it and then drag the resizing handles in or out to resize it.

Operating Database Applications53|P a g e


Moving Controls
• Click on the control to select it. To move the control and its labels, move the pointer to the border of
the control. The pointer turns into a four-headed pointer. Drag the control to a new position.
Deleting Controls
• To delete a control simply select the control and press the DELETE key.

Adding a Control
• If you want to add a control for a field, click Add Existing Fields. The Field List will appear on the
screen and you can highlight the field and drag and drop it to the required position.

Operating Database Applications54|P a g e


Operation Sheet 4 Setting up Queries

There are usually five steps involved in planning a query:


• Choosing which tables to use.
• Choosing fields needed in your query.
• Setting the criteria to produce the output required.
• Running the query.
• Saving and/or printing the results.

QUERY 1
1. Load the ITSMSchool database.
2. In the menu, click Create and select Query Design.

3. In the Show Table window select Lesson, click on Add and then Close.

Operating Database Applications55|P a g e


The Query Design View window is now shown.
The window is in two sections. The upper section contains the field list for the table used in the query
and the lower section contains the QBE (Query by Example) grid where you design the query.

Five Rows of QBE


Field Contains the names of the fields needed for your query.
Table Holds the name of the table containing the selected field.
Sort Offers ascending, descending sort options.
Show Allows you to hide fields from the output.
Criteria This is where you enter the criteria for your search.

4. Double click on LessonNo in the table Lesson field list. Then double click on each of the next fields in
turn: StudentID, InstructorID, Date, StartTime, LengthOfLesson. The fieldnames will appear in the
grid as shown below:

Operating Database Applications56|P a g e


5. Now select the criteria by entering 28/07/2008.

6. To run the query click on the Datasheet View icon.


7. Once the query has been run it can be printed using File, Print.
8. Save the query as LessonOnDate by clicking on the Save icon on the toolbar.

QUERY 2 Finding the contact details for students who have not passed the theory test.
1. In the menu, click Create and select Query Design.
2. In the Show Table window select Student, click on Add and then Close.
3. Select StudentID in Student table and drag it to the field cell.
4. Drag and drop the fields Surname, Firstname, TelNo and PassedTheoryTest in the same way. The
fieldnames will appear in the grid as below.
5. Now select the criteria by entering No in the criteria row the PassedTheroryTest column. Searching
Yes/No fields is justYes or No in the criteria cell.
6. To run your query click on Datasheet View icon.

Operating Database Applications57|P a g e


Some Further Hints
Adding and Removing Tables
• To remove a table from the Query Design grid, double click the title bar or the field list box and press
DELETE.
• To add a table grid click on the Show Table icon.

QUERY 3 Producing a list of instructor’s names and addresses


We will use the Query wizard to design the next query.
1. In the Database Window click on Instructor table.
2. Select Create and click on Query Wizard icon.
3. Choose Simple Query Wizard and click OK.
4. Select the field InstructorID in the Available Fields and then click the right arrow >.
5. Repeat this process for the fields Surname, Firstname, Address as shown below:

Operating Database Applications58|P a g e


6. Click on the Next, name the query InstructorAddr and click on Finish.
7. The resulting query opens in Datasheet View.

QUERY 4 Finding lessons between dates


Suppose you wish to view lessons between certain dates or to print a list of lessons for the coming week.
You can select a range of records using the operators <, >, <=, >=, +, -, BETWEEN, AND, NOT.
1. In the Database Window select Create and click on Query Design.
2. In the Show Table window select Lesson, click on Add and then Close window.
3. Add the fields LessonNo, StudentID, InstructorID, Date and CollectionPoint.
4. In the criteria row of the Date column enter >30/07/08 and <02/08/08 as shown in the figure below:

5. Run the query to view the records and save the query as BetweenDates.

Operating Database Applications59|P a g e


Note: This query could also have been designed by entering the expression Between 31/07/08 and 01/08/08 in
the criteria row of the Date field cell. The expression includes the stated dates.

QUERY 5 Finding lessons for an instructor on a given date.


It is possible to specify criteria in more than one field. For example you may want to see the
details of a specific instructors’ lesson on a certain date. This is sometimes known as an AND
search because it involves the InstructorID field and the Date field.
1. In the Database Window click on Create and select Query Design.
2. In the Show Table window select Lesson, click Add and then Close the window.
3. Add the fields StudentID, InstructoID, Date, StartTime, CollectionPoint and LessonType.
4. In the criteria row of the InstructorID column enter 2 and enter 31/07/2008 in the criteria cell for Date as
shown in the figure in the next page.
5. Run the query to view the records. Save your query as InstructorAndDate.

Operating Database Applications60|P a g e


Operation Sheet 5 Setting up Report

In this unit, you will learn how to set-up reports to output information from the database.
REPORT 1: Setting up report to of set-up instructor contact details.
We want to set-up a report to show a list of all instructors and their contact details. This report will be based on
the Instructor table.
1. At the Database Window select Create and click Report Wizard.
2. In the Tables/Queries tab, choose Instructor.
3. Select all fields of the Instructor table and click Next.
4. In the grouping level dialog box, click Next.
5. Choose Surname and ascending order for the sort dialog box. Click Next.
6. Click on Tabular and click Next.

7. Choose Access 2007 style and click Next.


8. Type Instructor as the title of your form, choose Preview the Report and click Finish.

DESIGN VIEW
The Design View window allows you to customize your report to suit your requirements. Reports are
edited in the same way as editing forms. As with forms it is possible to:
• Add, edit and remove fields
• Add text and titles

Operating Database Applications61|P a g e


• Change the style and layout
• Change the font format and colours
• Add controls and command buttons
• Add images
Click on Design View to see Instructor report in the Design View

The top part of the report is the Report Header. Controls in the Report Header appear only once at the
beginning of the report. It is suitable for titles.

The second part of the reports is the Page Header. Controls in the Page Header appear at the top of every
page. It is suitable for column headings.

The third part of the report is the Detail. This is used for the data in the report.

The fourth part of the report is the Page Footer. Controls in the Page Footer appear at the bottom of
every page. It is here the wizard has inserted the page number and date.

The final part of the report is the Report Footer. Controls in the Report Footer appear only once at the
end of the report.

CUSTOMIZING THE INSTRUCTOR CONTACT DETAILS REPORT

Operating Database Applications62|P a g e


We are going to edit the Instructor report, some of the columns are to wide and some are too narrow.
1. Open the report in Design View.
2. Click on the title in the Report Header, then drag the resizing handles out to increase the size of the control
and change the text in the control to Instructor Contact Details.

3. Select the Title section in the Detail section and holding the SHIFT key down select the Title control in the
Page Header section.
4. Drag the resizing handles in to make one of the controls smaller. The other control will also be resized.
5. Select all the other controls to the right of Title in the Page Header and the Detail sections. (Click on one,
then hold down the SHIFT key and click on each of the controls in turn.) With care you may find it easier
to drag out a rectangle across the controls.
6. Using the ‘open hand’, slide all these controls to the left.
7. Insert spaces in the Header controls for InstructorID,Surname, Firstname, address, etc. Select the control
for the Mobile No control.
8. Click on View, Layout Preview mode. You may also haveto align some of the data controls in the Detail
section.

We can further improve our report as follows:


1. Switch back to Design View and expand the detail area as shown below:

Operating Database Applications63|P a g e


2. Increase the Font Size of the data to size 12 by selecting all the controls in the Detail section and choosing
size 12 in the formatting toolbar.

LAP Test Setting up Database Objects

Name: ______________________________________ Date: ________________________________________

Time started: _______________________________ Time finished:


_______________________________

Perform the following tasks:


1. Create a database file EmployeeProfile.
2. Create the following tables.
Employee

EmpID EmpFamName EmpGiveName Address Birthday EducAttain DeptCode

2001- Sy Jolan Addis Ababa 10/10/1979 Masters 001


0001

Operating Database Applications64|P a g e


2001- Arabit Cecilia Jimma 11/25/1975 Bachelor 002
0018

2010- Mamitag Renato Addis Ababa 02/27/1976 Bachelor 003


1004

2005- dela Cruz Don Tigray 11/27/1975 Masters 003


0987

2006- Bernil Winy DebreBirhan 05/25/1978 Bachelor 001


8791

2010- Reyes Jenneth Addis Ababa 12/25/1972 Masters 001


0002

2011- Divinagracia Neil Addis Ababa 06/12/1972 Doctorate 004


0045

Note: Default Value for Address: Addis Ababa


EducAttain Values: Bachelor, Masters, Doctorate
Primary Key: EmpID

Department

DeptCode DeptName Location TelNo

001 Engineering Hantson 844 – 1872 loc 201

002 Hotel and Tourism CICM 844 – 1872 loc 205

003 Information TheophielVerbist 844 – 1872 loc 203


Technology

004 Arts and Sciences Don Bosco 844 – 1872 loc 202

Note: Primary Key: DeptCode

Operating Database Applications65|P a g e


3. Establish the correct relationship between the two tables.
4. Create a Form using wizard for each of the tables above and save as EmpForm and DeptForm
respectively.
5. Develop a query to display the EmpFamName, EmpGiveName and DeptCode of all employees. Save
your query as EmpDeptCode.
6. Create another query to display the EmpFamName, EmpGiveName and Birthday of all employees
born before January 1, 1977. Save it as Emp35Up.
7. Create a report using the wizard and save it as EmpInfoReport. The report will display all the fields of
the Employee table, in ascending order by EmpFamName.

LAP Test Setting up Database Objects

Name: ______________________________________ Date: ________________________________________

Time started: _______________________________ Time finished: _______________________________

Perform the following tasks:


1. Create a database file PatientProfile.
2. Create the following tables.
Patient

PID PFamName PGiveName Address Birthday Age DeptCode

P0001 Sy Jolan Addis Ababa 10/10/2001 10 001

S00012 Arabit Cecilia Jimma 11/25/1975 37 002

O00124 Mamitag Renato Addis Ababa 02/27/1976 36 003

P00122 dela Cruz Don Tigray 11/27/2006 5 001

M10011 Bernil Winy DebreBirhan 05/25/1978 33 004

M00012 Reyes Jenneth Addis Ababa 12/25/1972 39 004

Operating Database Applications66|P a g e


O00014 Divinagracia Neil Addis Ababa 06/12/1972 39 003

Note: Default Value for Address: Addis Ababa


Primary Key: EmpID

Department

DeptCode DeptName Location TelNo

001 Paediatrics Hantson 844 – 1872 loc 201

002 Surgery CICM 844 – 1872 loc 205

003 Orthodontics TheophielVerbist 844 – 1872 loc 203

004 Medical Don Bosco 844 – 1872 loc 202

Note: Primary Key: DeptCode


Department Names: Paediatrics, Surgery, Orthodontics, Medical

3. Establish the correct relationship between the two tables.


4. Create a Form using wizard for each of the tables above and save as PatientForm and DeptForm
respectively.
5. Develop a query to display the PFamName, PGiveName and DeptCode of all patients. Save your query
as PDeptCode.
6. Create another query to display the PFamName, PGiveName and Birthday of all patients below 20
years old. Save it as P20below.
7. Create a report using the wizard and save it as PInfoReport. The report will display all the fields of the
Patient table, in ascending order by PFamName.

LAP Test Setting up Database Objects

Operating Database Applications67|P a g e


Name: ______________________________________ Date: ________________________________________

Time started: _______________________________ Time finished:


_______________________________

Perform the following tasks:


1. Create a database file CustProfile.
2. Create the following tables.
Patient

CID CFamName CGiveName Address Birthday SectionCode

01-0001 Sy Jolan Addis Ababa 10/10/2001 001

02-0011 Arabit Cecilia Jimma 11/25/1975 002

01-0013 Mamitag Renato Addis Ababa 02/27/1976 003

03-1000 dela Cruz Don Tigray 11/27/2006 001

04-0012 Bernil Winy DebreBirhan 05/25/1978 004

03-0001 Reyes Jenneth Addis Ababa 12/25/1972 004

02-0102 Divinagracia Neil Addis Ababa 06/12/1972 003

Note: Default Value for Address: Addis Ababa


Primary Key: CID

Section

SectionCode SectName Location TelNo

001 Children’s Wear 2nd Floor 844 – 1872 loc 201

002 Ladies’ Accessories 3rd Floor 844 – 1872 loc 205

003 Men’s Wear 4th Floor 844 – 1872 loc 203

Operating Database Applications68|P a g e


004 Appliances Ground Floor 844 – 1872 loc 202

Note: Primary Key: DeptCode


Department Names: Children’s Wear, Ladies’ Accessories, Men’s Wear, Appliances

3. Establish the correct relationship between the two tables.


4. Create a Form using wizard for each of the tables above and save as CustForm and SectForm
respectively.
5. Develop a query to display the CFamName, CGiveName and SectionCode of all patients. Save your
query as CDeptCode.
6. Create another query to display the PFamName, PGiveNamewho are from Addis Ababa.
7. Create a report using the wizard and save it as CInfoReport. The report will display all the fields of the
Customer table, in ascending order by CFamName.

Operating Database Applications69|P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy