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

Introduction to databases

Chapter 5 covers the fundamentals of databases, including traditional filing methods and computerized databases using DBMS software like MS-Access and Oracle. It discusses various database models, features, and the steps for creating and managing databases, including setting primary keys and field properties. The chapter also outlines practical steps for data manipulation tasks such as adding, deleting, and sorting records in a database.

Uploaded by

Canon Davis
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)
10 views

Introduction to databases

Chapter 5 covers the fundamentals of databases, including traditional filing methods and computerized databases using DBMS software like MS-Access and Oracle. It discusses various database models, features, and the steps for creating and managing databases, including setting primary keys and field properties. The chapter also outlines practical steps for data manipulation tasks such as adding, deleting, and sorting records in a database.

Uploaded by

Canon Davis
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/ 64

Chapter 5

Database

419

Introduction
 A data base is a collection of data stored
in a computer system in some organised
manner to make the retrieval of the data
easy.

420

210
Database concepts 1
 Traditionally filling methods
 Thisis the old way of organising files. This
method is where data is stored within a single
paper file or table.

421

Database concept 2
 Computerised database
 This database use database management
system software to manipulate data.
Examples of DataBase Management
Software (DBMS) include:
 MS-Access
 Oracle

 Fox Pro

 Dbase IV

422

211
Disadvantages of traditional methods

 Unnecessary duplication of data.

 Boredom and time wasting while


searching for a record.

 Misleading reports due to poor data entry.

 Poor update of records. 423

Functions of DBMS
 Allow the user add or delete records.
 Update or modify existing records.
 Organise data for easy access, retrieval
and manipulation.
 Ensure security for data in the database.
 Keeps statistic of data items in database.

424

212
Database models 1
 Flat files – this model of
database holds only one
set of data and is not any
different from the manual
files e.g. the library
catalogue.
 Hierarchical model – in
this model items are
arranged in hierarchical
(tree) form. To access
level one data items, you
have to first access level
one data items. A specific
single path leads to each
item at lower levels.
425

Database models 2
 Network model – in this model,
lines are used to express the
relationship between different
data items, forming a network
of items. Access of one item
can be through many paths
and from any item.
 Relational model – in this
model, related data items are
stored together in structures
called relations or tables.
Relationship can be created
between tables such that a
record or records from one
table relates to another in
another table.
426

213
Database models 3
 Object oriented model – in this model,
database is a complete program built to
hold a collection of objects, which have
both properties and behaviour.

427

Features of database 1
 Tables/file structure –
this is database
structure that is used
to hold related
records.
 Queries – this is a
tool used to search
for or question a
database on specific
records.
428

214
Features of database 2
 Form/Screen input – this
is a graphical interface
that resembles the
ordinary paper form used
to collect data. It enables
the user to view and enter
data into a table.
 Report – database
provides the user with a
tool for generating reports
from a table or query.
429

Features of database 3
 Modules – this tool is like the macro but
it’s more precise in the sense that you
have control over the actions taken.

 Macro – this tool enables the user to


automate frequently performed procedures
or tasks.

215
Data organisation in a database
 Field – this is a character or a logical
combination of characters that represent a
data item e.g. in a class list the Admno is a
field.
 Records – this is a collection of related fields
that represents a single entity e.g. student
name, sex, age, marks etc.
 File – this is a collection of related records.
 Database – this holds all related files or
tables. 431

Creating a database using MS-Access


1. Click “Start”.
2. Point to “Programs/All Programs”.
3. Point to “Microsoft Office”.
4. Click “Access 2003” (application is
opened).
5. On the task pane, click down arrow
sign of click “Getting Started”
(shortcut menu is displayed).
6. Select “New file”.
7. Click “Blank database” (File New
Database dialog box is displayed).
8. Select the location where you want
to create the database from the
arrow down list.
9. Type the name of database in the
file name box.
10. Click “Create” button.

216
Microsoft Access screen layout

Steps of “exiting from Access”


1. On the “File” menu.

2. Click “Exit.

NB: shortcut key


Alt+F4

217
Steps of “creating a table structure” 1

1. Click “Table” tab.


2. Click “New”. (New
Table dialog box is
displayed).
3. Select “Design View”
from the list.
4. Click “OK” button.
(Table is displayed).

Steps of “creating a table structure” 2

5. Type a unique name


for each field in the
table.

6. Select “Data Type”


from the down arrow
list.

7. Add the other fields.

218
Steps of “creating a table structure” 3
8. After you add in other
fields, click “Save”
button on the standard
toolbar. (Save As dialog
box is displayed).
9. Type the name of table
in the “Table Name”
box.
10. Click “OK” button.
(Message box is
displayed).
11. Access will ask you
whether you want to
create a “Primary Key”,
click “Yes”.

