You are on page 1of 44

Major General Mulugeta Buli Technical College

Training, Teaching and Learning Materials Development


yes

MAJOR GENERAL MULUGETA BULI TECHNICAL COLLEGE


under

Ethiopian TVET-System

INFORMATION TECHNOLOGY
SUPPORT SERVICE
Level I

LEARNING GUIDE # 1
Unit of Competence: Operate Database Application
Module Title : Operating Database Application
LG Code : ICT ITS2 M01 L01 01
TTLM Code : ICT ITS2 TTLM01 0511

LO 1: Create database objects

Learning Guide Page 1 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

INTRODUCTION Learning Guide # 1

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 object table
 Creating DB object form, query and report
 Creating DB object macros, module & data access page

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 design principles


 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 Sheets 1” in pages 3-5.
3. Accomplish the “Self-check” in pages 6.
4. If you earned a satisfactory evaluation proceed to “Information Sheet 2”. However, if your rating is
unsatisfactory, see your teacher for further instructions or go back to Learning Activity # 1.
5. Read the information written in the “Information Sheet 2” in pages 7-10.
6. Accomplish the “Self-check” in page 11.
7. If you earned a satisfactory evaluation proceed to “Information Sheet 3”. However, if your rating is
unsatisfactory, see your teacher for further instructions or go back to Learning Activity # 2.
8. Read the information written in the “Information Sheet 3” in pages 12-15.
9. Accomplish the “Self-check” in page 16.
10. If you earned a satisfactory evaluation proceed to “Information Sheet 4”. However, if your rating is
unsatisfactory, see your teacher for further instructions or go back to Learning Activity # 3.
11. Read the information written in the “Information Sheet 4” in pages 17-21.
12. Accomplish the “Self-check” in page 22.
13. If you earned a satisfactory evaluation proceed to “Operation Sheet 1-7” in page 23-43. However, if
your rating is unsatisfactory, see your teacher for further instructions or go back to
Learning Activity #4.
14. Read and perform each of the “Operation Sheets”.
15. Do the “LAP test” on page 44 (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
advice you on additional work. But if satisfactory you can proceed to Learning Guide 2.

 Your teacher will evaluate your output either satisfactory or unsatisfactory. If unsatisfactory, your
teacher shall advice you on additional work. But if satisfactory you can proceed to the next topic.

Learning Guide Page 2 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Opening and designing DB application and
Information Sheet 1
principles
Database
A database can best be described as a way of storing large amounts of information. The
data can be retrieved and we can even ask questions of the data and get answers. For example:
You may want to know how many Students enrolled in every occupational level.

Ms Access is a database management tool that enables one to store relevant data.
This also has the capabilities to retrieve, sort, summarize and report results
immediately and effectively. It can combine data from various files (tables)
through creating relationships, and can make data entry more efficient and
accurate through the use of forms.

Microsoft Access (MS Access) enables one to manage all important information from a
single database file. Within the file, one can use the different objects:

 Tables - A table is a collection of data about a specific topic, such as products or


suppliers. Using a separate table for each topic means that you store that data only once.
This results in a more efficient database and fewer data-entry errors.
 Queries - You use queries to view, change, and analyze data in different ways. You can
also use them as a source of records for forms, reports, and data access pages.

 Forms - A form is a type of a database object that is primarily used to enter or display
data in a database. You can also use a form as a switchboard that opens other forms and
reports in the database, or as a custom dialog box that accepts user input and carries out
an action based on the input.

 Reports - A report is an effective way to present your data in a printed format. Because
you have control over the size and appearance of everything on a report, you can display
the information the way you want to see it
 Modules - A module is essentially a collection of declarations, statements, and
procedures stored together as one named unit to organize your Microsoft Visual Basic
code. Microsoft Access has two types of modules: standard modules and class modules.

 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.

In MS Access, data is stored once in one table, but can be viewed from multiple locations.
When the data is updated in a Table, Query or Form, it is automatically updated everywhere it
appears.

Establishment of Ms Access database


All Ms Access databases files are saved with extension .mdb. A database should have a
separate table for every major subject, such as Students records, Students grades, etc..

Learning Guide Page 3 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Production data or Treatment information. Data should not be duplicated in multiple


tables.

Microsoft Access provides three methods to create a database

 Database Wizard (though easy, the wizard offers limited options to customize the
database)
 Using a template (This method works best if one can find and use a template that closely
matches the specific requirements)
 Creating a database directly (This is the most flexible method, but it requires one
to define each database element separately).

Basic Database Concept: In studying MS Access, it is but necessary to understand some basic
elements of a database before proceeding to it.

Database Elements:
 Data are raw facts. It tells the truth about something; a person, a place, an object, etc.
Example:

Name (1) “Noel” is a data. “Noel” is my name, so


Noel it tells something about a person. “Noel”
is a Name

Gender (2) “Male” is Noel’s gender. So it tells


Male something about “Noel”. Noel is Male.

 Information is a collection of data (raw facts) which is contained in 1 file (table in Access)
Example:
IDNumber LName FName Mname Gender Bday Address
MOE-0001 Cuevas Noel Pancho Male 11-05-1978 Aratkilo
(this is an information about a person named “Noel”)

Example of a table (file):


IDNumber LName FName Mname Gender Bday Address
MOE-0001 Cuevas Noel Pancho Male 11-05-1978 Aratkilo
MOE-0002 Panganiban Mark Perez Male 11-05-1978 Piasa
MOE-0003 Cerna Patrick Santos Male 11-05-1978 Aratkilo
MOE-0004 Hipolito Valder Cruz Male 11-05-1978 Sidiskilo
MOE-0005 Ohmy Diana Antonio Female 11-05-1978 Aratkilo

Learning Guide Page 4 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Naming Convention
Is manner of naming files and variables. Having a poor naming convention can only add
confusion, so it's important that you start with a good scheme, and think about what the scheme
will mean to you. Here are the three things to consider in establishing a naming convention:
1. Does my convention make sense to me?  
 Is must be simple and understandable to you.
2. Will my convention make sense to other people? 
 Time will come that other people will look into your database program, so they
must able to understand it.
3. Can I be consistent in implementing and enforcing my convention? 
 All throughout my database work, your naming convention must not change.

General 
Here are some basic simple rules when it comes to the name of any object in a database
(including the name of the database itself): 

 Do not use spaces in object names. It might seem tempting and cute to have a view
named "Sales By Quarter," but this is a nightmare to deal with programmatically. Instead
write it as “SalesByQuarter” or “SalesByQtr” or “QtrlySales”

 Avoid using reserved words. This is easier said than done, as there is a very large list
of current and future reserved words to check against. Example: do not name your file as
“Date” because “Date” is a reserve word in Ms Access.

 Do not use dashes in database names. Dash “-“ was often recognized by a computer
as an operator (subtraction), so instead of naming your object as “Quarterly-Sales”
better name it as QuarterlySales” or better use underscore instead of a dash
“Quarterly_Sales”.

 Start object names with a letter. I see table named "2005_Sales" and columns and
columns named "1", "2," "3," and so on (to represent months). Ms Access might treat it
as a number and not as a filename.

 Keep names short but meaningful. This is self-explanatory and fairly logical, "SlQ" is
too short. “SalesFiguresForCompanyByFiscalQuarter" is just silly.   

 Use sensible case. There is little worse than going through a database schema where
all the table names are in ALL CAPS. It’s like Ms Access is yelling at you! Likewise, trying
to read a procedure name like "getallarticlestatisticsbyweek" could drive some people to
drink. I like camel-/Pascal-casing or using underscores, leaning toward the former in most
cases: GetArticleStatsByWeek or getArticleStats_ByWeek.

 Avoid Hungarian notation. The name of the object should make it pretty obvious what
type of data it contains, and if for some reason it does not, then there is always the
metadata tables and/or the documentation you should have written when designing the
system. Using datatype-style prefixes for columns like IContactID (integer) and VEmail
(varchar) not only make the column names harder to read, they also make them less
flexible. 

 
Learning Guide Page 5 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Self-Check 1 Written Test

Name:____________________ Date:_________________
Instruction: Answer all the questions listed below, if you have some clarifications- feel free to ask your teacher.

Please ask your trainer for the questionnaire for this Self-Check.

Learning Guide Page 6 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Information Sheet 2 Creating a database object table

Creating DB Tables
Recently, we define it as a file but technically, it was defined as a container or a
worksheet-like container where the collection of data has been stored.

Before we proceed to creating your first table, we need to know first the basic
components of a table:
o Meta Data – Database Structure
o Field – Column – Data
o Fieldname
o Record - Row - Information

Metadata – is a “data about data” or synonymously called table structure that


defines what type of data your data is?

Given these data:


(1) “Noel” which is a firstname, we can say that it composes of texts, so
we define the firstname to accept text only thus it accepts the value “Noel”

(2) Supposed that “21” is the Age of Noel, then we will define Age as a
number, specifically an Integer so it will only accept a value which is an integer.

Thus it gave a table structure of:


Field Name Data Type
Firstname Text
Age Integer

Which only means to say that you cannot enter a number value in the Firstname
field, likewise you cannot enter a text value to the Age field. In that case, entering a
number value to a Firstname field would treat it as text. Ex: Noel23. And cannot be
used for computation.

Field – Every column in a table represents a field by which data has been stored.
Field name – This refers to the name of every field.
Records – Every row in a table represents a record, which is a collection of meaningful
data.

Learning Guide Page 7 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Example of a table : Table name: StudentsTable


7 columns = 7 fields

Row IDNumber LName FName Mname Gender Bday Address


Record MOE-0001 Cuevas Noel Pancho Male 11-05-1978 Aratkilo
MOE-0002 Panganiban Mark Perez Male 11-05-1978 Piasa
MOE-0003 Cerna Patrick Santos Male 11-05-1978 Aratkilo
MOE-0004 Hipolito Valder Cruz Male 11-05-1978 Sidiskilo
MOE-0005 Ohmy Diana Antonio Female 11-05-1978 Aratkilo

Field names

“MOE-0001” is the data for IDNumber field. And IDNumber is a fieldname for that data.

1 Record MOE-0001 Cuevas Noel Pancho Male 11-05-1978 Aratkilo


1 Row gives an information. It tells that Noel Pancho Cuevas is a Male whose birthday
is on 11-05-1978 and who lives in Aratkilo.

Data Types

When creating a table, one will need to specify what kinds of data are to be stored in this
field.

The different kinds of Ms Access 2003 data types are:


 Text: allows for the storage of any kind of data, characters, digits and special
characters. It has a defect length of 50 characters with a maximum length of 255.
It is normally used to store data such as names, addresses, or any number not
used in calculations, like telephone numbers or zip codes.

 Memo: is used for texts of more than 255 characters such as comments or
explanations. It has a maximum length of 65.536 characters. Access recommends
that to store formatted text or large documents, rather to create an OLE Object
field than a Memo field.

Learning Guide Page 8 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

In Access2003 it is possible to arrange or group in a Memo field, but Access only


uses the first 255 characters when it arranges or groups in a Memo field.

 Number: for numerical data used in mathematical calculations. Within the number
type we are able to specify the size property of the field. The types Byte, Integer
and Long Integer allow the storage of numbers without decimals; the types Single,
Double and Decimal allow decimals; the type Replication ID is used for
autonumerical codes in replication databases.

 Date/Time: for the introduction of date and time from the year 100 to 9999.

 Currency: For monetary values and numerical data used in mathematical


calculations in which the data involved contains between one and four decimals.
The accuracy is up to 15 digits to the left of the decimal separator and up to 4
digits to the right of the same.
Access recommends the use of Currency type to avoid the rounding off of numbers
in calculus. A Currency field has an accuracy of up to 15 digits to the left of the
decimal separator and 4 digits to the right. A Currency field occupies 8 bytes of
space on disc.
 Autonumber: a unique sequential number (increasing one by one) that Access
assigns every time it adds a new record to a table. Autonumber fields cannot be
updated.

 Yes/No: Yes and No values, and fields that contain one of two values (Yes/No,
True/False or Activated/Deactivated).

 OLE Object: an object such as a Microsoft Excel spreadsheet, a Microsoft Word


document, graphics, images, sounds, or other binaries.

 Hyperlink: text or a combination of text and numbers stored as text and used as a
hyperlink address. A Hiperlink is a text or graphic that you click to go to a file, a
location in a file, a web page on the Internet, or a web page on an intranet.

Tables may be created by either:


 Table wizard
 Design view

Creating Tables using design view


Creation of a table by design view is a user customized way of making data storage
tables.

Each field in the design view of a table corresponds to a column in the datasheet view of a
table.

Learning Guide Page 9 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Designing a table involves:

 Entering unique names of the columns of the table in the “field name” column of the
design view. Names of fields and objects in Microsoft Access can be up to 64 characters long.
They can include any combination of letters, numbers, spaces, and special characters except a
period (.), an exclamation point (!), an accent grave (`), and brackets ([ ]). They also can't
begin with leading spaces

 Primary Key is the unique identification of one record. It will not allow a duplication of
the Primary Key thus make it unique. Define a Primary Key field (You don't have to define a
primary key, but it's usually a good idea. If you don't define a primary key, Microsoft Access
asks if you want Access to create one for you when you save the table)

Learning Guide Page 10 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Self-Check 2 Written Test

Name:____________________ Date:_________________
Instruction: Answer all the questions listed below, if you have some clarifications- feel free to ask your teacher.

Please ask your trainer for the questionnaire for this Self-Check.

Learning Guide Page 11 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Information Sheet 3 Creating database objects form, query and


report

Example of a form

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
 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.

Control Toolbox

Learning Guide Page 12 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

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.

Example of query in design view

Learning Guide Page 13 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

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.

Example of a query in an SQL view

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.

Learning Guide Page 14 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

(Example of a report)

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.

Learning Guide Page 15 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Self-Check 3 Written Test

Name:____________________ Date:_________________
Instruction: Answer all the questions listed below, if you have some clarifications- feel free to ask your teacher.

Please ask your trainer for the questionnaire for this Self-Check.

Learning Guide Page 16 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Information Sheet 4 Creating database objects macros, modules


and data access page

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 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.

Learning Guide Page 17 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
An example of a macro that opens a report with a filename “R_ITStudentsList” in print preview.

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
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 below:

Project window Declaration Section Procedure Box

Module window

Properties window

Immediate window

Learning Guide Page 18 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
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.

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.

Data Access Pages


Learning Guide Page 19 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
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


Learning Guide Page 20 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
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 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.

Learning Guide Page 21 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Self-Check 4 Written Test

Name:____________________ Date:_________________
Instruction: Answer all the questions listed below, if you have some clarifications- feel free to ask your teacher.

Please ask your trainer for the questionnaire for this Self-Check.

Learning Guide Page 22 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Operation Sheet 1 Creating a table


Creating Database Object: Table
(In this lesson, we will be using MS Access 2003)

Before you can create a database objects, you need to launch first the MS Access Software and
then create a blank database.
 To launch MS Access 2003

Double click the Icon in the Desktop or

Click on the Start button> All Programs > Microsoft Office> Microsoft Access 2003

(2) All Programs (3)Microsoft Office

(1) click Start Button

(4) Microsoft Access 2003

 To create a blank database


Learning Guide Page 23 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
After launching the MS Access 2003, click the NEW ICON then click the Blank
database… After that, a File New Database will pop-up. Type the File name (type
MyfirstDB.mdb as your first table name ) for your database. Afterwards, click the
Create button.

(2)click Blank
(1)click New icon database..

(3) Type a
File name (4) click Create
button

Note: your file name must not have a space. It must be 1 word. MyfirstDB is a valid
file name, My first DB is invalid. You can define your own file name but for this purpose
let’s just use MyFirstDB. You may or may not include .mdb as an extension name. It
would by default add .mdb to your filename, thus, make it MyFirstDB.mdb.

Creating a Table
After creating a Blank database, you are now ready to create your first object, let’s start
with the Table.

Let’s now start creating a table..


Learning Guide Page 24 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Creating a table would start by creating a table structure which would define every field in
a table. Let us create a table T_StudentsList and let’s define the following fields as follows:
Field Name Data Type Description (describes each field – optional)
StudentID Text ID number of students
Lastname Text Last name of students
Firstname Text First name of students
Middlename Text Middle name of students
Birthday Date Birth day of students
Gender Text Gender of students
Course Text Course of students

Let’s now simulate it in MS Access..


After creating a blank database with a file name MyFirstDB.mdb, your screen should
resemble like this..

You are now ready to create your first database object, the table.
Double-click Create table in design view then a blank table structure template will
appear.

Enter value for Field Name, Data Type and Description as shown in the figure below.

Learning Guide Page 25 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

To make a pre-defined Course list, click the lookup tab properties then choose Combo Box on
the Display Control. On the Source List, choose Value List the start typing “Management” ; “IT”;
“Computer Science”; “Accountancy”; Computer Engineering.

To put primary key to a field, click on the field then click the key on the toolbar
above and the key will appear on the left side of the key. When you set one field as primary
key, you couldn’t input the same value for that field.

Learning Guide Page 26 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Note: For the Data type please refer to the Information Sheet 2 – Creating database object
table.

To insert new fields within the table, in design view, right-click in the row below where
you want to add the field, and then click Insert Rows on the toolbar.

To add the field to the end of the table, click in the first blank row.

To change from one view to another, make a selection on the View menu or click the
arrow next to the View button and choose from the list that appears.

To view, enter, and change data easily and directly in a table, create a ‘form’.

In the lower portion of the window Field properties, please refer below:

 Field size defines the number of characters you’re a text field can contain.
 Format is normally use for a field that has a data type of Number or Date. Click on it to
define custom settings you want.
 Input Mask was good in setting-up initial constant values. Setting an input mask for ID
number field to “MOE-999999” would mean that when you enter a value for that field it
would initially give you a value of MOE-_ _ _ _ _ _ . “999999” allows you to enter any 6-
digit numbers. So, you don’t need to type MOE- because it would automatically appear.
You just need to add a 6-digit value to it to complete its value. For example: typing
“000123” gives you “MOE-000123”.
 Caption defines the label of a field. Writing “Last name” on a Caption of the Lname.
See the Caption on the table input view later.
 Default Value gives you an initial value. If you are expecting more Male students, you
better put “Male” on the Default Value of your Gender field so that when you input a
record, it would automatically appear a Male on your Gender field so you don’t need to
type it anymore. In case of a Female gender, you can alter it anyway. You would save
time for all Male inputs since you don’t need to type it anymore.
 Validation Rule allows you to filter the values you just want to input for a particular
field. Setting a Gender field Validation Rule to “Male” or “Female” would mean that it
would only accept a Male and Female value for Gender field. Typing F or M to it would give
you an error-message.
 Validation Text is the counterpart of Validation Rule. Instead of displaying a computer
generated error-message when you input a wrong value to a field, you can set your own
error-message. You just type the text you want. Example: “Wrong Input!”

 Required field when set to Yes would not allow you to skip a certain field leaving it
blank.
 Indexed when set to OK (Duplicates OK) would sort out a field alphabetically and it
would accept duplicate values, when set to OK (No Duplicate) would sort out a filed

Learning Guide Page 27 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
alphabetically but would not allow you to enter the same value (you cannot enter an ID
number that already exist).

After that, press Ctrl+S on the keyboard to Save your table. It would ask you to enter a
Table Name. Replace Table1 with T_StudentsList then click OK button.

Note: Same rule applies in naming a table. No spaces please. Make it one-word like
T_StudentsList.

Your first table was now ready..

To input data, double-click the T_StudentsList table and you’re now ready to input
records to it.

Learning Guide Page 28 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

To navigate from records,

Navigation bar

Go to the beginning record Enter new record


Go to the next record
Go to the previous record Go to the end record

To modify a record, you just go to the specific fields of the record and modify it.

To delete a record, click on the Record Selection bar


the record you want to delete.
The record will be highlighted then press
Del key on your keyboard.

Press Ctrl+S on your keyboard to save changes


to your table.

Operation Sheet 2 Creating a form


Learning Guide Page 29 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Creating Forms
There were 2 ways to create a form
1. Create form in design view
2. Create form by using wizard

Let us try to create a form by using wizard. On the left pane, click on the Forms tab
then double click the Create form by using wizard.

Choose all fields from the table T_StudentsList by clicking on the double greater than
sign.

The single greater than ( < ) allows you to choose 1 selected field from the Available
Fields. To do the opposite (to deselect the field/s), click the less than or double less than sign.

After that, choose layout from the list. Choose also the form style you want.
For this exercise, choose the default layout, Again for this exercise, you choose Standard

Learning Guide Page 30 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
the columnar then click next. Layout and then click next.

Save your form as F_StudentsList by changing the T by F in the T_StudentsList.


Choose then the Modify the form’s design and then click Finish. It will then prompt you with
the form in design view as shown in the figure on the right. Let’s customize it a bit.

Just like the table, when you run the form in form view, it has its navigation button below
it that would allow you to navigate from one record to another and would also allow you to add

Learning Guide Page 31 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
records to your table using the form. It would also allow you to delete records through the
record selector.

Record
Selector

Navigation buttons

The next thing that you will need to do is to create your own customized navigation
buttons. Let’s now go back to your form’s design view.

Now, expand the form a bit by pointing the cursor on the bottom rightmost corner then
dragging while holding the left mouse click diagonally down as shown on the figure on the right.
Next, select all the fields by dragging the mouse through the form while holding the left click
making sure it would go over the entire fields as shown in the figure on the left

After selecting all fields, drag it all down to center into the form. Do it by dragging while
holding the left click of the mouse.

Learning Guide Page 32 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Add a label by clicking the “Aa” on the Toolbox then dragging it on the top part of the
form just up a bit to StudentsID field as shown on the left.

Type Students’ Database on it then make the label a bit bigger by clicking your cursor
anywhere in the form then clicking back on the label to select it again. Afterwards you can now
change the font and its size on the toolbar above,

Learning Guide Page 33 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

1. Wizard

2.button

What you would do next is to create the navigation buttons by using


a button wizard on the Toolbox.
To do that, do the following Button Wizards Steps:
1. Click on the wizard on the toolbox
2. Click the button on the toolbox
3. Drag the cursor while holding the left click
below the course field to create a small button
4. On the Control Button Wizard, choose Record
Navigation then choose Go to first Record
Then click next.
5. Click the default button icon picture then
click next.
6. Name your button as B_Gofirst then click
Finish.

3.

You have just created your first navigation button that would allow you to go to the first
record when you run it in form view.

Learning Guide Page 34 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

Let’s now create the rest of the navigation buttons as shown below.
1. Go to the first record
2. Go to the previous record
3. Exit
1 2 3 4 5 4. Go to the next Record
5. Go to the Last Record

2. Go to the previous record button


To do that, do the following Button Wizards Steps:
1. Click on the wizard on the toolbox
2. Click the button on the toolbox
3. Drag the cursor while holding the left click
below the course field to create a small button
4. On the Control Button Wizard, choose Record
Navigation then choose Go to previous Record
then click next.
5. Click the default button icon picture then
click next.
6. Name your button as B_GoPrevious then click
Finish.

3. Exit button
To do that, do the following Button Wizards Steps:
1. Click on the wizard on the toolbox
2. Click the button on the toolbox
3. Drag the cursor while holding the left click
Learning Guide Page 35 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
below the course field to create a small button
4. On the Control Button Wizard, choose Form
Operations then choose Close Form then
click next.
5. Click the default button icon picture then
click next.
6. Name your button as B_Exit then click
Finish.

4. Go to next record button


To do that, do the following Button Wizards Steps:
1. Click on the wizard on the toolbox
2. Click the button on the toolbox
3. Drag the cursor while holding the left click
below the course field to create a small button
4. On the Control Button Wizard, choose Record
Navigation then choose Go to Next Record then
click next.
5. Click the default button icon picture then
click next.
6. Name your button as B_GoNext then click
Finish.

5. Go to last record button


To do that, do the following Button Wizards Steps:
1. Click on the wizard on the toolbox
2. Click the button on the toolbox
3. Drag the cursor while holding the left click
Learning Guide Page 36 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
below the course field to create a small button
4. On the Control Button Wizard, choose Record
Navigation then choose Go to Last Record then
click next.
5. Click the default button icon picture then
click next.
6. Name your button as B_GoNext then click
Finish.

You are now finished creating your navigation buttons. Close it then save. To view it,
double-click the F_StudentsList form. When it opens, try navigating from one record to another.
Click all the buttons you have made and see how it works.

Operation Sheet 3 Creating a query


Creating Queries

There were 2 ways to create a Query


1. Create query in design view
2. Create query by using wizard

Learning Guide Page 37 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Once tables are available, it is easy to create a query.

Just click on the Queries, then double-click on Create query in design view. In the
Show Table pop-up, add the T_StudentsList table. A table will show-up on top part of the
query. Double click one by one all the fields on the table so it would appear on the table-like
sheet below. All the fields that you have selected would appear on the query view with the
corresponding records depends on your criteria.

Try putting “IT” on the course criteria as shown above. Close and save your query as
Q_ITStudentsList. Double-click on the Q_ITStudentsList to view the results of your query. It
would then show the list of all records whose course is “IT” as shown below.

Learning Guide Page 38 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

We have just created a query.

Operation Sheet 4 Creating a report

Creating Reports

There were 2 ways to create a Report


1. Create Report in design view
2. Create Report by using wizard

Learning Guide Page 39 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Just click on the Reports, then double-click on Create report by using wizard. Follow
the series of steps below in creating an IT Students List:

1. Choose Q_ITStudentsList query on the Tables/Queries drop-down arrow.


2. Select all fields by clicking the double greater than button just like what you
did in the form wizard. Click next after.
3. Just skip the level grouping by clicking Next.
4. On sort records, click on the Lastname then set its order as Ascending then click next.
5. Choose the default layout which is tabular and the default orientation as portrait then
click next.
6. Click the default style as formal then choose the Modify reports in design view
7. Save your report as R_ITStudentsList
8. Click on the Modify the reports design then click Finish.
9. It would then launch the Report in Design View as shown below.

Save it then close it. To preview your report, double click on the report file
R_ITStudentsList.

Note: to run the report, you would need to create a button in a form embedded with macro
code or VBA code that once click, it would execute opening or printing of a report.

Operation Sheet 5 Creating a macro


Creating Macros

Let’s try to create a Macro that will open that will open the report that you have just
created. Click now on the Macros, then double-click on New. Choose OpenReport in the Action
column, then on the Report Name property below choose the report that you have just
created(R_ITStudentsList). On the view property, choose print preview. Press Ctrl+S to save.
Save your module as M_ITStudentsList_ReportOpen then close it.

Learning Guide Page 40 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

To test your macro, double-click the macro file that you have just created. It would then
launch the report preview of R_ITStudentsList report as shown below.

You have now successfully created a macro. It’s so simple that you can play around with
it.

Operation Sheet 6 Creating a module

Creating Modules

Just click on the Modules,


then double-click on New. On the
Microsoft Visual Basic Form, type the code
you want to perform as shown below.
Learning Guide Page 41 of 44
1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

For this activity, type the following


code below:

Sub About theSystem( )


Msgbox “This is a students database”,”About”
End Sub

Press Ctrl+S to save then save it as Md_About. You have just created a Module with a
function that will display the message about your system. You can now close the Microsoft
Visual Basic Form.

To perform the modules, you need to call it in your form Event Procedure to execute or
embed to a button by using a wizard. (see Form Event Procedure links to module codes in the
succeeding learning outcome).

Operation Sheet 7 Creating a data access pages


Creating Data Access Pages

There were 3 ways to create a Data Access Page


1. Create data access page in Design view
2. Create data access page by using Wizard
3. Edit Web page that already exist

Learning Guide Page 42 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development
Just click on the Pages, then double-click on Create data access page by using
Wizard.

Follow these steps in creating your first Data Access Page:


1. Choose T_StudentsList table on the Tables/Queries drop-down arrow.
2. Select all fields by clicking the double greater than button just like what you
did in the form wizard. Click next after.
3. On the level grouping, click on Course Field then click the greater than button. By
doing this, you are grouping the students’ records according course.
4. On sort records, click on the Lastname then set its order as Ascending then click next.
5. Save your page as P_ITStudentsList
6. Click on Modify the page’s design then click Finish.
7. It would then launch the Data Access Page that you have just created in design view
as shown below.

To view the data access page, Click on Pages then double-click the data access page file
that you have just created.
Try to explore more the data access pages.

Lap Test Practical Demonstration

Name: _____________________________ Date: ________________


Time started: ________________________ Time finished: ________________

Instructions: You are required to perform the following individually with the presence of your
teacher.

 Please ask your trainer for the instructions for this lap test.

Learning Guide Page 43 of 44


1st Revision
Major General Mulugeta Buli Technical College
Training, Teaching and Learning Materials Development

 Your teacher will evaluate your output either satisfactory or unsatisfactory. If


unsatisfactory, your trainer shall advice you on additional work. But if satisfactory, you
can proceed to the next topic.

Learning Guide Page 44 of 44


1st Revision

You might also like