0% found this document useful (0 votes)
166 views38 pages

Microsoft Office Access 2010

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
166 views38 pages

Microsoft Office Access 2010

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

MS ACCESS 2010

Microsoft Access is a database programs, which


developed by Microsoft corporation, USA. It is a relational
database programs. It provides us to manage, developed
the data as your requirement such as you create salary
sheet, result sheet, sales table, purchase table, entry the
department data and other data entry as your requirement.
- Ms access default name accept (.accdb)

How to open the Ms access programs ?


Steps,
1) Click on start menu
2) Click on programs
3) Click on Microsoft office
4) Choose the Microsoft Office access of list
Open the Ms access programs from RUN command
Steps,
1) Click on start menu
2) Click on RUN
3) RUN dialog box will appear
4) Type the Msaccess in textbox
5) Finally click on ok button

How to create blank database ?


Steps,
1) When open Ms access programs
2) Choose Blank database
3) Type the database name any location
4) Finally click on create button
Ms Access objects are
- Table
- Query
- Form
- Report
- Macro
a) Table :- Table is a main object of database programs,
which is used to create the table with choose data
type.
How to create the new table ?
Steps,
1) When you create database, click on create menu
2) Click on table design
3) New table windows will appear
4) Type the field name with select datatype
5) Finally save and open table
Eg:-
Field name Data type
Sn Number
Name Text
Address Text
Course Text
Fee Currency
Admit date Date & Time
Remarks Memo

Data type properties


This property is used to entry the type of data at
required field such as Text, number, currency, date and
time, etc. Data type properties are:
i) Text: - This data type accepts both number and
alphabet.
ii) Number: - This data type accepts only number at
required field.
iii) Currency: - This data type chooses where you entry
value with display currency symbol such as Salary,
Amount, Fee etc.
iv) Auto Number: - This data type is used to
automatically generate continue number such as 1,
2, 3, ….
v) Memo: - This data type is used to type the long text
at particular field such as Comment, Remarks,
memo, note etc.
vi) Date & time: - This data type accepts only date and
time such as Admit date, date of birth, etc.
vii) Yes/ No: - It is used to choose the option from a
field such as Married status Yes or No.
viii) Hyperlink: - It is used to link the data with page
such as you link with Website, Email address.
ix) Lookup wizard: - It is used to create the list data
which data choose from a field as your
requirement.

How to create the list data?


Steps,
1) When you choose Lookup wizard data type.
2) A windows will appear
3) Choose the I will type ……. Option
4) After that, Click on Next button
5) Type the list data in Column
6) After that, Click on next button
7) Finally click on finish button

x) OLE object:- It is used to insert the object from


another programs such as you insert photo.
Lab work
Field name Data type
Emp_id AutoNumber
Name Text
Address Text
Salary Currency
Date of birth Date & Time
Email address Hyperlink
Photo OLE object
Married status Yes/ No
Post Lookup wizard
Comment Memo

Field Properties
It is used to set the field. where the limits data entry as
your required. Field properties are:
a) Field size: - It is used to entry the limit text data
according to define value. You entry the only 7
characters at name field.
b) Format: - It is used to display the small or capital
letter at required field.
- > Display text in capital letter
- < Display text in small letter

c) Caption: - It is used to change the field heading name.


d) Default value: - It is used to automatically display
data at required field.
e) Input Mask: - It is used to entry the limitation text or
number value, where you use some character for
limitation set.
Character Description
0 It accept without space
9 It accepts with space value
L It accepts alphabet which field property
uses for Telephone number, Registration
number field. You set Phone no. 000-
000000.
f) Validation Rule: - It also used to set the limitation entry
text or number data at particular field where you use some
operators such as In, Between, Like.
- In:- This operator is used to entry the text data such as
you entry Address field.
In(“Dharan’’, “Itahari’’)

Between: - This operator is used to entry the between number,


currency and date and time data. You set salary field.
Between 4000 and 9000
- Like: - This operator is used to entry the only with status
Alphabet. You entry with status R alphabet in Name
field.
Like R*

g) Validation Text: - It is used to display the error message


where you enter the wrong text.

 Import table :- It is used to insert the existing database


object in active database from any location.
Steps,
1) At first choose the External data
2) Choose the Import Access database option button
3) New table windows will appear
4) Choose the Import, query form…… database option
5) Click on browse button
6) Choose the database name from any location
7) After choose database, click on open button
8) Choose the table name of box
9) Finally click on ok button

 Link table :- It is used to insert the existing database


