Professional Documents
Culture Documents
CoureseModol UGBS 008 Data Processing
CoureseModol UGBS 008 Data Processing
CoureseModol UGBS 008 Data Processing
LECTURE NOTES
Prepared by:
Data collection: Involves gathering data from different sources such as transactions,
from users, and documents, etc. this procedure can be achieved by using
questionnaires, extracting data from documents, interviews and so on.
Data preparation: Refers to the process of organising raw data for further analysis. It
includes editing, coding, rearranging, and classifying raw data.
Data inputting Involves feeding a system with raw data for processing or passing
data from an initial stage to another. If a computer system is being used for data
1
processing, then input devices such as keyboard, barcode scanners can be used for
data input.
Data processing: Involves the process of converting data into information through a
set of procedure.
Data Outputting: Refers to providing processed data that is, information into suitable
format for various stakeholders.
Input
It is the process through which collected data is transformed into a form that the
computer can understand. It is a very important step because correct output results
totally depend on the input data. In input step, following activities can be performed.
2
Figure 1.1 Data processing cycle
Processing
It denotes data manipulation techniques such as classifying, sorting, calculating,
summarising, comparing, etc. that convert data into information. Classification
involves arranging data into different groups and subgroups, to provide some
meaningful information.
Output
Refers to the result of data processing. The main purpose of data processing is to
derive output for decision-making. Mostly, the output is stored on the storage media
for later use. In output step, following activities can be performed, namely retrieval
and communication. Output retrieval refers to the process of finding an existing
information from a storage media. Communication, on the other hand, refers to the
transfer of output to other stakeholders. For example, output from weather forecast
can be stored for future and sent to other organisations such as newspapers and radio
stations for dissemination.
3
1.5 Data Storage Hierarchy
Data storage hierarchy refers to the systematic organisation of data in a computer. It
starts from the lowest to the highest data storage. The lowest unit of data storage in a
computer is bit. A bit is the basic unit of digital data. It can have only two values zero
(0) or one (1). From bit, we move to byte and so on. A byte is made up 8 bits. Figure
1.2 shows the data storage hierarchy from the smallest to the highest. The Figure
shows the units of data storage and corresponding number of bytes it contains.
4
• Add value to an otherwise facts/figures
• Condense or reduce volume of data
• Identifying patterns that are not easily detected from data
• Making informed decisions because of the insight obtained from the processed
data
• Planning for short, medium and long term
• Projection or forecasting based on the information processed
5
2
Process Data with Microsoft Excel
– An Overview
This chapter discusses data processing using Microsoft Excel software. The chapter
presents an overview and basics of the Excel software. The chapter covers:
• Overview of Microsoft Excel
• How to start Microsoft Excel
• Parts of the Excel window
• Creating a workbook
• Working with basic data formats
• Working with cells and ranges
• Interpreting error values
• Entering, analysing, and presenting quantitative data
• Entering text, numbers, and dates in a worksheet
As presented in Figure 2.1, Excel commands are categorised into groups of tabs on a
ribbon. These tabs include Home, Insert, Page Layout, Formula, Data, Review, and
View. Some key features of the spreadsheet are; ribbon, tabs, formula bar, workbook
name, name box, row heading, column headings, status bar, sheet tabs, zoom controls,
and active worksheet
6
Figure 2.1 Parts of Microsoft Excel workbook
here.
7
Method 1
• Press the Windows key from the keyboard or click on the Windows icon from
the task bar to bring up the startup menu as presented in Figure 2.2.
• Go to All programs
• Select Microsoft Office folder and click on Microsoft Excel from the list.
2
3
Method 2
To start Excel using this method (see Figure 2.3):
• Press Windows key and R together from the keyboard. Alternatively, type
RUN in start-up menu search box.
• Type Excel in the RUN dialog box.
• Press OK or enter from the keyboard
8
Figure 2.3 Run dialog box
9
are entered into a cell – an intersection between a row and a column. Data entered into
a cell appears in both the active cell and the formula bar. To enter multiple lines of
data within a cell the ALT and Enter keys are pressed together.
10
A cell range reference indicates the beginning and end as well as the location and size
of selected cells. For instance, in Figure 2.7, the highlighted portions indicate the cell
ranges. Thus if cells A1 to A5 are selected, we can refer to the selected portions as a
cell range.
11
3
Processing Data with Microsoft
Excel Formulas
This chapter discusses how Excel formula aids in data processing. The chapter covers:
Overview of a formula
Guidelines for writing effective formulas
Order of precedence
Editing an existing formula
Cell references in formula writing
Auto filling formulas
12
3.2 Guidelines for writing effective formulas
It is important to write effective formulas when processing data with excel. The
following steps can aid this process:
Keep them simple
Do not hide data values within formulas – This means that try as much
possible not to include values in your formula especially when the values can
change often
Break up formulas to show intermediate results
Entering a formula
Click cell where you want formula results to appear
Type = and an expression that calculates a value using cell references and
arithmetic operators
Cell references allow you to change the values used in the calculation without
having to modify the formula itself
Press Enter or Tab to complete the formula
For example, to perform the operation 20 plus 10, located in cell A1 and B1
respectively. Click cell C1 if you wish the answer to be placed there. Then begin the
formula by typing =A1+B1. Note that we did not type =20+10 even though this will
also give us the right answers. The reason is that by writing formulas with cell names
instead of actual values, you call always change the cell content and the formula will
update automatically. However, if you use the actual values in the formula, you will
have to change the formula and the values in the cells whenever there is a change in
the values. Thus, the best practice is to avoid using values in formulas unless it is
certain that the values will not change often.
13
=50+10*5, Excel will first multiply 10 and 5 to get 50 and thereafter add 50, to get a
final value of 100.
14
to record and analyse data. To do this effectively, you enter data in cells in a
worksheet, and then reference the cells with data in formulas that perform calculations
on that data, such as adding the total of a column of numbers as part of a budget.
For instance, from Figure 3.4, a formula was written in cell D4, when this formula is
copied below D4, Excel will recognise the preceding operation and repeat the formula
below, illustrating relative cell referencing.
15
Absolute reference: Also called the fixed reference is a type of cell reference that
always references the same cell no matter where it is moved. That is, under absolute
reference, Excel is made lock down a particular cell for subsequent calculation
irrespective of location. Absolute referencing is performed by placing a dollar sign ($)
in front of the column and/or row values of a cell. For instance, to make cell D4
absolute, the formula will read as =$D$4. In the same vein, to make a column
absolute, the dollar sign is placed in front of the column name say =$D4. Also, this
can be done for row as well by placing a dollar sign in front of row name say =D$4.
In Figure 3.5, cell D$ is made absolute by adding the dollar sign to the cell name.
Thus, by copying the formula to other cells, the same values were repeated. The
absolute reference is very useful when performing calculations that require the
constant use of a particular cell.
16
cell B3 uses a combination of absolute and relative references to develop a
multiplication table.
By default, AutoFill copies both the content and the formatting of the original range
of the selected range. Use the AutoFill options button to specify what is copied. From
17
Figure 3.7 clicking this button provides a list of Auto-Fill options. The Copy Cells
option, which is the default, copies both the content and the formatting. The Fill
Formatting Only option copies the formatting into the selected cells, but not any
content. The Fill Without Formatting option copies the content but not the formatting.
Filling a Series
By using the AutoFill technique, you can create a series of numbers, dates, or text
based on a pattern. The fill series option learns the pattern of data provided and
provides subsequent values. To create a series of numbers, you enter the initial values
in the series in a selected range and then use AutoFill to complete the series. Figure
3.8 shows how AutoFill can be used to insert the numbers from 1 to 10 in a selected
range. You enter the first few numbers in the range A1:A3 to establish the pattern for
AutoFill to use, consecutive positive integers in this example. Then, you select the
range and drag the fill handle over the cells where you want the pattern continued. In
Figure 3.8, the fill handle is dragged over the range A4:A10 and Excel fills in the rest
of the series.
18
Figure 3.9 shows some data formats that can be Auto filled based on initial patterns in
Excel. For instance, by Jan, Feb and Mar and dragging the fill handle, Excel will
automatically fill the subsequent months.
19
4
Processing Data with Microsoft
Excel Functions
This chapter discusses how Functions support data processing in Excel. The chapter
covers:
Overview of Excel functions
Categories of functions
How to use Excel functions
Basic Excel functions
Logical functions
Comparison operators
=A1+A2+A3+A4+A5+A6+A7+A8+A9+A10
Or we could use the SUM function to accomplish the same task by this compact
formula:
=SUM(A1:A10)
20
function. When you select a function, the Function Arguments dialog box opens.
Figure 4.1 shows the Excel Function categories and their respective description. For
instance, the Math & Trig category contains functions that can be used to perform
mathematical and trigonometry operations.
where FUNCTION is the name of the function, and argument1, argument2, and so
forth are arguments, which are the numbers, text, or cell references used by the
function to return a value. ƒ1 represents another function what is nested in the original
Function. Arguments and nested Functions are always separated by a comma.
Not all functions have arguments. Some functions have optional arguments, which are
not required for the function to return a value, but can be included to provide more
21
control over how Excel calculates the returned value. If an optional argument is not
included, Excel assumes a default value for it.
There are two ways of using functions, you can either insert the function through the
formula tab or type it directly into a cell or the formula bar. These approaches are
discussed below.
Inserting a Function
The Function insertion method as presented in Figure 4.2 follows the steps below
First, click in the cell you want the result to be
Go to the Formula tab in the ribbon
Sleet Insert Function command and a function dialog box will appear
You can search for the Function you want to use of select it from the Function
categories and click OK.
22
Figure 4.2 Inserting a function
Typing a Function
Functions can be typed directly into a cell if you are familiar with the various
functions, which is often faster. To use the Function typing approach as presented in
Figure 4.3:
Click in the cell the result will be placed
Begin the function with an equal sign (=)
Start typing the name of the Function and a list of possible functions will pop
up.
23
Select the function you want to provide the necessary arguments
24
The example below shows how some these basic functions can be used in processing
data.
=SUM (A1:A10)
=COUNT (A1:A10)
=AVERAGE (A1:A10)
=MIN (A1:A10)
where (A1:A10) is the cell range the Function considers in the calculation. Figure 4.4
shows how the SUM function is used through the AutoSum command under the
Home Tab.
25
=IF (logical_test, [value_if_true,], [value_if_false])
The logical_test is the condition, [value_if_true] is the true value if the condition is
met and [value_if_false] is the value if the condition is not met.
For instance, there is a rule in the University of Ghana that if a student’s mark is 50
and above, then the student has based but if the mark is below 50 then the student
fails. To determine if a student has passed or failed, the formula is expressed as:
where A2 is the cell holding the mark of the student, >= is the comparison operator,
50 is the mark used in the condition, PASS and FAIL are the true and false values.
The PASS and FAIL are put into double quotes because they are considered a string
or text values.
For instance, if the grading system in University of Ghana states that a student’s mark
between 100 and 80 is grade A, 79 to 60 is B, 59 to 50 is C, and 49 is F. Using the
Nested IF Function the formula will be expressed as:
where A2 is the cell holding the mark of the student, 80, 60, 50 are the lower limits of
the grading system on which the condition is built, >= is the comparison operator and
A,B,C, and F are the grade values if the conditions are true or false.
26
Lookup Function
Lookup functions find values in a column or a list of items and insert them in another
location in the worksheet such as cells or in formulas based on a particular criterion.
An exact match lookup is when the lookup value must match one of the comparable
values in the lookup column. Simply, the LOOKUP function finds items from a list
based on a criterion and matches them with a corresponding value. An approximate
match lookup occurs when the lookup value falls within a range of numbers in the
first column of the lookup column. The syntax of the LOOKUP Function is:
Using the example in the Nested IF function above, the LOOKUP version of the
formula is expressed as:
where A2 is the cell containing the mark of the student, {0,50,60,80} is the lookup
vector or the values to check for and {"F","C","B","A"} is the lookup result or the
corresponding results to assign to the respective lookup vector.
27
5
Processing Financial Data with
Microsoft Excel
This chapter discusses some useful financial and how they support data processing in
Excel. The chapter covers:
Payment function
Present and Future value functions
Interest and Principal payment Functions
Loan Amortization process
28
5.2 Payment Function
This function calculates the periodic payment on a loan or against an investment. It is
expressed as:
where PMT is the payment function, rate is the interest rate per period or the rate of
return of an annuity, nper is the total number of periods, fv is the future value and
type indicates where payments will be made at the end of the period (0) or at the
beginning (1). In Excel any argument placed in square brackets, e.g. [fv=0] are
considered optional. Thus, in the PMT function, fv and type are optional arguments
are can be ignored or represented by 0 in calculations.
For instance, the PMT function can help calculate how much Kofi will pay monthly if
he contracts GHS 50,000.00 from a bank for a period of 5 years at an annual interest
rate of 30% to buy a car assuming payment is made at the end of the month. From the
example, the rate is 30% or 0.3 per year, nper is 5 years translating into 60 months
(5*12), pv is GHS50,000.00- the amount being borrowed. Thus, the monthly payment
by Kofi will be expressed as:
=PMT (0.30/12,5*12,50,000)
=GHS 1,617.67
29
Figure 5.2 Car loan calculator using PMT Function
Figure 5.3 presents the reverse engineered equation to calculate the RATE value
based on Kofi’s car loan example above. Note that the formula is multiplied by 12 to
convert the monthly interest rate into an annual rate of 30%. Also, note the negative
value of PMT must be used in the calculation to arrive at accurate figures.
30
5.4 NPER Function
Calculates the number of periods required to pay off a loan or investment. NPER is
expressed as:
Based on the example above the NPER value of 5 was calculated as presented in
Figure 5.4. It is important to note the formula is divided by 12 to arrive at the yearly
loan duration of 5 years. Again, the negative PMT value must be used in the
calculation to arrive at the correct answer.
5.5 PV Function
This function calculates the present value of a loan or investment based on periodic,
constant payments. PV is expressed as:
Based on the example above the PV of 50000 was calculated as presented in Figure
5.5 by providing the rate, nper, and pmt values.
31
Figure 5.5 Calculating present value using the PV function
where Per is the number of the payment period. Figure 5.6 shows IPMT and the
PPMT values based on the car loan example. Given that IPMT and PPMT make up
PMT, their values should add up to the PMT value. That is, PMT =IPMT+PPMT.
From the example -1250+ (-367.67) = -1617.76 which is the initial PMT value. It is
important to note the PER value in the formula is 1, indicating that the calculation is
for the first period of the loan.
32
Figure 5.6 Interest and principal payment calculation using IPMT and PPMT
where rate is the interest rate per period, nper is the total number of periods, pmt is the
payment in each period, pv is the present value of the investment, and type indicates
whether payments should be made at the end of the period (0) or the beginning of the
period (1).
Drawing from the example above, what if Kofi decides to rather invest a fixed amount
of GHS 1,617.67 monthly for the same period (5 years) and per the same interest rate
30% to enable him buy the car with his investment. In this case, we can use the FV
Function as presented in Figure 5.7. It is expressed as:
= GHS 219,989.49
33
Figure 5.7 Investment calculation using FV Function
where $B$4/12 is the absolute value of the interest rate divided by 12, C17 is the first
payment period (PER), $B$3*12 is the loan duration multiplied by 12 (NPER), and
$B$2 is the absolute value of loan amount (PV). The RATE, NPER, and PV values
are converted into absolute because they will remain constant through the entire
duration of the loan. The PER was not made absolute because the formula want Excel
to perform relative referencing on the other periods until the 60th month. Lastly, the
34
formula is negated (-) at the beginning, so that only positive values can be provided.
The same logic is what is applied to the PPMT calculation.
Thus, similarly, the PPMT is calculated as:
Given that PMT =IPMT+PPMT, the values of IPMT and PPMT are added to get the
PMT value. Thus, PMT is calculated as =D17+E17
The balance at the end of each period is calculated by subtracting the PPMT from the
PV because; the principal payment PPMT is what reduces the loan value. Thus, to get
the balance on a loan at a particular period, the principal payment must be subtracted
from the previous value. In our example in Figure 5.8, at period 0, the balance is still
GHS 50,000.00 because no payment has been made. However, under period 1, the
PMT is assumed to be paid, thus the balance is calculated as:
Using the AutoFill handle, the subsequent values of each column (IPMT, PPMT,
PMT and balance) can be generated automatically. If done correctly, the balance cell
of period 60 should be GHS 0.00 as presented Figure 5.8 below.
35
Figure 5.8 Loan Amortization Table
36
6
Using Charts to Process Data in
Microsoft Excel
This chapter discusses how Excel charts aid in data processing and visualisation. The
chapter covers:
Overview of Excel charts
Excel chart categories
How to create Excel charts
Formatting charts
37
Figure 6.1 Excel chart categories
Method 1
First highlight the data to be visualised
Go to the Insert tab and click on chart type that you wish to use
Alternatively, click on the recommend chart command so that Excel can
suggest appropriate chart types for the data selected.
Figure 6.2 demonstrates how a column chart is created using method 1 explained
above.
38
2
4 3
Method 2
Go to the Insert tab on the ribbon
Click on the chart type you wish to create for the design tab to become active
Click on Select Data from the design tab to have the data source dialog box
appear
Use the cursor to select the entire data to be visualised and Excel should
automatically guess the appropriate data to use for the Legend Entries (series)
column and the Horizontal category (Axis) Label.
In some case, Excel may guess inaccurately, thus the add, edit, remove buttons
can be used to select the appropriate data
Figure 6.3 shows how a Pie chart is created based on method 2 outlined above.
39
Figure 6.3 Creating a pie chart using method 2
To apply formatting to an individual chart element, you can double-click that chart
element to open a dialog box with format options specific to the selected element.
You can also open the dialog box by clicking the appropriate element button on the
format tab.
40
7
Processing Data with Databases:
An Overview of Microsoft Access
This chapter discusses how databases aid in data processing. Microsoft Access is used
as the database management systems for demonstration. The chapter covers:
Overview of Databases
Importance of a Database
Basic Database Terminologies
Introduction to Microsoft Access
How to create an Access Database
41
7.3 Basic Database Terminologies
Entity
An entity is something of importance to a user that needs to be represented in a
database. An entity represents one theme or topic. Example of entities in University of
Ghana’s database will include Students, Grades, Courses, Departments, Staff, Halls,
etc.
Relation
A relation is a two-dimensional table that has specific characteristics. The table
dimensions, like a matrix, consist of rows and columns.
Attribute
An attribute is a characteristic of an entity. Thus, attributes describe an entity.
Attributes are represented by columns or fields in a relation. For instance, the
attributes of a student entity will include, student ID, first name, last name, date of
birth etc.,
Record
A record is an instance of an entity. It also shows the occurrence of an entity. Records
are represented by rows in a relation. Example of a record for a student entity is:
1020100 John Doe 12/12/1990
Key
A key is one (or more) column(s) of a relation that is (are) used to identify a row.
There are different types of keys in database management, such as primary, foreign
candidate, composite, surrogate etc.
42
A composite key contains two or more attributes that uniquely identify a record in a
table. A candidate key is potential primary key, but has not been selected yet. A
surrogate key is a unique, numeric value that is added to a table to serve as temporal
identify for records in a table. Surrogate key values have no meaning to users and are
usually hidden on forms, queries, and reports. A surrogate key is often used in place
of a composite key.
Foreign key is a primary key from one table placed into another table in order to
establish a relationship between the two tables. The key is called a foreign key in the
table that received the key
Relationships
Relationship refers to an association between two entities in a database. Given that
entities translate into tables, relationships are sometimes conceptualised at the table
level. For instance, (see Figure 7.2 above) an employee belongs to a department,
therefore, there is a relationship between employee (entity) and department (entity).
Referential integrity
Refers to a set of rules that a database enforces to maintain consistency between
related tables when you update data in a database. Referential integrity states that
43
every value of a foreign key must match a value of an existing primary key. For
instance, If EmpID = 4 in EMPLOYEE has a DeptID = 7 (a foreign key), a
Department with DeptID = 7 must exist in DEPARTMENT. The primary key value
must exist before the foreign key value is entered.
To sum up the discussion on the basic database terminologies, Figure 7.3 is presented.
From the figure, there are two tables; Supplier and Part. The columns of each table
represent the attributes or fields while the rows represent records or tuples. The
Suplier_Number and Part_Number are the respective primary keys of the two tables.
Given that there is a relationship between Part and Supplier, the supplier_Number is
placed in the Part table as foreign key.
44
Figure 7.4 Microsoft Access Window
explain how to start and create Access databases. There are several ways to start
Method 1
• Press the Windows key from the keyboard or click on the Windows icon from
the task bar to bring up the start-up menu as presented in Figure7.5
• Go to All programs
• Select Microsoft Office folder and click on Microsoft Access from the list.
45
2
3
Method 2
To start Access using this method (see Figure 7.6)
• Press Windows key and R together from the keyboard. Alternatively, type
RUN in start-up menu search box
• Type MSACCESS in the RUN dialog box
• Press OK or enter from the keyboard
46
Figure 7.6 Run dialog box
Thereafter, the Access start-up window appears. Unlike other Microsoft office
programs, Access database must be created first before other manipulation can occur.
Figure 7.7 shows the Access start-up window and how a new blank database is
created by providing a database name in the file name and clicking the create button.
Alternatively, an existing Access template can also be used instead of a blank
database.
47
8
Working with Microsoft Access
Table
This chapter discusses how Tables support data processing in Access. The chapter
covers:
Overview of Tables in Access
Defining a Table
How to create Tables in Datasheet View
How to create Tables in Design View
Adding records Tables
Defining Table Relationships
First, we define the Table fields and their purpose in the table. For instance, there is a
VisitID which is a unique attribute to help identify records in Visit Table. Table 8.1
provides some fields and their purpose in the Visit Table.
48
Field Purpose
VisitID Unique number assigned to each visit; will serve as the table's primary
key
PatientID Unique number assigned to each patient; common field that will be a
foreign key to connect to the Patient table
VisitDate The date on which the patient visited the clinic
One of the most important tasks in creating a table is deciding what names to specify
for the table’s fields. Keep the following guidelines in mind when you assign field
names:
A field name can consist of up to 64 characters, including letters, numbers,
spaces, and special characters, except for the period (.), exclamation mark (!),
grave accent (`), and square brackets ([ ])
A field name cannot begin with a space
Capitalize the first letter of each word in a field name that combines multiple
words, for example VisitDate
Use concise field names that are easy to remember and reference, and that
won’t take up a lot of space in the table datasheet
Use standard abbreviations, such as Num for Number, Amt for Amount and
Qty for Quantity, and use them consistently throughout the database. For
example, if you use Num for Number in one field name, do not use the
number sign (#) for Number in another
Give fields descriptive names so that you can easily identify them when you
view or edit records
49
column or row (respectively). A field selector is also called a column selector. A
record selector is also called a row selector. Figure 8.1 shows the Visit Table in a
Datasheet View.
50
Figure 8.1 Creating Table in Design view
51
with the number 1 for the first record, the number 2 for the second, etc. Figure 8.3
shows how to change a datatype in a Datasheet View.
52
Click the Create tab on the Ribbon
In the Tables group on the Create tab, click the Table Design button. A new
table named Table1 opens in Design view
Type the field name, select appropriate data types, and provide a description of
the field. Note that the description field is optional
Press the Tab key to advance to the next field until all the fields are provided.
Finally, set the property for the fields
Defining Fields
When you first create a table in Design view, the insertion point is located in the first
row’s Field Name box, ready for you to begin defining the first field in the table.
Enter values for the Field Name, Data Type, and Description field properties,
and then select values for all other field properties in the Field Properties pane.
These other properties will appear when you move to the first row’s Data
Type box.
Identify all the fields needed to produce the required information. Organize
each piece of data into its smallest useful part
Group related fields into tables
Determine each table’s primary key
Include a common field in related tables to create relationships
Avoid data redundancy
53
Naming Fields and Objects
To name fields and objects, the following steps are recommended.
Provide a name for each field, table, and other object in an Access database
Assigning Field Data Types
Each field must have a data type
Data types are assigned automatically by Access or specifically by the table
designer
The data type determines what field values you can enter in the field and what
other properties the field will have
The data type determines what field values you can enter in the field and what other
properties the field will have. Figure 8.6 shows the various Access data types, their
description, and acceptable field size. For instance, the short text data type allows
associated fields to accept letters, digits, spaces, and special characters. The short text
data type also allows a field size of 0 to 255 characters. Thus, the values entered into a
short text data type field cannot be more than 255.
54
Figure 8.6 Access Data types
55
requests for specific records based on the primary key. Save the Table structure by
providing a name that reflects the entity. Figure 8.7 shows how to assign a primary
key to a table in the Design view.
Once the table is opened in the Datasheet View, you can enter the data starting from
the VisitID column to the WalkIn. Figure 8.8 shows how records are added to an
Access Table.
56
Figure 8.8 Entering records to a table
Saving a Table
Records entered in an Access table are immediately stored in the database as they are
entered. However, the table’s design items such as the field names and characteristics
of the fields themselves, plus any layout changes to the datasheet are not saved until
you save the table. When you save a new table for the first time, you should give it a
name that best identifies the information it contains. Like a field name, a table name
can contain up to 64 characters, including spaces
One-to-One
This relationship exists when one instance of a table has only one relationship with
one instance of another table. This means that at any point in time, the records in one
table can have only a single unique relationship with another record in a different
Table. For instance, if each student in the University of Ghana is given a laptop, then
57
there is a one to one relationship between a student and a laptop. Thus, a student
cannot have two laptops and one laptop cannot be assigned to two students.
One-to-Many Relationships
A one-to-many relationship exists between two tables when one record in the first
table matches zero, one, or many records in the second table, and when one record in
the second table matches at most one record in the first table. For instance, one
customer can make one or more purchases, but the purchases can only be attributed to
a single customer.
Many-to-Many
In this relationship, one or more instances of one table have a relationship with one or
more instance of another table. For instance, in the University of Ghana, one or more
students can register for one or more courses in a semester. This scenario creates a
many-to-many relationship among the students and the courses table.
58
9
Working with Microsoft Access
Forms
This chapter discusses Microsoft Access Form and how it aids in data processing. The
chapter covers:
59
A new Form should be created automatically bearing the name of the table on which
the Form was created. Figure 9.1 shows a sample form created using the Form
approach.
The Form Design Tools tab will also appear at the top of the ribbon. The three
tabs under this option are Design, Arrange, and Format.
Click the Form Design Tools: Design Tab if necessary. In the Tools Group,
click the Add Existing Fields button as presented in Figure 9.3. The Field List
Task Pane will display. This list contains a list of the tables in the database.
Click the Show All Tables link in this task pane if the list of tables does not
appear.
Click the plus (+) sign next to the Table you wish to use on the Form to show
the Field Names in the table.
60
Figure 9.3 Form Design Tools
Drag a Field from the Table to the Form to be included. The label for the field
will appear to the left of the field control box.
Repeatedly drag other Fields to be used for the Form to complete the design.
Instead of dragging the fields individually, the Shift key can be held down and
the last Field selected. The list of Fields should be highlighted and ready to be
dragged to the Form to complete the design.
61
Figure 9.5 Layout Window of the Form Wizard
Click Next to choose the Form item sort order or chose Finish to complete the
Form Wizard. The Form should now be created and populated by the data in
the Tables / Queries used. Figure 9.6 shows a final Form created using the
Form Wizard.
62
10
Working with Microsoft Access
Queries and Reports
This chapter discusses how to retrieve and present data using Microsoft Access Query
and Report objects. The chapter covers:
63
the query. A recordset should be created with the result of the query. Figure
10. 1 shows the query wizard window for creating queries.
64
Add other query options such as sort, criteria, show and OR for specific
results.
Figure 10.1 shows how to create and run queries using the Query Design.
65
10.4 Filtering Data
A filter is a set of restrictions you place on the records to temporarily isolate a subset
of the records. Filtrating allows you to view different subsets of displayed records so
that you can focus on only the data you need. An applied filter is not available the
next time you run the query or open the form (unless it has been saved). The simplest
technique for filtering records is Filter by Selection. This technique lets you select all
or part of a field value in a datasheet or form, and then display only those records that
contain the selected value in the field. Another technique for filtering records is to use
Filter by Form, which changes your datasheet to display blank fields. Figure 10.3
shows a query data filtration.
66
Figure 10.4 Query record selection criteria
67
When appropriate Fields are selected, then click Next button
Select an appropriate Layout from the templates presented in Figure 10.6
Click Next to choose the Report item sort order or Finish to complete the
Form Wizard. The Report should now be created and populated by the data in
the Tables / Queries used. Figure 10.7 shows a final Form created using the
Form Wizard.
68
Figure 10.6 Report wizard layout window
69