Rules of a filed name in the table

 A field name must start with a letter and


can be up to a maximum of 64 characters
including letters, numbers, spaces and
punctuation.

219
Field data types 1
 Text – it includes alphabetic letters, numbers,
spaces, punctuation etc. This data type is used
in field that needs no calculations.
 Number – this field is made up of numeric
numbers 0-9 that are to be manipulated
mathematically.
 Memo – this is made up of alphanumeric data
used if you need to enter several paragraphs of
text.
 Data/Time – identify a field either as date or time.
439

Field data types 2


 Currency – identify a numeric value that have
decimals or fractions used when dealing with
monetary values.
 Autonumber – it’s a numeric value used if you
want MS-Access to automatically increment the
values in the field.
 Yes/No – it’s a logical field where an entry is
either a “Yes” or “No” “True” or “False”. Ole
object – this data type is used with graphical
user interface application for inserting graphical
objects.
440

220
Field properties settings
 As you create more and
more complex tables, you
will find a need to use field
properties to specify finer
details related to fields and
table entries expected. Field
properties depend on the
type of field selected. For
example, when you click on
a “Text” field, then the
“General” tab, you will see
properties associated to text
data type as shown in figure
right.

Field properties 1
 Field size – allow the user to set the number
of characters in a field instead of the default
50 for text fields. For numeric fields integer,
bytes, single, double or long integer is used.

 Format – determines how information


appears on the screen and when printed e.g.
you can format number to scientific,
currency, % etc 442

221
Field properties 2
 Decimal places – for number or currency
fields you can specify the number of
decimal place.

 Input mask – it automatically formats the


field entry into specified format e.g. a
number 02042426090 and the input mask
is set as 000-(0000)-(0000) it will
automatically display as 020-4242-6090. 443

Field properties 3
 Caption – it’s a more descriptive name for
a field to be used in a table or a form
display e.g. a caption Fname could be
First name.

 Default value – this is a value that will


appear automatically in the form if nothing
is entered by the user to change it e.g.
Date () automatically displays current date.
444

222
Field properties 4
 Validation rule – it’s a logical expression
that restricts values to be entered in a field
e.g. to restrict value entered in a field to be
between 0 and 100 type > = 0 and < = 100.

 Validation text – this is message that


appears once the validation rule is violated
e.g. you may enter a validation rule for the
above rule to display “Enter a number
between 1 and 100” 445

Field properties 5
 Required – Determines if an entry must be
made in the field before you proceed to
the next field or record.

 Allow zero length – allows the user to


proceed without making any entry in the
field set as zero length.

446

223
Field properties 6
 Indexed – it facilitates the organisation of
records for easy search.

 Primary key – it’s a field that enforces


uniqueness in a table so that one record is
not entered twice.

 Index – this is a feature used to speed up


search and sort operations in a table.
447

Primary key and indexes.


 An index is a key(s) used to speed up searching
and sorting records in a table, while a primary
key is an index that uniquely identifies each
record stored in the table. A primary key
prevents the user from making null or double
entries into a table. Access uses the primary key
to order records, and control redundancy. Once
a field is set as primary key, the datasheet in
automatically indexed or sorted using the
primary key.

224
Steps of “set a primary key”
1. Open the table in
design view.
2. Select the field you
want to set as the
primary key by
clicking in the row
header to the left the
“Field Name”.
3. Click “Set Primary
Key” button on the
tools bar.

Steps of “set another field as an