object and also set the link both table, where you
change one table record, automatically change next
table record.
Steps,
1) At first choose the External data
2) Choose the Import Access database option button
3) New table windows will appear
4) Choose the Link to the data source……database
option
5) Click on browse button
6) Choose the database name from any location
7) After choose database, click on open button
8) Choose the table name of box
9) Finally click on ok button
 Primary key :- It is a key where set field, primary key set
field can’t entry the duplicate data, which key also used
to set the relationship.
How to set the Primary key ?
Steps,
1) Right click the mouse with choose field where you
set primary key
2) Choose the primary key of list
Or,
- Choose the design field of ta.23ble
- Click on primary key button of option bar

 Relationship:- It is a important feature of database


programs which is used to set the relation more Then
one table. There are three types of relationship. They
are
a) One To One Relationship (OTOR)
b) One To Many Relationship(OTMR)
c) Many To Many Relationship(MTMR)

a) One to one relationship:- One record of table is


related with only one record of another table is
known as one to one relationship.

St_id (P) Course


Name Duration
Address Fee
Email St_id(P)
How to set the relationship?
Steps,
1) When you design above table
2) Click on Database tools menu
3) Click on Relationship button
4) Show table windows will appear
5) Choose the both table name and click Add button
6) After add both table, Click on ok button
7) Drag the one table related field over another
table related field
8) Edit relationship windows will appear
9) Click on create button
10) Finally open the table and Edit
b) One to many relationship :- One record of table is
related with more record of another table is known as
One to many relationship.

Cust_id(P) Item
Name Rate
Address Quantity
Contact No Cust_id

c) Many to many relationship :- One record of table is


related with multiple table record of another table is
known as Many To Many Relationship.

St_id (P) Course Course_id


Name Duration Installment 1st
Address Fee Installment 2nd
Email St_id Installmenst 3rd
Course_id(p)

Student

 Queries :-
Query is used to search, modify, update, delete and also
set the formula for calculation of table according to
choose query option.
Query design:
This option is used to create the query from selected table
field.
Steps,
1) At first choose the query object of database
windows
2) Click on Query design
3) Show table windows will appear
4) Choose the table name of box
5) After that , click on add button
6) After add table , click on close button
7) Drag the table fields in Grid box by mouse
8) Finally save and open

 Simple query wizard: - This wizard is used to create the


new query from selected field from table.
Steps,
1) At first choose the create object
2) Click on query wizard
3) Query wizard windows will appear
4) Choose the simple query wizard
5) Click on ok button
6) Choose the table name from drop down button
7) Choose the field of box
8) After choose field, click on [ > ] Add button
9) After add field, click on next button
10) Type the query name in textbox
11) Finally click on finish button

To create the sales table in Query


Steps,
1) At first create the table
Field name Data type
Cust_id AutoNumber
Name Text
Item Text
Rate Currency
Quantity Number
Amount Currency
Discount Currency
Net Amount Currency

2) After create table, click on create button


3) Choose the query design button
4) Show table windows will appear
5) Choose the table name of box
6) Click on Add button
7) After add, Click on close button
8) Drag the table fields in Grid box by dragging mouse
9) After that, Right click the mouse with choose
Amount field
10) Choose the Build or Zoom option of box
11) A windows will appear
12) Type the formula at pointed area
13) Click on ok button
14) Finally save and RUN
Formula
Amount:[Rate]*[Quantity]

Discount:[amount]*5/100

NetAmount:[Amount]-[discount]
Result sheet in Query
Field name Data type
Name Text
English Number
Math Number
Computer Number
Nepali Number
Science Number
Total Number
Result Text
Percentage Number
Division Text
Remarks Memo

Formula
Total:[English]+[math]+[computer]+[nepali]+[science]

Result:iif([English]>=32 and [math]>=32 and


[computer]>=32 and [nepali]>=32 and [science]>=32,
“Pass”, “Fail”)

Percentage:[total]/5

Division:iif([result]=”Fail”,
“fail”,iif([percentage]>=60,”First’’,iif([percentage]>=45,
“Second”, “Third”)))
Remarks:iif([division]=”First”,”Excellent”,iif([division]=”Seco
nd”,”Very good”,iif([division]=”Third”,”Good”, “Try again”)))

There are five types of query. They are:


1) Action Query
2) Select query
3) Crosstab query
4) Parameter query
5) SQL query

Action Query
1) There are four types of action query. They are

a) Delete query :- This query is used to delete the record


