MS Access Manual
MS Access Manual
INTRODUCTION
Probably you have ever worked with a large and enormous data which made your data analysis and
management difficult. You were probably not alone. Take it that you were employed in a statistics firm and
your work is collecting data or probably you are a secretary of your school and you always receive large
data at the end of the day. How do you manage it?
Microsoft Company has come with a program that can help you to work on your databases easily and
effectively.
A data base is a collection of information that is related to a particular subject or purpose such as tracking
customer orders or maintaining a music collection.
Using Ms. Access you can
Manage all your information from a single database file.
You can divide your data into separate storage containers called tables.
View, add and update table data by using online forms
Find and retrieve just the data you want by using queries
Analyze or print data in a specific layout by using reports
Select the START button, point to Programs, Point to Ms-Office or Microsoft office application, click on
Microsoft access. [This depends on the way programs are organized in your machine]
OR
On the desktop, look for a Microsoft access Icon and double click on it to open.
OVERVIEW OF MS ACCESS
TABLE
Stores data in Rows and column format similar to a spreadsheet
QUERY
Extracts data from table based on user supplied criteria. They enable you to view fields from more than one
table or query.
REPORT
Displays and prints data from table or query based on the user defined custom format. You cannot delete
data from a report. Report can contain information from one table ot query.
The databases window contains a button (a tab) for each object. When you select a database object such as
table, access lists the existing table names. To open a specific object, single click the name and then click
open button either when opening the table, query or a form, for a report you click the preview button.
Use the new and design dialog buttons to create a new database object and also modify the design of
existing objects.
TABLES
A table provides a structure for data
You have to note the fields and the records
For example if you are to create a table for a college named CITC you would need to draft a table like this:
2
PRACTICAL EXERCERSISES
Practicals in this series have been designed to provide a basic understanding of how a system may be
developed in Microsoft Access Application.
TUTORIAL ONE
NB.
In the format property, a greater than symbol (>) will convert whatever is typed into uppercase.
Select the row with ID Number and then click on the button which has a key picture on the standard tool
bar.
Close the Table and save it as Employee
3
ENTERING DATA INTO TABLES
USING FILTERS
FILTER BY SELECTION
Use filter by selection to list all members of the Administration department i.e. Take the cursor to one of the
administration department member, click on Records, Filter by selection. It displays all members from the
administration department
FILTER BY FORM
Use the filter by form command to list all union members whose payrate is less than ten. Click on records,
filter by form. Under payrate type <10, under union put a tick by clicking to present Yes. Click on Filter,
Apply filter. Close the table without saving.
CREATING QUERIES
Create a select query using all the fields in the employee table.
Click on queries, New, Design view, Ok
4
Select the table you want to use and click Add then Close. Double click on each field and perform the tasks
below.
SELECT QUERIES
Create a query in design view that will display all members in the accounting department their Last name
sorted in ascending order.
PROCEDURE
Use the above procedure. Under the criteria row in the department field type Accounting.
Under the Last name in the sort row click and select Ascending.
Close the table and save it as Accounts list.
Open to view the result.
PARAMETER QUERY
Open the accounts list query in design view
Change the department criteria from accounting to a different department eg administration list. Save the
query as Administration list.
Repeat the procedure above to produce list for the other departments and save them with their [department
name] list.
5
TUTORIAL TWO
Create a new database called My Applications
Create the following table structures giving them appropriate names and key fields
Save the table as Nationality and don’t put any primary key
Save the table as department and don’t put any primary key
COMBO BOXES
Open the table Personal details in design view. Move to the field Nationality. Under the field properties
click on look up. Under display Control box select combo box. Under type select Field list. Under row
source select nationality table.
6
Move to the department field and do the same.
DEFINING RELATIONSHIPS
So far you have four tables which have a similar key field PAYNUM. There is need to establish a link
between the four tables at this level for the purpose of queries. The primary table is PERSONAL DETAILS
and records must exist here before they are queried upon by any other table.
Ensure that all the tables are closed but your database remains open.
From the Tools menu select relationships
Select the four major tables i.e. click on each table and then click Add. After choosing all four click close.
Drag and drop the following fields into the tables given:
From Personal details click and drag PAYNUM to PAYNUM in the children’s details table, A
dialogue box appears Click on enforce Referential Integrity then click on Create
From Personal details click and drag PAYNUM to PAYNUM in the Appointments table, A dialogue
box appears Click on enforce Referential Integrity then click on Create
From Appointments click and drag PAYNUM to PAYNUM in the Payments table, A dialogue box
appears Click on enforce Referential Integrity then click on Create
Close and save the relationship layout
7
PAYNUM SURNAME FORENAME BIRTHDATE MARRIED NATIONALITY ADDRESS PHONE DEPARTEMENT
21 RIVET TREVOR 10/26/1962 No BRITISH 12RD 23233 PRODUCTION
30 WEST HELEN 10/29/1962 Yes BRITISH 21HIGH 45200 SALES
40 MZERE CAROL 5/1/1960 Yes AMERICAN 14AVEN 50210 STORES
41 MAMBO VICTOR 1/2/1965 Yes BRITISH MONRD 45200 SALES
Table : APPOINTMENTS
8
PAYNUM TAX MEDICAL AID PENSION
1 55 55 10
3 52 56 10
4 48 34 10
7 28 30 10
8 15 25 10
9 29 30 10
10 35 34 10
11 33 34 10
15 33 34 10
17 25 34 10
21 25 34 10
30 52 34 10
40 49 34 10
41 28 30 10
Use the knowledge that you have acquired in the previous work to perform the following. Guidelines have
been outlined.
Create a query in design view using the personal details table to produce all members who are married and
work under the sales department. Save the query as sales.
Create another query in design view using the table Children’s details to produce all male workers born
between 1977 and 1979. Save the query as BOYS.
Create a simple form using the Autoform:Tabular wizard for entering new records to the personal details
table. Save the form as Personal input form.
Use it to add four new records of your own to the personal details table.
Using the other three tables create forms for each by using the form wizard as below
Click on Forms, New, Form wizard
Choose the table you are to use and click OK
Select all fields with the two arrows >> and click next
Select the layout as tabular and click next
Select also the style of your choice and click next
Type a name for the form and click finish
9
TUTORIAL THREE
Complex forms, Cross tab queries, Action queries, Reports etc
Open the database My Applications
QUERY ONE
Creating queries with new fields
Create a select query using the personal details table with the following fields
Paynum, Forename, Department, Birthdate
Add this new field to calculate age after entering the last field birthdate
Type exactly as it appears Age: (Date()-[birthdate])
Save the query as Personnel ages and test the results through opening the query to see whether it has added a
field Age after the last field in the personal details table.
QUERY TWO
Create another select query using the following fields from the various tables
Make sure you add all the three tables before you click close.
TABLE FIELDNAMES
Personal details Paynum, Surname, Department
Appointment Appointed, Salary
Payments Tax, Medical aid, Pension
Add a new calculated field to obtain the net pay with the following formula
NET SALARY:[SALARY]-[TAX]-[MEDICAL AID]-[PENSION]
Save the query as net salaries
QUERY THREE
CREATING CROSSTAB QUERIES
This will count total number of employees in each department and the overall
Create a crosstab query using the table personal details with the fields
Click on query, new, select crosstab query wizard, click ok
Select the table you want for the crosstab and click next
Click on the field Nationality for the row heading and click on > to select. Click next
Click on the field Department for the column heading and click next
Click on the field Paynum for calculation and select Count under the functions
Save the query as Department by nationality summary
Open to view the results
QUERY FOUR
CREATING ACTION (UPDATE) QUERY
Create a query in design view
Add the table appointment and close
Use only the field salary (by double clicking on it)
Click on query on the menu bar, select query update
Under update to row type the formula: [salary]*1.15
(This will increase the salaries by 15% in the appointment table)
Open the query just once. Check the effect on the actual data in the appointments table
TUTORIAL FOUR
Create a form using the appointments table
Click on New, form wizard, Ok
Choose the table appointments and click on >> to select all fields and click next
10
Select Datasheet and click next
Choose the appropriate style for your form and click next
Click the name of the form and finish
CREATING REPORT
Create a report Autoreport Tabular from the table personal details
Go to the report button
Click on New
Autoform tabular, select the table to use and click Ok
Wait to preview the report
Close it and save it as personal details
Steps
Click on report button, New, Report wizard
Choose the table/query to use
And select all the fields & click next
You will be asked whether you want to add group level
Select department and click on >
Click next and follow the instructions
Save the report and print preview.
11
MORE EXERCERSISES
ASSIGNMENT ONE
Open the table in design view and add a field CODE then enter the following records
OC1, JT4, SB8, KE2, BE7, UB9, TK1, CB9, TB5
Save the table as Task 1
Create queries to perform the following tasks and give them appropriate names
A list of products from EAI
List productcs with price greater than 90 and less than 180
List products which are NOT manufactured by EAI
Give me a list of products which are tinned ( I require the fields product, container & price only)
Produce a list of products with price 100 or less and are from EAI
Create a form and add 4 records of your own to update the table
Create a report of each question asked
Create a report with the following fields in order
Product
Code
Price
Tel. No.
Group the data as per container
Save your report
ASSIGNMENT TWO
Produce a list of mails from Kenya with all the fields and sorted in order of name
Produce a list of all mails received on 13th February 1990
Create a report showing name, town and the country sorted in alphabetical order
Produce a list of mails received before 1991
ASSIGNMENT THREE
OTHER
FIRST NAME BOX TOWN AGE INSURED COMPLAINT
NAME
JOHN DAVIS 2181 MOMBASA 35 YES COLD
KELVIN JONES 181 NAIROBI 40 YES FEVER
DAVID BRAHAM 2001 NAIROBI 38 NO FRACTURE
DORIS HOODS 2614 MOMBASA 37 YES NONE
MARVIN HAYLES 8181 KIKUYU 41 NO NONE
BRIAN ALI 7410 NAIROBI 36 NO COLD
WALTON BRANDY 1452 KERICHO 45 NO FEVER
DENNIS LYMOND 1547 NAIROBI 60 NO FEVER
DANIEL SHAWLS 1542 DIANI 52 YES FEVER
DALTON WAYNE 8541 MOMBASA 38 YES COLD
BREDA WILLIS 3254 NAIROBI 54 NO NONE
DORIS LYNN 4786 KIRIANI 39 YES NONE
JACK DAVERAL 9852 NANYUKI 53 NO NONE
STEPHIE WANNER 1475 THIKA 49 YES FRACTURE
STACY CHRIS 1367 KISUMU 39 YES COLD
STANLEY BLAK 8796 KISUMU 46 NO COLD
KENNETH WARRICK 4152 THIKA 43 NO COLD
DORIS LOPEZ 1533 DIANI 37 YES FRACTURE
WALTER BRAVO 7584 NAIROBI 55 NO NONE
ASSIGNMENT FOUR
ASSIGNMENT FIVE
14
Create the table below and save it as Memorial hospital
Table1
TITTLE FIRSTNAME FAMILYSIZE SALARY TOWN DISEASE
MR AJMAL 20 15000 MOMBASA FEVER
MR RAVAR 15 14600 THIKA MALARIA
MRS AKINYI 7 12100 NAIROBI DEABETES
MR OKOWOYO 4 12000 NAIROBI ULCERS
MISS NANJI 12 92300 NAIROBI LABOUR
MRS JAUDA 6 600 MOMBASA HEADACHE
MISS SEINA 3 7490 MOMBASA ULCERS
MISS NAHER 3 8100 NYERI LABOUR
MRS BELJAR 20 4200 NAIROBI FEVER
MR SAARKER 13 2000 KERICHO TRACHOA
MISS JABBAR 8 5500 NAKURU DEABETES
MRS MAISH 5 6500 NYERI FEVER
MRS CHARDA 10 11500 KERICHO MALARIA
MR NANDY 8 20340 ELDORET DEABETES
MR TUMAR 6 1500 NAKURU ULCERS
MISS ZITTER 9 6000 KISUMU LABOUR
MR BOB 6 3500 KISUMU MALARIA
MISS ANGIE 10 1500 NAKURU ULCERS
After creating the table, make a copy of it as updated records Memorial Hospital
Amendments
Create queries to produce lists of the following and save each with a different name
The patients with a family size of more than five and live in Nakuru
All men earning less than 5000
All ladies (miss) suffering from ulcers
All pregnant women
Married women suffering from fever
Patients from Nakuru and sort in ascending order of firstname
List with all the records sorted in descending order of salary
Access is application program used to retrieve, store, maintain and manipulate data in a database.
A database is the collection of related tables about a specific event.
Records are a collection of related field of data.
Field single characteristic of event or person / ideas.
Primary key is a unique identification of a single record.
COMPONENT OF ACCESS
Object use to manipulate and maintain data in the database eg table, queries, forms, reports, pages, macros,
modules
15