index other than the primary key”
1. Open the table in design view.
2. Click “Indexes” button next to
the primary key. (Indexes
dialog box is displayed on the
screen as shown in figure right
above.
3. In the “Index Name” column,
type the name of the index.
4. In the “Filed Name” column,
select the corresponding
fieldname.
5. In the “Sort Order” column,
select “Ascending” or
“Descending”.
6. “Close” dialog box.

225
Steps of “adding new records”
1. Double click the
table icon. (the table
is displayed in
datasheet view”.

2. On the “Insert”
menu.

3. Click “New Record”.

Symbols of row header.


 An arrowhead indicates
that no new data entry or
edit is pending.
 Asterisk symbol marks a
blank record below the
current entry.
 Pencil symbol indicates
that the current record
entry is not yet saved.
 Record locked indicates
that the current record is
being edited by another
user in a multi-user or
networked environment.

226
Steps of “deleting records”
1. Click the record you
want to delete.

2. On the “Edit” menu.

3. Click “Delete”.

Steps of “editing fields”


1. Double click the field
you want to edit.

2. Replace the cell


content.

227
Steps of “searching for records”
1. On the “Edit” menu.
2. Click “Find”.
3. In the “Find What” box,
type the field to search.
4. Select other options for
find “Look In”, Match or
etc.
5. Click “Find Next” button.

NB; shortcut key


Ctrl + F

Steps of “Replace a records”


1. On the “Edit” menu.
2. Click “Replace” (Find and
Replace dialog box is
displayed).
3. In the “Find What” box, type
the name of field to replace.
4. In the “Replace with” box,
type field to replace with
respectively.
5. Select other options for find
“Look In”, Match or etc.
6. Click “Replace” or “Replace
All” button.

228
Steps of “copying records”
1. Select the record(s) to
be copied.
2. On the “Edit” menu.
3. Click “Copy”.
4. Select the target
datasheet to copy.
5. On the “Edit” menu.
6. Click “Paste”.

NB: shortcut key for “Copy”


Ctrl + C
shortcut key for “Paste”
Ctrl + V

Steps of “moving records”


1. Select the record(s) to
be moved.
2. Click “Cut command on
the standard toolbar.
3. Select the target
datasheet to move.
4. Click “Paste” command
on the standard toolbar.

NB; shortcut key for move.


Ctrl + X

229
Steps of “Sorting records”
1. Open the table in
datasheet view.
2. Select the records to
be sorted.
3. On the “Record”
menu.
4. Point to “Sort”.
5. Click “Ascending” or
“Descending”.

Steps of “Filtering records”


1. Open the table in
datasheet view.
2. Select the records to be
filtered.
3. On the “Record” menu.
4. Point to “Filter”.
5. Select the type of filter
you want to apply.
6. In the datasheet, click a
down arrow of the field
to set the filter option.
7. Click “Apply Filter”
button on the toolbar.

230
Steps of “adjust the column size”

1. Point to the column


border between the
field’s header.
(mouse pointer sign
will be changed to
black cross sign).
2. Change the column
size up to where you
require using drag
and drop.

Steps of “adjust the row height”


1. Point to the border between
two rows in the row header.
(mouse pointer sign will be
changed to black cross
sign).
2. On the “Format” menu.
3. Click “Row height”. (Row
Height dialog box is
displayed).
4. Delete current row height
and type the new row height
which you want to adjust.
5. Click “OK” button.

231
Steps of “reorder fields”
1. Select the column of
the field you wish to
move by pointing to
the desired file
name.
2. Drag the column
right or left to the top
of the field where
you want your field
to appear and then
drop.

Modifying table structure


 Once you create a table, you may need to add
more fields, remove some fields, reorder the
fields or change fields data types and properties.
Before you modify the table it is important to
save a copy to avoid losing everything in case
you make a mistake.
 If a table contains data and you make changes
to the field data type, MS-Access may refuse to
implement the changes. To avoid this problem,
exit without saving and delete all the records
from the table then return to the design view.
You can then import a copy or copies of tables
you backed up.

232
Steps of “make a copy of your table”
1. On the “File” menu.
2. Click “Save As/Export.
(dialog box is
displayed).
3. Choose whether to
save to another
(external) database or
the current database.
4. Type a new name for
your table.
5. Click “OK” button.

Steps of “modify the original table”

1. Open the table in


design view.
2. Select the field or
fields to be modified
and make the
necessary changes.
3. Click the “Save”
button to save the
changes.

233
Importing tables
 You can import a table from another
database or a spreadsheet into your
database.

Steps of “import a table or a worksheet”


1. On the “File” menu.
2. Point to “Get External Data”.
3. Click “Import”. (Import dialog
box is displayed).
4. Select the database you
wish to import data from.
5. Click “Import” button.
(Object dialog box is
displayed as shown in figure
below).
6. Click “Table” tab.
7. Select the table(s) you wish
to import.
8. Click “OK” button.

234
Form designs
 A form is an interface that
enables the user to view and
make data entries into an
underlying table more easily.
 A form is designed using
graphical objects called
controls.
 A control is an object
such as textbox,
checkbox, command
button or shapes placed
on form design grid to
display data or perform
469
actions.

Types of controls
 Bound – in this the source of data is a field
in a table or query.

 Unbound – this control is not connected to


any data source.

470

235
Form designer
 You design or modify
a form layout by
dragging these
controls to the
required position.
Figure right shows a
form designer for a
table called exam
entry.

Creating a form layout using form wizard

 To create a form layout, you can either use the form


wizard or start from scratch. Using the form wizard you
can create either a columnar, a tabular a datasheet or
a justified form layout.
 Columnar form: the fields for each record are displayed
down a column i.e. each value displays on a separate line
with field labels to the left.
 Tabular: records are displayed from left to right across the
page and labels appear at the top of each column. Each row
represents a new record.
 Datasheet: the form resembles a table datasheet view.
 Justified: one record occupies the whole form.

236
Steps of “create a form using the wizard” 1

1. Click “Form” tab.


2. Click “New”. (New Form
dialog box is displayed).
3. Select “Form Wizard”.
4. Select the name of the
table or query that
includes the data you
want to add into the
form from down arrow
list.
5. Click “OK” button.

Steps of “crating a form layout using form wizard” 2.

6. Select the fields to


add into the form by
clicking the “>”
button or click “>>”
to add all fields.
7. Click “Next” button.
8. Select the layout you
wish to use
“Columnar”, Tabular”
or etc.
9. Click “Next” button.

237
Steps of “crating a form layout using form wizard” 3

10. Select the style you


wish to use “Blends”,
“Blueprint” or etc.
11. Click “Next” button.
12. Type the name of the
form title in the box.
13. Click “Finish” button.
(MS-Access will
automatically display
the form on the screen).

Creating a form using autoform wizard

 You can easily create a form using the


“Autoform wizard”. This wizard creates a
form for you automatically by asking you
very minimal questions. The form includes
all the fields from the selected table.

238
Steps of “construct an autoform”
1. Click “Form” tab.
2. Click “New”. “New Form
dialog box is displayed).
3. Select autoform layout
“Columnar”, “Tabular” or etc.
4. In “Choose the table or query
where the object data
comes”, select the table or
query form from down arrow
list you wish to create a form
for.
5. Click “OK” button.
6. Click “Save” button on the
toolbar. (Save As dialog box
is displayed).
7. Type the name of the form.
8. Click “OK” button.

Steps of “creating a form from scratch”


1. Click “From” tab.
2. Click “New”. (New Form dialog
box is displayed).
3. Select the “Design view” from the
list.
4. In “Choose the table or query
where the object data comes”,
select the table or query form
from down arrow list you wish to
create a form for.
5. Click “OK” button. (a form with
controls for all fields is
displayed).
6. Arrange the form as you want.

239
Steps of “add controls onto a form”
1. On the “View” menu.
2. Click “Field list”. (the
field of the table you
selected is
displayed).
3. Drag and drop each
field and arrange
them on the grid.
4. Click “Save”
command on the
toolbar.

Adding and displaying records


 The form provides the user
with navigation buttons
located at the bottom that
can be used to navigate the
form as shown in figure
below. The functions of the
buttons can be summarized
from left to right as follows:
1. Displays the first record in the
table.
2. Displays the previous record.
3. Displays the next record.
4. Displays the last record.
5. Used to add a new record.

240
Steps of “format controls on a form” (resize)

1. Open the form in design


view.
2. Select the field which you
want to resize. (place
holders are displayed
around field).
3. Place the mouse pointer on
the place holder. (mouse
pointer sign will be changed
to a double-sided arrow
sign).
4. Resize using drag and
drop.

Using queries
 Queries are the fastest way to search for
information in a database. It also enables
the user display specific records and also
perform calculations on field from tables.

482

241
Types of queries
 Select query – most commonly used, it is
used for searching and analysing data in
one or more tables. It lets the user specify
the search criteria.

 Action query – these are used to make


changes to many records once.

483

Types of action queries


 Update – updates data in table.
 Append query – adds data in a table from
one or more tables.
 Make table query – creates a new table
from a dynast.
 Delete query – deletes specified records
from one or more tables.

484

242
Steps of “creating a select query using wizard” 1

1. Click “Queries” tab.


2. Click “New”. (New query
dialog box is displayed).
3. Click “Simple Query Wizard”.
4. Click “OK” button.
5. Select the name of the table
or query that includes the
data you want to add into the
query from down arrow list.
6. Select the fields to add into
the query by clicking the “>”
button or click “>>” to add all
fields.
7. Click “Next” button.

Steps of “creating a select query wizard 2”

7. Select “Detail” or
“Summary”.

8. Click “Next” button.

9. Type the title name of


query in the box.

10. Click “Finish” button.

243
Steps of “creating a select query from in design view” 1

1. Click “Queries” tab.


2. Click “New”. (New query
dialog box is displayed).
3. Select “Design View”.
4. Click “OK” button. (Show
Table dialog box is
displayed).
5. Select table, query or both
which you want to add into
the query from each tab.
6. Click “Add” button.
7. After you add, click “Close”
button.

Steps of “creating a select query from in design view” 2

 The query design grid


opens. In MS-Access
it is called “Query-By-
Example” (QBE). This
lets the user to design
a query. Figure right
is QBE grid for a table
called Exam.

244
Parts of the query grid
 Field row – fields from a table or tables to be used are
arranged in this row. Each field should occupy its column.
 Table row – indicates the table providing the fields.
 Sort row – by clicking the down arrow in the sort cell, you
can specify the sort order i.e. ascending, descending or not
sort.
 Show row – by clicking the Show box, you specify whether
to display the field in the query results. When the box is not
checked, the field will not be displayed.
 Criteria row – this is where you type conditional statement
that will be used by the query to display specific records.
 Or row – used to specify an alternative condition e.g. if you
want to display records with a field called City, with items
Nairobi or Embu, type Nairobi in criteria cell and Embu in
the Or cell.

Specifying the criteria search


 To search for a particular set of records,
the users have to enter a conditional
statement in the criteria row. For example
if you have a table called employees with
one of the fields as salary, you can display
all the employees earning more than Shs.
5,000 by typing>5000 in the criteria row,
salary column.
490

245
Other examples of specifying the criteria search 1

 To define criteria, use either relational or logical


operators. Relational operators include less than (<),
greater than (>), greater than or equal to (>=), less
than or equal to (<=), not equal to (<>) and equal to
(=). Logical operators include AND, OR and NOT.
 Use AND to display values in a specific range. For
example, to display records from the employees table
with salaries above 4000 but less than 6000, type,
>4000 AND <6000 on the criteria row in the salary
column. All the employees who meet this condition will
be displayed.
 Use OR if you wish to get either one of two values. For
example, if you wish to get those employees either in
Nairobi OR Embu.

Other examples of specifying the criteria search 2

 If you want to display data in a particular range, use the


word Between. For example, instead of typing, >4000 AND
<6000, type Between 4000 And 6000.
 If you want to list all records except those that you do not
want to see, use NOT. For example, if you type NOT 6000
in the salary column of the employees table, all employees
records will be displayed except those with their salary as
6000.
 To display records you are not sure of the field name but at
least you can remember a few characters, use LIKE and the
wildcards. Wildcards are special symbols mostly an asterisk
and a question mark used in place of other characters. For
example, to display all names starting with “Sm” followed by
any other character, type Like Sm? Like */*/1993 lists
records created in 1993 regardless of the day or month.

246
Steps of “add fields into the query grid”

1. Open the query in


design view.

2. From the field list of


the underlying table,
drag each field and
place it in the field
row.

Steps of “saving the query”


1. Click “Save” button
on the toolbar or
from the “File” menu.
(Save As dialog box
is displayed).

2. Type name of the


query in the box.

3. Click “OK” button.

247
Steps of “running the query”
 Click “Run” button on the
toolbar as shown in figure
right above or “Run”
command from the “Query”
menu. (results of the query
is displayed).

NB: you can also view the


results of your query any
other time by selecting the
query, then click “Open”
button from the database
window.

Steps of “sorting the dynaset”


1. Click the down arrow
button of the “Sort”.
(list is displayed).

2. Select “ascending”
or “descending”.

248
Steps of “delete fields from the query grid”

1. Open the query in


design view.
2. Select the field column
you wish to delete.
3. On the “Edit” menu.
4. Click “Delete”.
5. After you delete, click
“Save” command on
the toolbar to save the
changes.

Steps of “adjust the column size in a query”

1. Open the query in design


view.
2. Position the mouse pointer
at the boundary that
separates columns. (mouse
pointer sign will be changed
block cross sign).
3. Double click on the
boundary to autofit cell
content.
4. Click “Save” command on
the toolbar to save the
changes.

249
Steps of “modify a criteria statement, select query”

1. Open the query in


design view.
2. Select the field of criteria
which you want to
modify, then change the
criteria statement as you
desire.
3. Click “Save” command
on the toolbar to save
changes.
4. Click “Run” command to
display the results of the
query for test whether
the changes have been
effected.

Performing calculations in a query.

 Unlike tables, queries let the user perform


mathematical calculations on numeric data.
You can perform calculations in a query by;
A) Creating basic formulae – to create a formula
that calculates the total marks in an underlying
table e.g. Exams table.
B) Using Total functions – with a query, you can
analyze all record fields using the inbuilt
functions such as Sum, Average, Minimum and
Maximum etc.

250
Steps of “creating basic formulae”
1. Open the query in
design view.
2. In an empty cell, type an
expression that includes
a field name of each as
“Amount: [Quantity] *
[Unit Price] as shown in
figure right above.
3. Click “Save” command
on the toolbar.
4. Click “Run” command
on the toolbar. (the
results of the
calculations is
displayed).

Steps of “use the total functions”


1. Open the query in design
view.
2. Click “Totals” command on the
tool bar. (Totals row is
displayed which is located
between “Table” row and
“Sort” row).
3. For each field to be analyzed,
click its cell in the “Total” row,
and then select any of the
functions from arrow down list
of “Total” row.
4. Set criteria and other options.
5. Click “Run” command on the
toolbar to preview the results.
6. Click “Save” command to save
the changes.

251
Steps of “printing a query”
1. Click “Queries” tab.
2. Open the query in
datasheet view you
want to print.
3. On the “File” menu.
4. Click “Print”.
5. Select the printer
from arrow down list.
6. Set the other printing
options.
7. Click “OK” button.

Relationship in tables
 Entity – an entity is a thing or object of
significance, whether real or imagined,
about which information needs to be
known or held.
 Attribute – an attribute is any detail that
serves to qualify, identify, classify, quantify
or express the state of an entity.
 Candidate key – it’s any attribute or set of
attributes can be used to uniquely identify
a row in a table. 504

252
Types of relationships
 One-to-one relationship – for a particular
field in one table there is only one
matching record in the related table.
 One-to-many relationship – for a particular
field in one table there are several
matching records in another table.
 Many-to-many relationship – for particular
records in one table there are several
matching records in the other table. 505

Steps of “defining relationship between tables” 1

1. Open the database.


2. On the “Tools” menu.
3. Click “Relationship. (Show
Table dialog box in
Relationship is displayed).
4. Select the table from Table
tab.
5. Click “Add” button.
6. After you add, click “Close”
button.
7. Click the field of first table
which you want to create
relationship.
8. Drag it to the second table
then drop. (Edit Relation ship
dialog box is displayed).

253
Steps of “defining relationship between tables” 2

7. Make sure “Enforce


Referential Integrity” is
checked to ensure that all
records entered in the
related table exist in the
primary table.
8. Set other options if you
want.
9. Click “Create” button.
(Black line is displayed
between two tables).

NB; the field used to create the


relationship must be of the
same type and properties.

Steps of “create a query based on related tables”

1. Open the query in design view.


2. Click “Show Table” command on
the toolbar. (Show Table dialog
box is displayed).
3. Select the tables you want to
base your query on.
4. Click “Add” button. (query is
displayed).
5. After you add, click “Close”
button.
6. Click the field of first table which
you want to create relationship.
7. Drag it to the second table then
drop. (Edit Relation ship dialog
box is displayed).
8. Click “Run” command to run.
9. Click “Save” command to save.

254
Creating reports
 Like in forms, a report
layout is also
designed by placing
controls on to the
report designer as
shown in figure right.

Parts of a report
 Report header – this contains unbound controls that displays
title of the report.
 Page header – contains heading or labels data items to be
displayed in every column.
Detail – holds bound controls that display data items for the
table or query it was created from.
 Detail – holds bound controls that display data items for the
table or query it was created from.
 Page footer – holds a control that is to be displayed on every
page such as the page number and date. For example =Now()
displays the current date and time as set in the system clock.
 Report footer – used to display summary from a report such as
the grand total for numerical data in a particular field column.

255
Creating a report
 Using wizard
 Just like the form wizard, report wizard takes
the user through a number of steps by
answering a few questions and MS-Access
automatically does the rest.
 In design view
 Justlike with forms, you can create a report in
design view by placing control on the report
design grid.

Steps of “create a report layout using wizard” 1

1. Click “Report” tab.

2. Click “New”. (New


Report dialog box is
displayed).

3. Select “Report
Wizard”.

4. Click “OK” button.

256
Steps of “create a report layout using wizard” 2

5. Select the name of the table


or query that includes the
data you want to add into the
report from down arrow list.
6. Select the fields to add into
the report by clicking the “>”
button or click “>>” to add all
fields.
7. Click “Next” button.
8. Select the field If you want to
add grouping.
9. Click “>” button to add.
10. Change the priority using
arrow sign button if you want.
11. Click “Next” button.

Steps of “create a report layout using wizard” 3

12. Select the field from


down arrow list if you
want to sort the records.
13. Select “Ascending” or
“Descending”.
14. Click “Summary Options”
button.
15. Click the check box if you
want to perform
calculations on numerical
fields e.g. Sum, Average
or etc.
16. Click “OK” button.
17. Click “Next” button.

257
Steps of “create a report layout using wizard” 4

18. Select the type of layout


from the list.
19. Select orientation
“Portrait” or
“Landscape”.
20. Click “Next” button.
21. Select the type of style
form the list.
22. Click “Next” button.
23. Type the name of report
title in the box.
24. Click ”Finish” button.

Steps of “creating a report in design view” 1


1. Click “Report” tab.
2. Click “New”. (New Report dialog
box is displayed).
3. Select “Design View”.
4. In “Choose the table or query
where the object data comes”,
select the table or query form
from down arrow list you wish to
create a form for..
5. Click “OK” button. (Report design
grid is displayed).
6. Drag each field from the field list
to the layout grid and drop it
where you want the data column
to appear.
7. After you place, click “Save”
command on the toolbar. (Save
As dialog box is displayed).

258
Steps of “creating a report in design view” 2

8. Type the name of


the report.

9. Click “OK” button.

10. Click “Print Preview”


button to view the
report.

Steps of “modifying a report layout”


1. Open the report in
design view.
2. Click report header or
footer you want to
modify.
3. Make the necessary
changes.
4. Click “Save” command
on the toolbar to save
the changes.
5. Click “Print Preview”
command on the toolbar
to view the changes.

259
Steps of “add more controls onto the report layout”

1. Open the report in design


view.
2. Click “Field List” command on
the toolbar. (field list is
displayed).
3. Select one or more fields in
the field list.
4. Add field to design grid using
drag and drop and adjust the
field as you wish.
5. Click “Save” command on the
toolbar to save the changes.
6. Click “Print Preview”
command on the toolbar to
view the changes.

Steps of “resize a control”


1. Click “Report” tab.
2. Open the report in
design view.
3. Select the control you
want to resize. (place
holders are displayed
around control).
4. Place the mouse pointer
on the place holder.
(mouse pointer sign will
be changed to a double-
sided arrow sign).
5. Drag the mouse pointer
to resize the control.

260
Steps of “move a control”
1. Click “Report” tab.
2. Open the report in
design view.
3. Select the control you
want to resize. (place
holders are displayed
around control).
4. Place the mouse pointer
on the place holder until
its sign is changed to a
hand sign.
5. Drag the mouse pointer
to move the control.

Creating labels
 A label is a sticker or piece of paper put on
an item for the purpose of identification.
Examples of stickers are mailing labels,
label on the floppy disk where you write
your name etc. Using the report label
wizard, MS-Access lets you easily create
labels of different sizes.

261
Steps of “create a label using the report wizard”

1. Click the “Report” tab.


2. Click “New”. (New Report
dialog box is displayed).
3. Select “Label Wizard” from
the list.
4. In “Choose the table or query
where the object data
comes”, select the table or
query form from down arrow
list you wish to create a form
for.
5. Click “OK” button. (Report
design grid is displayed).
6. Select the size of label you
want to create.
7. Click “Next” button.

Steps of “creating a label using the report wizard” 2

8. Select font type,


size, weight and
color.
9. Click “Next” button.
10. Select mailing labels
from available field
by clicking “>”
button.
11. Click “Next” button.

262
Steps of “creating a label using the report wizard” 3

12. Sort labels if you


want by clicking “>”
button or click “>>”
button.
13. Click “Next” button.
14. Type the name of
the label in the box.
15. Click “Finish” button.

Modifying labels
 Just as you can modify a report or a form,
you can also modify a label by
manipulating the layout controls

263
Steps of “modify a label”
1. Click “Report” tab.
2. Click “Design” button. (the
label is displayed in design
view).
3. Edit the layout as desired
4. After you modify, click
“Save” command on the
toolbar.
5. Close the design grid.
6. Click “Print Preview”
command on the toolbar to
view.

Printing the reports and labels


 Before you print a report or a label, you
should first set the page options i.e. the
margins, paper size and orientation.

264
Steps of “printing the reports and labels”

1. Click “Report” tab.


2. Select the report you want to
print.
3. Click “Preview” button. (Print
Preview window is
displayed).
4. On the “File” menu.
5. Click “Print” (Print dialog box
is displayed).
6. Select the printer from down
arrow list.
7. Set other options i.e. print
range and number of copies.
8. Click “OK” button.

Creating macros
 A macro is a set of one or more actions
used to automatically perform particular
operations such as opening a form or
printing and a report. Macros are used to
automate database applications.

265
Steps of “creating macros” 1
1. Click “Macros” tab.
2. Click “New” button. (Macro window
is displayed).
3. Add an action e.g. OpenTable into
action column from down arrow
list.
4. In the lower part, specify
arguments for the action in Action
Argument box.
5. Type optional comment for the
action if you need.
6. Add more actions to the macro if
you want. Actions are executed in
the order you list them.
7. Click “Save” command on the
toolbar to save the macro.

Steps of “creating macros” 2


8. Type the name of
macro in the box.

9. Click “OK” button.

10. Click “Run”


command on the
toolbar to open the
macro.

266
Enforcing database security
 MS-Access provides the user with several data security
tools.
A) Password protection – requests the password for opening.
B) Encryption – compacts a database file and makes in
indecipherable by a utility program or a word processor
especially on a networked environment. Encrypting a database
doesn’t restrict access to objects by users.
C) Hiding database object – hide tables, queries, forms and reports
and macros from casual users. This method of protection is the
least secure because it is possible to unhide the objects.
D) User-level security – this is the most extensive security method
especially on a multi-user environment. A database
administrator can grant specific users or groups specific
permissions and privileges to tables, queries, forms. Reports
and macros.

Steps of “setup a password in MS-Access” 1

1. Open MS-Access.
2. On the “File” menu.
3. Click “Open” (Open dialog
box is displayed).
4. Click arrow down sign of
“Open” button. (open menu
is displayed).
5. Open the database in
exclusive mode which you
want to set a password.
(Security Warning dialog box
is displayed).
6. Click “Open” button.

267
Steps of “setup a password in MS-Access” 2

7. On the “Tool” menu.


8. Point to “Security”.
9. Click “Set Database
Password”. (Set a
Password dialog box is
displayed).
10. Type the unique
password in the box.
11. Re-type the unique
password in the “Verify”
box.
12. Click “OK” button.

Steps of “encrypt a database” 1


1. Start MS-Access without
opening a database
because you can’t
encrypt or decrypt a
database when it is
open.
2. On the “Tools” menu.
3. Point to “Security”.
4. Click “Encode/Decode
Database”
(Encode/Decode
Database dialog box is
displayed).

268
Steps of “Encrypt a database” 2
5. Select the database you
want to encode or
decode.
6. Click “OK” button.
(Encode Database
dialog box is displayed).
7. Select the location from
down arrow list to save.
8. Type the file name in
the “Name box.
9. Click “OK” button.

Steps of “hide object”


1. On the “View” menu.
2. Click “Properties”.
(Properties dialog
box is displayed).
3. Check in the
“Hidden” box.
4. Click “Apply” button.
5. Click “OK” button.

269
Steps of “assign user rights and privileges” 1

1. Open the database.


2. On the “Tools” menu.
3. Point to “Security”.
4. Click “User-Level
Security Wizard”.
(Security Wizard
dialog box is
displayed).
5. Click “Next” button.

Steps of “assign user rights and privileges” 2

6. Click “Browse” button.


(Select a workgroup file
dialog box is displayed).
7. Select the location from
shortcut keys.
8. Type the name of file in
the box.
9. Click “Select” button.
10. Type the unique “WID”
(workgroup ID) in the
box.
11. Click “Next” button.

270
Steps of “assign user rights and privileges” 2

12. Check in the boxes


which you want to select
the database to help
source from each tab.
13. Click “Next” button.
14. Check in the box which
you want to include in
your workgroup
information file.
15. Type “Group ID” in the
box each groups.
16. Click “Next” button.

Steps of “assign user rights and privileges” 3

17. Select “Yes” or “No” to


grant the users group
some permission. If you
select “Yes”, you can
set some option from
each tab.
18. Click “Next” button”.
19. You can add users to
your workgroup
information file. If you
want to add, type “User
name’, “Password” and
‘PID” (personal ID) in
the each box.
20. Click “Next” button.

271
Steps of “assign user rights and privileges” 3

21. Select “Select a user and


assign the user to groups” or
“Select a group and assign
users to the group”.
22. Click “Next” button.
23. Click “Browse” button.
(Choose a database name
dialog box is displayed).
24. Select the location from
down arrow list to save.
25. Type the “File name” in the
box.
26. Click “Select” button.
27. Click “OK” button.

Setting up startup options


 To customize your database application
workplace, there is need to specify how
the database is to be loaded.

272
Steps of “set the startup options”

1. On the “Tools”
menu.
2. Click “Startup”.
(Startup dialog box
is displayed).
3. Set startup options
e.g. “Application
Title”, “Application
Icon” or etc.
4. Click “OK” button.

Review questions 1
1. What is a relational database
management system?
2. Define the following terms: table, records
and field as used in databases.
3. State six major objects used to
manipulate data in MS-Access.
4. Explain how you can start and exit MS-
Access.
5. In MS-Access, what do the following
terms refer to: query, macro, module. 546

273

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