from table when you run.
Steps,
1) At first Click on create menu
2) Click on query design button
3) Show table windows will appear
4) Choose the table name of box
5) Click on Add button
6) Click on close button
7) Drag the table fields in grid box
8) Choose the delete query button
9) Finally save and RUN
b) Make table query :- This query is used to create the
new table according to choose field.
Steps
1) Same steps 1 to 7 of delete query
2) Choose the Make table query
3) Make table windows will appear
4) Type the table name in text box
5) Click on ok button
6) Finally save and RUN

c) Update query :- This query is used to automatically


update the selected table field value according to define
number of value.
Steps,
1) same steps 1 to 7 of delete query
2) Choose the Update query from list
3) Type the formula at Update To grid box
=[salary]+[salary]*5/100
4) Finally save and RUN
d) Append query: - This query is used to transfer the
record one table to another table.
Name Address Course fee Name Address Course fee
Suman Itahari Tally 1500
Hari Damak Fact 2500
Record entry table Blank table
Steps,
1) At first make above table
2) Click on create menu
3) Choose the query design
4) Show table windows will appear
5) Choose the table name of box (Entry table )
6) Click on Add button
7) Click on Close button
8) Drag the table fields in table design area
9) Choose the Append query button
10) Append windows will appear
11) Choose the blank table from drop down button
12) Click on ok button
13) Finally save and RUN

2)Select Query :- This query is used to create the new table


from selected field from table.
Steps, .
1) Click on create menu
2) Choose the query design button
3) Show table windows will appear
4) Choose the table name of box
5) Click on add button
6) Click on close button
7) Drag the table fields in grid box area
8) Click on query menu of menu bar
9) Choose the select query
10) Finally save and RUN

3)Cross tab query :- This query is used to display the only


three field name of table which display different format.
Steps,
1) Same steps 1 to 7 of delete query
2) Choose the Crosstab query of list
3) Choose the Display columnar view
4) Choose the display tabular view
5) Choose the calculation value with choose
minimum or maximum option
6) Finally save and RUN

4)Parameter query :- This query is used to display the query


where you entry some data.
Steps,
1) Same steps 1 to 7 of delete query
2) Choose the Parameter query of list
3) A windows will appear
4) Type the message at pointed area
5) Click on ok button
6) Finally save and RUN

5)SQL(Structure Query Language) Query:- This query is


used to create the new table, add field, delete field, open
table, delete table by using language.
Steps,
1) Click on create menu
2) Click on Query design button
3) Show table windows will appear
4) Click on close button
5) Click on View menu button
6) Click on SQL view of list
7) A windows will appear
8) Type the language at pointed area
9) Finally save and RUN
To create new table
Syntax,
Create table <tablename> (Field Datatype)
Eg:
Create table Student (Name text, Address Text, Fee
Currency)

Toc add the new record in table


Syntax,
Insert into <tablename> values(“Record”)
Eg:
Insert into student values(“Suman”, “Itahari”,
“1500”)

To add the field name


Syntax, Alter table <tablename> add column <field>
<datatype>
N
Eg: Alter table student add column Phn Text

To remove the field name


Syntax, Alter table <tablename> drop column <fieldname>
Eg: Alter table student drop column Phn

To delete the table


Syntax, Drop table <table name>
Eg: drop table student

To open table
Syntax,
Select* form <table name>
Eg:-
Select* form student
Form
Forms are used for the easy data entry in a table it's
alternative way of data entry on alternative design data can
be edited very easily in the form as well as we can set
different formula in a form to calculate data using "VBA"
(visual basic application) card it means we can use
programming logical of VBA in form of MS Access data base
or form is fronted part of data base.

 Form Design: - It is used to display the form in design


mode for modify.
Steps,
1) At first choose the create menu
2) Click on form design
3) Form design windows will appear
4) Design the form by using tools
5) Finally save and open

 Toolbox: - It is used to design a form by using toolbox.

[ ] Label:- This tool is used to type the text at form


area.

[ ] Text Box: - This tool is used to draw the text box


where you entry single line text.
[ ] Option group: - This tool is used to draw the
frame box in form area.

 [ ] Option tool: - This tool is used to draw the option


button in form area where you choose single option
from a group.

[ ] Check box: - It is used to choose the multiple


option from a group.

[ ] Combo box: - It is used to create the list data in


box where you put multiple data.
To create combo box
Steps,
1) At first choose the combo box
2) Drag the mouse in form area
3) A windows will appear
4) Choose the I will type ……option from a box
5) Click on next button
6) Type the list data in box
7) Click on next button
8) Click on next button
9) Finally click on finish button
[ ] List box: - It is used to create the list data in box
like combo box.

[ ] Command button:- It is used to draw the


command button in form for event where you click
mouse.

[ ] Image tool:- This tool is used to insert the photo


in form area from any location.
Steps,
1) At first choose the image tool from toolbox
2) Drag the mouse in form area
3) A windows will appear
4) Choose the photo from any location
5) Finally click on open button

[ ] Unbound object frame:- This tool is used to


insert the object in active page from selected programs.
Steps,
1) At first choose the unbound object frame tool
2) Drag the mouse in form area
3) A windows will appear
4) Choose the program name of box
5) Click on ok button
6) Insert the selected object at pointed area
7) Finally click on close button

[ ] Page break tool:- This tool is used to break the


page in multiple page where you drag mouse.
Steps,
1) At first design a form
2) Drag the mouse in form area where you break

[ ] line tool:- Draw the line shape in form area.

[ ] Rectangular tool:- Draw the rectangular shape in


form area.
 [ ] Tab control tool:- this tool is used to draw and put
the data inside the tab control box.
Steps,
1) At first choose the tab control tool from toolbox
2) Drag the mouse in form area.

To create the simple program for calculation


Private Sub add_Click()
txtresult = Val(txtfirst) + Val(txtlast)
End Sub

Private Sub clear_Click()


txtfirst = ""
txtlast = ""
txtresult = ""
End Sub d

a) Private Sub divide_Click()


txtresult = Val(txtfirst) / Val(txtlast)
End Sub

b) Private Sub mul_Click()


txtresult = Val(txtfirst) * Val(txtlast)
End Sub

c) Private Sub sub_Click()


txtresult = Val(txtfirst) - Val(txtlast)
End Sub

Access formula
Calculation of interest amount on the basic of no. of years
Sn Name principle no of years amount
Condition:-
1. 18 % interest rate less than 2 years
2. 10% interest rate less than 5 years
3. 8% interest rate for more than 5 years
Formula:
if me. no of years<=2 then
me. amount = me. principle *18/100
else
if me. no of year<= 5 then
me. amount =me. principle *10/100
else
me. amount= me. principle *8/100
end if
end if
Calculation of net amount
Item Total Dis Dis Net
Sn Qty Rate
Name amount Percent Amount amount
Formula:
- Me. Total amount= me. Qty * me. Rate

- Me. Dis amount = me. Total amount * me. Dis percent/100

- Me. Net amount = me. Total amount- me. Dis amount

Calculation of pension amount


Condition:-
1. If join date of employee is before 1986, they will get 40 %
pension of salary.
2. If join date of employee is before 1996, they will get 30%
pension of salary
3. Otherwise if join date is after1996, no pension they will
get.
Sn Employee join salary pension
name date amount
Auto/ Text Number Currency Currency
Number
Formula:-
if me. joindate<= 1986 then
Me. Pension amount = me. Salary*40/100
Else
If me. joindate<=1996 then
me. pension amount = me.salary*30/100
else
Me. Pension amount = me.salary*0/100
end if
end if

Billing System
Id, Items name, quantity, rate, amount, Dis_amount, tax,
net amount.
Condition
Tax
>=10000 *13/100
< 10000 *7.5/100
Discount Amount
>=25000 *15/100
>=10000 *10/100
< 10000 *5/100
Amount
Me. amount =me. Quantity × me. Rate
Discount
If me. Amount>=25000 then
Me. Dis amount=me. Amount*15/100
Else
If me. Amount>=10000 then
Me. Dis amount= me. Amount*10/100
else
Me. Dis amount=me. Amount*5/100
End if
End if
Tax
If me. Amount>=10000 then
Me. Tax=me.amount *13%
Else
Me. tax=me.amount *7.5%
End if
Net amount
Me.net amount = me. Amount + me.tax - me.dis amount

Total installment fee


sn, name, class, fee ,discount_percent, discount amount,
net amount, First install, second install, third install, total
installment fee, due fee.
Condition
Discount amount
Me.Discount amount = me.fee × me.discount_percent/100
Net amount
me.net_amount = me. fee – me.discount amount
Total inst…fee
Me. total inst fee = First install + second install + third install
Due fee
Me.Due fee = me.net amount- me.total installment fee.
SLC Result
Sn, Student name, English, math, economic, account, nepali,
total mark, result, percentage¸ division
Formula
Total mark:
Me.totalmark = me.english + me.math+ me.economic +
me.account + me.nepali

Result:
If me.english>=32 and me.math>=32 and me.economic>=32
and me.account>=32 and me.nepali>= 32 then
Me.result= "pass"
Else
Me.result= "fail"
End if

Percentage
me.percentage = me.total mark/ 5 (no of subject)

Division:
If me.total mark >=300 and me.result="pass" then
Me.division = "first"
Else
If me.total mark >=225 and me.result="pass" then
Me.division = "second"
else
If me.total mark >=175 and me.result="pass" then
Me.division = "Third"
Else
Me.division= "fail"
End if
End if
End if

Remarks
If Me.Divison = "First" Then
Me.Remarks = "Excellent"
Else
If Me.Divison = "Second" Then
Me.Remarks = "Very good"
Else
.
If Me.Divison = "third" Then
Me.Remarks = "Good"
Else
Me.Remarks = "Try again"
End If
End If
End If
Telephone bill
sn, Customer Name, telephone no, previous call, current
call, total call, total amount, vat, service charge, net amount
Total Call
Me.Total_call = Me.Current_call – Me.Previous_call
Total amount
Rs.250 is minimum charge of 200 free calls then (out of 200
call) per call Rs. 2
if me.total call<=200 then
me.total amount= 250
else
me.total amount =250+ (me.total call-200)*2
end if
Vat
13% vat of total amount
Me.Vat = Me.Total_amount * 13 / 100
Service charge
10% of total amount
Me.Service_charge= Me.Total_amount*10/ 100

Net Amount
Me.Net_Amount= me.Total_Amount+ me.vat +
me.service_Charge
Preparing salary sheet on the form
Steps:-
At first create table having following fields
Id, name, address, no of children, basic Salary, rank,
bonus, children allowance, medical allowance, tax, net
salary

Condition of rank
- if they have more than 10,000 basic salary they are officer
- if they have less than 10,000 basic salary they are non
officer
Condition of bonus
- if they are officer they will get 15% bonus of basic salary
- if they are non officer they will get 10% bonus of basic
salary
Condition of children allowance
- if they have more than 3 children they will get 14 %
children allowance of basic salary
- if they have more than 1 child they will get 10% children
allowance of basic salary
- if they have no child they wouldn't get children
allowance

Condition of medical allowance


- if they are officer they will receive 15% medical
allowance of basic salary
- if they are non officer they will receive 11% medical
allowance of basic salary
Condition of tax
- All should pay 13% tax of basic salary
Formula
Rank
If Me.Basic_salary >= 10000 Then
Me.Rank = "Officer"
Else
Me.Rank = "Non_Officer"
End If

Children allowance
If Me.No_of_children >= 3 Then
Me.Children_allowance = Me.Basic_salary * 14 / 100
Else
If Me.No_of_children >= 1 Then
Me.Children_allowance = Me.Basic_salary * 10 / 100
Else
Me.Children_allowance = "0"
End If
End If

Bonus
If Me.Rank = "Officer" Then
Me.Bonus = Me.Basic_salary * 15 / 100
Else
Me.Bonus = Me.Basic_salary * 10 / 100
End If

Medical allowance
If Me.Rank = "officer" Then
Me.Medial_allowance = Me.Basic_salary * 15 / 100
Else
Me.Medial_allowance = Me.Basic_salary * 11 / 100
End If

Tax
Me.Tax = Me.Basic_salary * 13 / 100

Net salary
Me.Net_salary = Me.Basic_salary + Me.Bonus +
Me.Children_allowance + Me.Medial_allowance - Me.Tax

End Sub

To save password in database


Steps:-
-at first create new database
-click on Database tools menu
-click on Encrypt with password
-Type the database password
-again type the same password
-click on ok
Note:- We have to active open exclusive from open

To close database
Steps:-
-open form to designing view
-choose the command button on tool box
-drag on required area of form
-type the name (eg. Close )
-right click on command box (name box)
-click on build event
-click on code builder
-click on ok
-and type the formula (command)

Report
Report is an important object of database, which is used
to view and print out particular data of table as a final
report if we need particular report at first we have to define
the data by using query then report
Use can be able to prepare report on ms- database by
two methods
Creation report in design view
Steps:-
1. click on report object
2. click on create menu
3. click on report
4. then click on view
5. click on design view
6. Then user define required tools for design

Macro:-
Macro is a set one of more actions that is each per form
a particular operation, such as opening a form or printing a
report macro can help you to automate command task for
example you can run a macro that prints a report.
Creating a macro
Steps:-
1. Choose macro object
2. Click on create menu
3. Click on macros

Module:-
This is an important object of database which is used to
create simple bills using programming code. Defining
constraint and other logic
eg. loops etc
steps:-
1. choose module object on database window
2. click on new
3. define constraints as user need
4. create form on design view
5. create connection between form and database
6. finally save then run the form

The End

You might also like