Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
249 views58 pages

Computer Term 1 Questions

The document discusses networking concepts including types of computer networks like PAN, LAN, MAN, and WAN. It describes the advantages of networking like cost effectiveness, communication, and data sharing. It explains key networking components such as network interface cards, cables, hubs, and switches that are required to set up a wired computer network and allow connected devices to communicate and exchange information.

Uploaded by

Annisha Swain
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)
249 views58 pages

Computer Term 1 Questions

The document discusses networking concepts including types of computer networks like PAN, LAN, MAN, and WAN. It describes the advantages of networking like cost effectiveness, communication, and data sharing. It explains key networking components such as network interface cards, cables, hubs, and switches that are required to set up a wired computer network and allow connected devices to communicate and exchange information.

Uploaded by

Annisha Swain
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/ 58

Tech 8

Buzz
1 Networking Concepts 2
Computer Network
Advantages of Networking
Types of Network — PAN, LAN, MAN, WAN
Network Components, Architecture, Topology and Security

2 Log on to Access  13
Types of Databases
Components of MS Access 2016
Starting Access 2016
Creating a Database
Views of a Table
Rules for Naming Fields
Data Types in Access
Adding Tables
Primary Key
Sorting a Table
Filtering Data
Searching in a Database
Closing Access 2016

3 Queries, Forms, and Reports in Access 38


Setting a Relationship between Tables
Query
Forms
Reports
1 Networking Concepts

You must have seen many people Let’s Learn About


using mobile phones. Mobile phones ♦♦ Computer Network
use wireless network for connectivity. ♦♦ Advantages of Networking
Networks help us to connect with ♦♦ Types of Network — PAN,
each other via computers, phones, and LAN, MAN, WAN
so on. There are different types of ♦♦ Network Components
networks, such as social, professional, ♦♦ Network Architecture
and electronic networks. In this chapter, ♦♦ Network Topology
you will learn about different types of ♦♦ Network Security
computer networks.

COMPUTER NETWORK
When a number of computers are connected in order to communicate or share information,
they form a network and this is defined as a computer network.
Internet is an example of a computer network. The purpose of computer networking is to
build communication between computers. This communication includes exchange of data and
information with the help of software applications installed in computer systems.
A computer network can be formed between two or more computers linked together in
a room or a building, a town, a city, and across the globe. A computer network can also
include peripheral devices, such as printer, scanner, and so on.
The computers or devices within a network that originate, route, and terminate the data are
called Nodes. The computers in a network can work independently and communicate with
each other too. Hosts, such as personal computers, mobile phones, servers, and networking
hardware are different types of nodes. The computers are interconnected through different
media, such as cables, telephone lines, radio waves, or infrared light beams. Every network
has a control centre, which allows the different nodes to communicate.
A network can be of two types:
2 Intranet: It refers to a network that is private to an organisation.
Internet: This network is open to all. Anyone can connect to it.
ADVANTAGES OF NETWORKING Info Box
There are many advantages of computer networking. An Intranet that is partially accessible
to authorised outside users is called
Some of them are given below.
Extranet. Here, the users are usually the
▶▶ Cost-effective: Besides software, hardware
trusted partners of the organisation, who
devices, such as printer, scanner, and modem have access to relevant information.
can be shared by all the computers on a
network. Thus, it saves a good amount of money by eliminating the need of buying
additional hardware and software for each computer in a network.
▶▶ Backup: Suppose a computer in a network faces some technical issues or hardware
failure, in this case, the work can be allocated to another computer in the same network.
Networking helps to look for lost data at one place.
▶▶ Communication Tool: It is a convenient mode of communication for any organisation
that has branches at different locations.
▶▶ Easy Access to Remote Database: One can instantly book railway or airline tickets
from anywhere. Hence, it saves time and effort.
▶▶ Accelerates Efficiency: It allows the upgradation of software and data from a single
point, thus enhancing the efficiency of a working system.
▶▶ Reduces the Need of Hard Copies: There are times when a copy of some document is
to be circulated among the members of an organisation. In such a scenario, a soft copy
of the document can be shared among the members over the network.
▶▶ Real Time Delivery: One can instantly share data and information across the globe.

TYPES OF NETWORKS
The computer network can be classified into various categories based on the coverage of
geographical areas. The various categories are discussed below.

Personal Area Network (PAN) PDA Mobile phone


(Personal Digital
A PAN allows communication among devices, Assistant)
such as personal computer, mobile phone,
digital camera, Personal Digital Assistant (PDA),
tablet, and so on. This kind of network covers
a small area of nearly ten metres. It is widely
used to transfer files, such as emails, images, Printer
audio, and video files between devices. PAN Wireless keyboard
can be easily set up between two devices. It is
built using USB cable (wired media) or Bluetooth User computer 3
(wireless media). Fig. 1.1  Personal Area Network
Local Area Network (LAN)
In LAN, two or more computers and peripheral
devices are connected within a room, building,
or a small campus. LAN covers an area of a
few kilometres and usually links the devices in
that area with wires or Wi-Fi. LAN is owned and
controlled by a single person or an organisation.
Therefore, it is private in nature. An office building
or a compound of an institution usually contains
a single LAN.
Fig. 1.2  Local Area Network
Metropolitan Area Network (MAN)
As the name suggests, MAN is a larger network than LAN, and connects computing devices,
which are located at geographically separate areas within the same city. MAN covers an area
of a few hundred kilometres in a city. MAN allows high-speed network sharing of resources
for a group of institutions, organisations, and branches of banks that function within the same
city, and so on.

Branch office 1

Warehouse 1 Factory 3

Warehouse 3
Central office
Factory 1

Factory 2
Warehouse 2
Branch office 2
4
Fig. 1.3  Metropolitan Area Network
Wide Area Network (WAN)
A WAN connects two or more computers located at distant locations. They are interconnected
through telecommunication or satellite signals. The use of WAN is majorly restricted to large
establishments and government agencies that are spread across a country, continent, or even
across the globe. It uses public telecommunication media to transfer data. ATMs, customer
services of national and multinational banks rely heavily on WAN to transfer data.

Satellite relay
TV network satellite uplink

Mobile phone Repeater tower


Mobile phone
Repeater tower

Fig. 1.4  Wide Area Network

NETWORK COMPONENTS
To set-up wired networking in a group of computers for data sharing, some additional
components, such as interface cards, and other equipment are required. The hardware
components that are required for establishing wired networking are given below.

Network Interface Card (NIC)


This card provides an interconnection between the network and the
computers (or nodes). Most computer motherboards usually have
an inbuilt Network Interface Card. It is used to connect a computer
to a network for enabling participation in network communication.
Fig. 1.5  Network Interface Card

Network Cable
Registered Jack 45 (RJ45) is an eight-wire network cable.
It is a connector which is commonly used to link the Network
Interface Card (NIC) with a hub. It is also used to connect and
5
transfer data and information between computers and switch. Fig. 1.6  Network cable
Hub
It is a network device which connects computers and computing devices to exchange data
between them. Each hub has some ports which determine the number of devices that can
be connected to it. For example, 6, 8, 12, 24, and so on. A hub can also be linked to NIC
through RJ45 cable. It primarily broadcasts the message, which increases data traffic over the
network. The information is received by the intended computer(s) and automatically rejected
by other computers over the network.

or
gef A fro
m
ssa uter se
on er
A
Me mp Computer A
esp put Computer A
Message for Co Response from
R om
C
Message for Response from
Computer A Computer A Computer A Computer A
Hub Hub
Me Computer B Re Computer B
Co ssag sp
mp e f Co ons
ute or mp e fr
rA ute om
rA

Computer C Computer C

Fig. 1.7  Message for Computer A sent to all Fig. 1.8  Response from Computer A through a Hub
connected devices through a Hub

Switch
The function of a switch is similar to or
gef A
r
ssa ute
that of a hub, but it is more intelligent Me mp m
Co ro Computer A
as compared to hub. It not only checks sef rA
on te
Message for sp pu
data packets as they arrive, but also Computer A Re om
C
determines the source and destination
Response from Switch Computer B
of each packet, before sharing them. Computer A
Switches are preferred over hubs due
to their efficiency. In addition, a switch
prevents data collision and reduces Computer C
network congestion. Fig. 1.9  Function of a Switch

Let’s Review
Answer in one word.
1. It refers to a network that is private to an organisation.
2. These are the devices connected over a network. 
6 3. It is an eight-wire network cable.
NETWORK ARCHITECTURE
Network architecture refers to the overall framework of an organisation’s computer
network. To establish network communication, it is important to have a detailed view of all the
accessible resources in it. Network architecture includes the following:
▶▶ Hardware components used for communication
▶▶ Topology
▶▶ Wired or wireless connection
▶▶ Protocols

There are two types of network architecture. They are listed below.

Peer-to-Peer
This type of network architecture is suitable for
a small environment, usually having up to 10
computers. Each computer connected over the
network has equal capability. These computers
must have specific rights to use or share the
available resources.
In Peer-to-Peer network, there is no dedicated
network administrator or central server. That
means all the computers can act as a server
as well as a client. This network is easy to set Fig. 1.10  Peer-to-Peer model
up and inexpensive.

Client-Server
It is a network in which several computers
called clients are connected to the main Client Client

computer called the server. A server in


a network is a computer that controls
all the connected computers, shared
devices, and other resources. Clients are Client
Client
computers that request services, such as Server

data retrieval and storage from the server.


In this network, if the server is turned
off, its resources on the network are not
available.
Client Client 7
Fig. 1.11  Client-server model
NETWORK TOPOLOGY
It is necessary that the computers that are to be connected must have access to the same
network sharing resources. Let us learn how a network is created. To understand this, first you
need to know about its topology.
Network topology refers to the schematic description of the various components of a
network, such as nodes, links, peripherals, and so on. It determines how data flows within a
network, irrespective of its physical structure. The most commonly known network topologies
are given below.

Point-to-Point (PTP) Topology


It is the simplest and the most conventional model of topology. In this topology, two nodes
are directly linked to each other. For example, a computer system is directly connected to
a printer. In this network, a dedicated link is formed
between two devices, that is, the sender and the receiver.
It is faster and more reliable, for there is a direct
connection between the devices. This network can only
be used for small areas, where computers are in close
proximity. Fig. 1.12  Point-to-Point topology

Bus Topology
In this type of topology, all the devices are connected to a linear cable called bus or trunk.
The bus acts as a backbone of this network. This topology is the simplest way to connect
multiple devices. It uses cables for connections. This network is easy and inexpensive to
implement for small networks. In this topology, one of the computers in the network acts as
a server, and provides data to all the clients. The advantage of this network is that if one
computer system breaks down, it does not affect the other systems over the network. However,
if the main cable fails, the entire network becomes unusable.

Bus

8
Fig. 1.13  Bus topology
Ring Topology
In this topology, all the nodes in a network are connected
to one another in the form of a ring. Each node is linked to
two other nodes, forming a single continuous pathway for
signals. In this network, data travels in a circular manner.
Ring shaped networks offer high bandwidth and can
span large distances. This topology is losing its popularity
because it offers only unidirectional data flow. Like Bus
topology, in Ring topology too, addition and removal of
systems could cause network disruption. Moreover, a single
break in the connection could disrupt the entire network. Fig. 1.14  Ring topology

Star Topology
In this type of structure, all the devices are connected to a central device which acts as a hub
or switch. Each device is linked to the central hub through a separate connection, and thus
it requires more connections. But, the benefit of using separate connections is that if there is
a connection failure, it would affect only the functioning of a single system on the network.
Unlike the Bus and Ring topologies, no disruption is
caused at the time of addition or removal of a system
from the network. Here, all the information or data first
goes to the central device, that is, a hub or switch, and
then to the respective systems. Therefore, a hub or switch
controls the network communication. Since all the data Hub
passes through the central dervice, it increases the threat
of a single point failure, which means that if the hub or
central device fails, then the entire network goes down.

Fig. 1.15  Star topology


Tree Topology
A Tree topology connects a Star network
to another Star network. Thus, Tree
topology is formed with a group of Star
networks connected to a bus. Therefore,
this topology is also called Star-Bus
topology. In this topology, if the main
cable that connects two Star topology
networks fails, then those two networks Fig. 1.16  Tree topology
would not be able to communicate with each other. However, the systems on individual Star
topology would still be able to communicate internally. In Tree topology, the expansion of 9
network is easy, however, the maintenance becomes difficult.
Mesh Topology
In this topology, each node has a point-to-point link with
each other. A single computer does not act as a server. In this
network, every node not only sends its own signals, but also
relays data from other nodes. This network is also known as
Meshnet. It provides data security and privacy since data is
transmitted through dedicated channels. It can also manage
Fig. 1.17  Mesh topology
high data traffic.

NETWORK SECURITY
It is important to secure data and resources from unauthorised
access and misuse. Therefore, it is advisable to protect your
data and secure the network. Info Box
The purpose of network security is to secure information Internet is controlled by 75
million servers.
of an individual or organisation, and also to protect the
computers on a network from any attack.
There are various methods to keep your network secure. Some of them are as follows:
▶▶ Access Control: It is used to block unauthorised users.
▶▶ Application Security: It always protects the applications stored in a computer system.
▶▶ Data Loss Prevention: There is always a fear that any member of the organisation may
send or upload sensitive information outside the network. This can be stopped by Data
Loss Prevention (DLP) technologies.
▶▶ Firewall: Firewall is a security system that protects a computer from unauthorised
access over a network. A firewall can be implemented using hardware or software, or a
combination of both. Firewall follows a set of rules that determines which data can enter
and leave a network.

Flashback

▶▶ A computer network is formed when a number of computers are connected in order to


communicate or share information.
▶▶ The computer network can be classified into various categories, such as PAN, LAN, MAN, and WAN.
▶▶ Network Interface Card provides the interconnection between the network and the computer.
This card lets the computer communicate over the network.
▶▶ Hub is a network device which connects several devices and makes them eligible to send and
10
receive data with each other.
▶▶ Network architecture refers to the overall framework of an organisation’s computer network.
▶▶ A server in a network is a computer that has centralised control over all the connected computers,
shared devices, and other resources.

Exercises
A. Tick (✓) the correct answers.
1. It is not an advantage of networking.
a. Cost-effective b. Real time delivery c. Very expensive
2. Which of the following computer networks is built using USB cable?
a. PAN b. WAN c. MAN
3. Which network among the following is connected to a central device that acts as a hub?
a. Star topology b. Ring topology c. Mesh topology
4. This network topology is formed with a group of star networks.
a. Mesh topology b. Tree topology c. Ring topology
5 It is a network security system.
a. Hub b. Switch c. Firewall

B. Fill in the blanks.


1. refers to the overall framework of an organisation's computer network.
2. Most computer motherboards usually have an inbuilt
3. spans from several blocks of buildings to the entire city.
4. In topology, each device is linked to the central hub through a
separate connection.
5. In the client–server network model, there is a central computer called a

C. Write T for True and F for False.


1. Bluetooth is used to form a wireless Personal Area Network. 
2. Nodes and hub have the same function. 
3. Each hub has ports which determine the number of devices that can be
connected to it.
4. Mesh topology is quite poor at managing high data traffic. 
5. A computer system directly connected to a printer is an example of
11
Point-to-Point topology. 
D. Answer the following questions.
1. What do you understand by computer networking? Name the different types of computer
networks.
2. Differentiate between PAN and MAN.
3. Explain in brief the client-server architecture.
4. Define the term topology. Briefly explain any two types of network topologies.
5. Explain the utility of network security. Name any two methods to keep your network secure.

Ava’s Activity Zone

A. Expand the following:


1. LAN:
2. NIC:
3. WAN:
4. PTP:
5. MAN:

Group Discussion

Divide the class into three groups, each group will discuss the following topics:
▶▶ Computer Networking has revolutionised the communication technology.
▶▶ A Switch is smarter than a Hub.
▶▶ Topology is the blueprint of computer networking.

Teacher’s Notes

▶▶  iscuss the concept of networking with the help of real-life examples.


D
▶▶ Describe the difference between wired and wireless networking technologies.
12 ▶▶ Tell the students why different types of networks are needed.
2 Log on to Access
Let’s Learn About
Our brain stores a lot of data and ♦♦ Types of Databases
information, which helps us to perform ♦♦ Elements of DBMS
routine tasks easily. For example, ♦♦ Advantages of DBMS
your brain knows where you keep ♦♦ Access and its Components
your books, clothes, and so on. So, ♦♦ Starting MS Access 2016
whenever you want to use them again, ♦♦ Creating a Database
you will simply search and find them ♦♦ Views of a Table
at a specific place. Therefore, you ♦♦ Data Types in Access
can say that our brain is a type of ♦♦ Adding Tables
database. A database is formed with ♦♦ Primary Key
the collection of data and information. ♦♦ Editing Tables in Access
In this chapter, you will learn about ♦♦ Sorting, Filtering, and Searching
in a database
database and MS Access 2016.
♦♦ Closing Access 2016
♦♦ Opening a Saved Database

A database is maintained everywhere, from grocery stores to malls, schools to universities,


small companies to big companies, and so on.
Some other examples of database management are:
▶▶ Maintaining details of employees in a company
▶▶ Keeping record of students in a school
▶▶ Organising the list and details of products in a store
▶▶ Maintaining the details of account holders in a bank
▶▶ Maintaining information as links for websites
Maintaining a huge data manually is not convenient since it needs to be uploaded frequently.
Therefore, it is recommended to organise the data using a computer database, that is,
Database Management System (DBMS). A DBMS is a software to create, store, organise,
manipulate, and retrieve data whenever required. DBMS saves time and energy that helps
the users easily and quickly retrieve the data. Moreover, the chances of errors creeping into a
database get reduced to a certain extent with the use of DBMS. So, DBMS allows the users to
13
manage and retrieve the data quickly and efficiently.
TYPES OF DATABASES
The two most common types of databases are:

Flat File Database


This type of database refers to the data files that contain small amounts of data with fixed
number of fields. In a Flat File Database, the data is stored in an unstructured file called a
‘flat file’. It is called so because the tables and records stored in it have no relation with other
tables. Example: Microsoft Excel.

Relational Database
This type of database stores the data and information in multiple tables with rows and
columns. A Relational Database establishes a relationship between different database
tables. Examples: Microsoft Access, MySQL (Structured Query Language), and Oracle.

ELEMENTS OF A DBMS
The elements of MS Access database are as follows:
▶ Table: A table is the basic unit of a database. It is used to store the data in rows and
columns. It is the primary location where data gets stored. A table is formed with three
basic elements, which are described below:
◆ Field: A column in a table is called a field. A field contains a specific category of
data. For example, a field named ‘First Name’ will only be used to store the first
name of the students (Table 2.1).
◆◆ Record: A row in a table is known as a record. It is formed with two or more fields,
and contains the data and information about a single person or an entity in a
database. For example, a record for Roll No. 102 is highlighted in Table 2.1.
◆◆ Data: A collection of facts and information is known as data.

Fields

Table 2.1  Elements of a Table

Roll No. First Name Last Name Class House


101 Raman Jain VIII Red
102 Nizam Ali VIII Blue
Records Data
103 Gurpreet Kaur VIII Yellow
14
104 Kiran Rao VIII Green
▶▶  uery: This database object is used to retrieve data or information from the data table(s)
Q
based on certain conditions. Queries are also used to manipulate data.
▶▶  orm: A form is an object that is used to enter and display data in the tables. It facilitates
F
the users to input data and then pass it on to the associated table and query.
▶▶  eport: This object is used to display or get an output of the data in a desired format for
R
printing.

ADVANTAGES OF DBMS
Some benefits of using DBMS are mentioned below:
▶▶ Eliminates Duplication of Data: It reduces data redundancy or duplication.
For example: A company may have multiple files storing the details of its employees,
such as personal details, official details, and so on. A DBMS integrates multiple files into a
single database file. Hence, the data is centralised and eliminates the duplication of data.
▶▶ User Friendly: DBMS manages data, saves time and energy since it lets a user to
access, search, and retrieve information quickly and effectively.
▶▶ Data Sharing: DBMS facilitates the users by allowing them to share and extract data
from the centralised database as per their requirements.
▶▶ Data Security: In a DBMS, the complete control over the database is in the hands of the
database administrator. It ensures that the data is accessible only to the authorised users.
▶▶ Data Integrity: A DBMS ensures that the data stored in it follows certain standards of
an organisation. For example: A database of a company contains information about
the salaries of its employees. If the minimum and maximum salary is set at ` 5,000
and ` 25,000, respectively, then you can set a criterion to make sure that the database
accepts numeric values only in the range of 5,000 to 25,000.

INTRODUCTION TO MS ACCESS 2016


Microsoft Access is a Relational Database Management System (RDBMS). MS Access is an
integral part of Microsoft Office Suite. MS Access can store and organise a large amount of
data in the form of tables. Since it is a relational database, it can recognise the relationship
between the data tables to retrieve data. The relationship between the tables can be
established using common fields.
Examples of RDBMS are:
▶▶ MySQL
▶▶ Oracle 15
▶▶ Sybase
COMPONENTS OF MS ACCESS 2016
The components of MS Access 2016 are explained below:

Title Bar
It is present at the top of the window and displays the name of the active database. At the
extreme right side of the Title bar, the Help, Minimize, Restore Down/Maximize, and
Close buttons are present.

Quick Access Toolbar


The Quick Access Toolbar is located to the left side of the Title bar. By default, this toolbar
displays three command buttons — Save, Undo, and Redo. You can even customise this
toolbar as per your requirement.

Quick Access Toolbar Title bar Minimize Restore Down/


Help Maximize

Close
File tab

Ribbon

Tab Bar

Navigation
Work area
Pane

Navigation
buttons

Status bar
Fig. 2.1  Components of MS Access 2016 window

Ribbon
It is present right below the Title bar. The top area of the Ribbon contains various tabs.
Each tab has several groups of associated commands.

File Tab
It is located at the top left corner of the Ribbon. It contains commands, like Info, New,
16 Open, Save, Save As, Print, Close, Account, and Options. These commands help the
user in managing Access and its database.
Navigation Pane
This pane is located on the left side of the Access window. It displays the objects of the current
database. These objects could be Tables, Queries, Forms, and Reports.

Navigation Buttons
Navigation buttons are present at the bottom of the work area. These buttons let the users
navigate through the records. The current record number is displayed in the box between the
navigation buttons.

Tab Bar
In MS Access, database objects open in the tabbed form on the Tab bar. To view the contents
of an object, click on its corresponding tab. The content is displayed in the work area. Clicking
on the cross button present on the extreme right end of the Tab bar closes the current tab.

Status Bar
This bar is present at the bottom of the Access window.
Apart from displaying the information about the current Info Box
database, it also displays the name of the active view Database Schema is the overall
on the left side. On its right side, it contains buttons to design structure or blueprint of
switch the view of the active database object. the database. It describes how
the data is organised, and the
relations among them.
STARTING MS ACCESS 2016
To start MS Access 2016, follow these steps:
1. Click on Start > Access 2016.
2. The Start Screen of Access 2016 appears (Fig. 2.2).
Template options

17
Fig. 2.2  Start Screen of MS Access 2016
CREATING A DATABASE
When MS Access opens (Fig. 2.2), you can see various options on the right pane. These
options can be used to create a new database. MS Access offers two options to create a new
database, which are as follows:
▶▶ Using Templates (This option is active only when your computer is connected to the Internet.)
▶▶ Creating a Blank desktop database

Creating a Database Using a Template


MS Access templates have predefined tables, queries, forms and reports, which help you to
easily create a database. To create a database using a template, follow these steps:
1. On the right pane of the
Start Screen, click on a link
in the Suggested searches
section, say Personal. It
displays the list of available
relevant templates.
2. Select a template say,
Personal contact manager
(Fig. 2.3). The Personal
contact manager task pane
appears, and displays the
description of the template
(Fig. 2.4). Fig. 2.3  Gallery of Personal templates

3. In the File Name box, enter a suitable name for the database.
4. By default, Access defines a location for the database, which is displayed right below
the File Name box. You can also browse and select another location by clicking on
the Folder icon.
5. Click on the Create
button. Access
creates the requested
database and
displays the table
in Form View. It
contains the field
names that are
relevant to the
18 Personal Contacts
database (Fig. 2.5). Fig. 2.4  Personal contact manager task pane
Fig. 2.5  Personal Contacts database

Note: In the SECURITY WARNING message, click on the Enable Content button only when
you are sure that the source of the template is secure.
6. You can add more fields to the current template database by following these steps:
a. On the Home tab, click on the View button in the Views group.
b. Select the Datasheet View option in the
drop-down menu.
OR
Click on the Datasheet View button on the
Status bar.
7. A new contextual tab called Form Tools appears on
the Ribbon (Fig. 2.6).
8. On the Datasheet tab, click on the Add Existing
Fields button in the Tools group. The Field List task
pane (Fig. 2.7) appears on the right side of the screen.
9. Select the required fields from the list. Then, drag the
selected field to the table and drop it at the desired
position when the red insertion line appears.

19
Fig. 2.6  Selecting Add Existing Fields Fig. 2.7  Field List task pane
Creating a Blank Database
In case you want to create your own customised database, it is recommended to use the
Blank desktop database option. To create a blank database, follow these steps:
1. On the right pane of the
Start Screen, click on the
Blank desktop database
option (Fig. 2.2).
2. The Blank desktop database
task pane appears (Fig. 2.8).
Replace the default database
name with a suitable name
in the File Name box. Fig. 2.8  Blank desktop database task pane
3. Access defines a default location
for the database, which is shown right below the File Name box. You can select
another location by clicking on the Folder icon.
4. Click on the Create button.
5. A new database with a blank table named Table1 appears in the Datasheet View
(Fig. 2.9). Here, you can add the desired Field names and data.
Notice that the first field in the table is named as ID, by default.

Fig. 2.9  Blank Table1 in Datasheet View

Ava’s Cool Tip


20 To view the objects added in a database, simply click on the drop-down arrow of
All Access Objects in the Navigation Pane.
VIEWS OF A TABLE
MS Access lets you work on a table in two views — Datasheet View and Design View.
Let us learn how to work in each view, one-by-one. Here, we are creating a database using
Blank desktop database option.

Datasheet View
By default, a blank database opens in the Datasheet View. This view is used to enter data
in a table. In this view, the table is displayed as a grid, which form rows and columns. Each
row is regarded as a record and each column is regarded as a field. The field names are
treated as column headers. The Datasheet View appears as shown in figure 2.9.
Note: Double-clicking on the table name in the Navigation pane opens the table in the
Datasheet View.

Design View
In this view, you can enter the field names, specify their data types, and add the relevant
description. This Design View is mainly divided into two sections (Fig. 2.10):

Field Definition Grid Field Properties Pane


Here, you can specify the field names and Here, you can set properties for each field
data types for the table. You can also add a defined in the table. The options in this pane
description for each field (it is optional). change as per the selected field. It has two
tabs — General and Lookup.

Ava’s Cool Tip


To switch between the views, follow
any of these processes.
Field
Definition ▶ Click on the Home tab >
Grid
Views group > View button.
Select the desired option from
the drop-down menu.
Field Properties Pane
▶ Click on the Datasheet View
or Design View
buttons present on the right
side of the Status bar.
21
Fig. 2.10  A Table in Design View
RULES FOR NAMING FIELDS
While naming fields, you must follow some norms, which are:

A Field Name can A Field Name cannot

be upto 64 characters long,


begin with a blank space.
including spaces.

include letters, numbers, and some have a fullstop (.), an


special characters. The underscore exclamation mark (!), grave
( _ ) sign is used quite often. accent (`), or brackets ( [ ] ).

be in uppercase, lowercase, or
combination of both.

DATA TYPES IN ACCESS


In a table, there are multiple fields. Each field contains different types of data. Access allows
you to set the data type for each field. A field’s data type lets you control the type of data that
can be entered in a field. The table given below contains the various data types available in
Access 2016.
Table 2.2  Data Types in Access 2016

Data Type Explanation


Short Text It stores text value, alphanumeric value (for example: addresses), and
numbers that are not used to perform any calculations (for example:
phone numbers, pin code, age, and so on). Hence, numbers are treated
as text values. The fields with this data type can store upto 255 characters.
Long Text It stores long text, such as notes and descriptions. The fields with this
data type can store up to 65,535 characters.
Number It stores numeric data that can be used to perform calculations. The fields
with this data type can store integer and decimal values as well.
Date/Time It stores date and time values. You can display the date and time in
different formats.

22 Currency This data type lets you specify various currencies. You can also display the
currencies in different formats.
AutoNumber It stores an integer that increments automatically whenever you add a
new record to a table. You cannot change the value in the field that
has AutoNumber data type. Moreover, when you delete a record, its
AutoNumber value cannot be reused. By default, the ID field in a new
table has AutoNumber data type.
Note: MS Access allows only one AutoNumber field per table. It is
basically used to uniquely identify the records.
Yes/No It is used in the fields where there can be only one of two values,
Yes or No. You can adjust the format setting to display as True/False
or On/Off.
OLE Object It stores graphics or objects created in other applications, such as
MS Word, MS Excel or MS PowerPoint.
Hyperlink It stores links to a file/folder on your hard disk, over a network location
or a website.
Attachment It attaches an image file, spreadsheet, word document, or any other
supported files to a record. It is quite similar to the way a file is attached
to an email.
Calculated This data type is used to store the results of calculations that include values
from other fields in the same table.
Lookup This creates a lookup field, which displays a list of values from which you
Wizard can choose. The values could be taken from another table or query, or
you can type as well.

Let’s Review
Look at the given table and answer the following questions.
1. How many records are there in the table?
2. Which element of the table is ‘Name’?
3. What is the data type of the following?
a. Roll No :
b. Name :
c. Total Marks :
d. Date of Birth :
4. In which view is the table displayed?
23
ADDING TABLES IN DESIGN VIEW
By default, a blank database displays a single table. MS Access allows you to add new tables
to an existing database. Let us learn how to add tables in Design View.
On the Create tab, click on the Table Design option in the Tables group (Fig. 2.11). Access
creates a new table and opens it in the Design View.

Fig. 2.11  Selecting Table Design

Once the table is added in a database, you can assign field names and set the data type for
each field.

Adding Fields in Design View


To add a field in a table, follow these steps:
1. Type a name in the Field Name column, say, Roll No (Fig. 2.12).
2. Press the down arrow key to move the cursor to the next field name cell.
3. Enter a new field name in it.
Similarly, add as many field names as required.

Setting the Data Type


The steps to set the data type for a field are as follows:
1. By default, MS Access assigns the Short Text data type to each field.
2. In the Data Type column, click on the down arrow next to the field whose data type is
to be changed.
3. Select the desired data type in the drop-down list (Fig. 2.12).

24 4. In the Description column, add a relevant description for each field, if required. The
description is displayed in the Status bar when the field is selected.
Fields added
to the table
Data Type list

Fig. 2.12  Creating Table in Design View

Setting Field Properties


Every field in a table has its own set of properties as per the selected data type. The
properties of a field define its characteristics. You can set the field properties to control the
appearance of data on screen. Some of the field properties are described in Table 2.3.
Table 2.3  Field Properties

Field Property Explanation


Field Size It specifies the maximum size for the data stored in the Text or Number
fields. The data types that have this property are: Short Text, Number,
and AutoNumber.
Format This property specifies how the data in a field will be displayed. The
options in the Format property change as per the data type. For
example, the format properties for Date and Time, Number, and
Logical data (Yes/No) are different.
Input Mask It defines the pattern (kind of a mask) for the data that is to be entered in
the field. For example: the input mask for a password could be ********.
Caption It is used as an alternative name for the field. It adds a label or heading
for a field and is displayed only in the Datasheet View. It can contain
upto 2048 characters.
Default Value This property is used to specify a value that is automatically entered in
the field when a new record is added. You can either accept the default 25
value or replace it with a new value.
Validation Rule This is an expression that limits the values that can be entered in the field.
For example, you set the validation rule >= 50 for a field, which means
the field can contain a value that is greater than or equal to 50. If you
enter a value less than 50, then an error message will be displayed.
Validation Text It customises the error message that appears when you enter a value
that is prohibited by the validation rule.
Required It is used to specify if a value is required in a field. The default value
of this property is No, which means a field can be left blank. You can
select Yes, if you want to ensure that the field should receive a value
during data entry.

To set a field’s properties in design view, follow these steps:


1. In the Field Definition grid, click on the field name whose properties you wish to set.
2. Notice that, in the Field Properties pane, the General tab is selected by default.
3. Now, set the properties for the desired fields as per the requirement.

Saving a Table
Keyboard Shortcuts
Once all the field names and their properties
Press Ctrl + W key combination to save the
are defined, and data type is set for each
changes and close the Table in MS Access.
field, save the table. To save the table,
follow these steps:
1. Click on the Save button on the Quick Access Toolbar.
OR
Click on the File tab > Save option.
2. In the Save As dialog box, assign a suitable
table name. Click on OK (Fig. 2.13).
Now, switch to Datasheet View to enter data in
the table.
Fig. 2.13  Save As dialog box

ADDING TABLES IN DATASHEET VIEW


When you create a database using the Blank desktop
database option, a new database with a blank table
named Table1 appears in the Datasheet View. Let us
add a new table in the Datasheet View.
On the Create tab, click on the Table option in
26 the Tables group (Fig. 2.14). Access creates a new
Fig. 2.14  Adding a table
blank table and opens it in the Datasheet View.
Adding a Field in Datasheet View
To add a field in a table, follow these steps:
1. By default, the first field in a
table in the Datasheet View
is ID (Fig. 2.15). The default
data type for this field is
AutoNumber. That means
whenever you add a new
record to a table, Access will
automatically increment its
value. Moreover, you cannot
change the value in this field.
2. Click on the drop-down
arrow next to the
Fig. 2.15  Adding fields
Click to Add header.
3. Select the required data type.
Here, we have selected the
Short Text data type (Fig 2.15).
Notice that, the Click to Add header is Ava’s Cool Tip
replaced by Field1 heading, and Click to Add In the Datasheet View, you can reset
label automatically shifts to the next column. the Data Type for a field by clicking on
its Field header, and then selecting the
Note: MS Access automatically assigns a data
required data type from the Data Type
type to the field after examining the data entered drop-down list in the Formatting group
in it. That means you do not have to choose the on the Fields tab.
data type separately.

Renaming a Field
Double-click on the label Field1 (Fig. 2.16)
and rename it to First Name. Similarly,
add two more fields and rename them to
Last Name and Class. Fig. 2.16  Renaming a field

Entering Records in Datasheet View


After defining the field names and data types, let us enter the records for the table.
1. Click on the empty field below the First Name field header (Fig. 2.17). Enter Aashish,
and then press Tab key and type Mehta in the field under the Last Name header. 27
Likewise, enter VIII in the field under the Class header.
2. Press either Tab or Enter key. The cursor
jumps to the ID field. Again, press the Info Box
Tab key. Enter the second record as As you enter the values in a table, a
shown in figure 2.17. Similarly, enter the pencil icon appears on the Row selector,
third and fourth records. Observe that which indicates that the record is not
Access automatically increments the value saved yet. And a new empty record is
indicated by an asterisk (*) sign.
in the ID field.
3. When you work in the Datasheet View,
two additional tabs named Fields and Table appear on the Ribbon under the
Table Tools contextual tab (Fig. 2.17).
4. Click on the Save button on the Quick Access Toolbar to save the table.

Fig. 2.17  Adding records in a table in Datasheet View

PRIMARY KEY
In every database, there is a ‘primary key’, which
contains the value(s) that helps the users to uniquely Info Box
identify each record in a table. The primary key Once a table is added in a database,
field in a table cannot contain the duplicate value. it is displayed in the Navigation pane.
By right-clicking on the table icon, you
Remember, the field set as a primary key cannot be
can perform various actions, such as
left blank while entering data.
renaming or deleting it.
Let us understand the concept of primary key with
the help of the following example:
Suppose, you have created a table containing the data of all the students of your class.
You found that more than one student shares the same name. Therefore, you cannot set
Name field as the primary key. In such a case, you can set Roll No or Enrollment No as
28 the primary key, since there are no chances of duplicate values in these fields. Thus, each
record will be identified uniquely.
Setting the Primary Key Method 1 Step 2 Method 1 Step 1

To set a primary key, you have


to open the database in the
Design View. The two methods
to set a primary key are:
Method 1:
1. Select the field that you wish
Method 2
to set as the primary key.
Step 2
2. On the Design tab, click on
the Primary Key button in
the Tools group (Fig. 2.18). Method 2
Step 1
Method 2:
Fig. 2.18  Setting Primary Key
1. Right-click on the field to
be set as primary key.
2. Select the Primary Key option in the context menu (Fig. 2.18).
The selected field will be set as the Primary Key. A tiny key icon will appear in the selector area.

Removing the Primary Key


To remove the Primary Key, follow these steps:
1. Select the field that is set as Primary Key. Info Box
2. On the Design tab, click on the Primary Key In Access, you cannot delete the
button in the Tools group. Primary Key in a table. However,
if you wish to delete it, then you
The Primary Key button functions as a toggle key. It can
first have to remove the Primary
turn on as well as turn off the corresponding effect. Key setting from the field.

EDITING TABLES IN ACCESS


Once a table is created, you may need to make certain changes in the database, such as
modifying data, adding, deleting, moving, or hiding fields in a table. To do so, open the table
in which you wish to do the editing. Ensure that the table is opened in the Datasheet View.

Editing Data
To edit data in a field, follow these steps:
1. First of all create a database as shown in figure 2.19 and save it with the name
Teachers’ Info. For partial editing, click on the cell in which you wish to modify the
content. Bring the cursor to the point where you want to edit. For replacing data,
double-click on the cell. The cell content gets highlighted. Then start typing the new
29
content, which will replace the existing one.
Pencil icon

Fig. 2.19  Editing cell content in a database

2. Once the editing is done, click anywhere outside the current cell.
3. While editing the cell content, a Pencil icon appears in the record selector, which
indicates the Edit mode is active.

Adding or Deleting a Field


To add a field, follow these steps:
1. Click on the column header to the right side of which you wish to insert a new field.
2. Go to the Fields tab and select the required data type for the new field in the
Add & Delete group (Fig. 2.20). Here, we have added a new field right to the
Last Name field, and selected the Number data type.
3. A new field named Field1 is added in the table (Fig. 2.20).

Fig. 2.20  Adding a new field

Ava’s Cool Tip


You can also add a new field in a table by following the given method:
1. Right-click on the column header to the left of which you wish to insert a new field.
30 2. Select the Insert Field option in the context menu.
To delete a field, select any cell in the field to be deleted.
1. On the Fields tab, click on the Delete button in the Add & Delete group.
2. Access prompts a confirmation message box
(Fig. 2.21). Click on Yes to confirm. It will
permanently delete the selected field(s) and
all the data in the field(s). Remember that
you cannot undo this action. Ava’s Cool Tip
To delete a field in a table,
right-click on the column header
of the field to be deleted. Select
the Delete Field option in the
context menu.

Fig. 2.21  Deletion confirmation

Moving a Field
To move a field, follow these steps:
1. Click on the column header of the field that you wish to move to a new location.
(Here, we have selected the ‘Mobile No’ field in figure 2.22.)
2. Click and drag the selected field to
the desired position. Notice, while
dragging a thick line appears
indicating the position where the
field can be placed (Fig. 2.22).
Release the mouse button at the
Fig. 2.22  Field moved to a new location
desired position.

SORTING A TABLE
You can sort the data in a table on the basis of values stored in a field either in ascending or
descending order.
To sort data, follow these steps:
1. Open the table in which you wish to
sort the data in the Datasheet View.
2. Click on the drop-down button next
to the field header, say, Grade.
A drop-down menu displaying
sorting and filtering options appears 31
(Fig. 2.23). Fig. 2.23  Sorting data
3. Select either Sort A to Z or Sort Z to A option (Fig. 2.23).
4. Observe the data in the selected field, that is, Grade, is sorted. Moreover, the rest of
the data in the table is also sorted accordingly (Fig. 2.24).

Ava’s Cool Tip


You can also sort data using the
Ascending and Descending buttons
present in the Sort & Filter group on
the Home tab.
Fig. 2.24  Data sorted in ascending order

To clear the sorting, click on the


Remove Sort button in the Sort & Filter
group on the Home tab (Fig. 2.25).

FILTERING DATA Fig. 2.25  Selecting the Remove Sort

Access lets you display the specific records in a database using the Filter option.
To filter data, follow these steps:
1. Click on the drop-down button next to the field header on the basis of which you wish
to filter the table. For example, Grade. A drop-down menu appears (Fig. 2.26).
2. Clear the Select All checkbox. (By default, Access selects all the checkboxes.) Notice,
all the checkboxes are cleared at once.
3. Now, select the checkbox of the grade that you wish to display in the database. You
can select as many as you want. Here, we have selected A (Fig. 2.26).
4. Click on OK. Access now displays only those record(s) which contain the
corresponding value(s), and hides the rest (Fig. 2.26).

32
Fig. 2.26  Defining filter criteria
The filtered data appears (Fig. 2.27).

Ava’s Cool Tip


You can also filter data using the
Filter button available in the Sort &
Filter group on the Home tab.

Fig. 2.27  Filtered data

To remove the filter, click on the Toggle Filter button in the Sort & Filter group on the
Home tab. Access will display the original database.

SEARCHING IN A DATABASE
While working in a database, you often search for some data. It is quite challenging to search
for a particular data in a huge database. In such a situation, you can search data quickly
using the Search box, which is available at the bottom of the Access screen. To search data,
follow these steps:
1. In the Search box, enter part or the whole word, phrase, number, or date that you
want to look for in the database.
Press Enter. Notice that Access Matched value

highlights the matching entry


in the database as shown in
figure 2.28.
2. If your database has multiple
matching entries, and you want
to find the next one, then press
the Enter key again. Likewise,
you can search for all the Fig. 2.28  Searching in database
matching records in a database.

CLOSING ACCESS 2016


To close the current database, follow these steps:
Click on the File tab > Close option (Fig. 2.29).
To close Access application, follow these steps:
Click on the Close button present on the top right corner
of the Access window. 33
Note: An Access file is saved with the file extension .accdb. Fig. 2.29  Closing Access
OPENING A SAVED DATABASE
To open a saved database, follow these steps:
1. Click on the File tab > Open option (Fig. 2.30). Keyboard Shortcuts
2. On the Open screen, choose the required Press Alt + F4 key combination to
database from the Recent list, (if displayed) exit the MS Access application.
otherwise click on the Browse option (Fig. 2.30).
3. The Open dialog box appears. Locate and select the required database. Click on the
Open button. The selected database opens.

Fig. 2.30  Opening a saved Database

Flashback

▶▶ Database Management System (DBMS) is a software to create, store, organise, manipulate, and
retrieve data whenever required.
▶▶ The two most common types of databases are Flat File database and Relational database.
▶▶ Tables, Queries, Forms, and Reports are the elements of MS Access database.
▶▶ Queries are used to retrieve data or information from the data table(s) based on certain conditions.
▶▶ A form is an object that is used to enter and display data in the tables.
▶▶ Reports are used to display or get an output of the data in a desired format for printing.
▶▶ MS Access lets you work on a table in two views — Datasheet View and Design View.
▶▶ Data type lets you control what type of data can be entered in a field. Some of the data types
are — Short Text, Long Text, Number, Date/Time, Currency, AutoNumber, Yes/No, and so on.
▶▶ Primary key contains the value(s) that helps the users to uniquely identify each record in a table.
34 The Primary key field in a table cannot contain duplicate values.
Exercises
A. Tick (✓) the correct answers.
1. Which of the following is not a type of database?
a. Relational database b. Flat file database c. Folder database
2. RDBMS stands for
a. Random Database Management System.
b. Rational Database Management Server.
c. Relational Database Management System.
3. This data type stores a link to a website.
a. Hyperlink b. OLE c. AutoNumber
4. This component of MS Access window displays the objects of the current database.
a. Status bar b. Navigation pane c. Work area
5. Which of the following icons indicates that the particular field is set as the Primary key?
a. Pencil icon b. Lock icon c. Key icon

B. Fill in the blanks.


1. A establishes a relationship between different database tables.
2. The ensures that each record in a database can uniquely be identified.
3. Arranging data in ascending or descending order in a table is called
4. MS Excel is an example of database.

C. Write T for True and F for False.


1. Data can be entered in Datasheet View as well as in Design View.
2. Validation Rule field property limits the values that can be entered in the field.
3. By default, the field set as Primary Key has AutoNumber data type.
4. A table can have multiple Primary Keys.
5. A pencil icon indicates the edit mode in Access.

D. Answer the following questions.


1. Define the term Database. List any two benefits of Database Management System.
2. Differentiate between Flat File database and Relational database.
3. Explain the elements of a table in MS Access database.
4. What do you understand by data types? Explain the AutoNumber data type. 35
5. Define Primary Key. How does a Primary Key help in organising a database?
Ava’s Activity Zone

Lab Activity

Create a table in MS Access 2016, displaying the details of the residents of a society.
1. Open MS Access 2016 by clicking on the Start > Access 2016.
2. The Start Screen of Access 2016 appears. Select the Blank desktop database option in
the right pane.
3. Type the name ‘Residents of ABC Society’ for the database in the File Name box.
4. Click on the folder icon to select the desired location for the database. Click on the
Create  button.
5. By default a blank table opens in the Datasheet View. Switch the view to the Design
View. Access prompts to save the table. In the Save As dialog box, type ‘Residents info’,
and click  on OK. The table opens in the Design View.
6. Now, enter the field names — House No, First Name, Last name, Age, and Occupation.
At the same time, define the suitable data type for each. Add description for the required
fields as shown in figure a.
7. Set House No field as the Primary Key.
8. In the ‘Field Property’ pane, set the Default Value ‘21’ for the field Age.
9. Now, switch to Datasheet View to enter the records.
10. Enter at least 5 records. Make sure you do not leave any field blank. (The sample records
are shown in figure b.)
11. Sort the table in ascending order on the basis of ‘Age’ field.
12. Filter the table and display only the residents whose age is between 35 and 50.
13. Add a new field named ‘Gender’ after the ‘Age’ field, and enter data for this field.
14. Save the changes in the table, and exit MS Access application.
36
Fig. a

Fig. b

Group Discussion

Conduct a group discussion on the topic:


Relational database is more advanced than Flat File database.

Teacher’s Notes

▶▶ Discuss the importance of storing data with the students.


▶▶ Describe the concept of computer database with the help of real-life examples.
▶▶ Explain the difference between Flat File database and Relational database in detail.
▶▶ Tell the students about the importance of a Primary Key in a database.
▶▶ Demonstrate and help the students in performing various operations in MS Access.

37
Queries, Forms, and
3 Reports in Access
Hello Friends! In the previous chapter, you Let’s Learn About
have learnt the basics of MS Access. Do ♦♦ Setting a Relationship
you know that you can also link multiple between Tables
tables in Access? This feature increases the ♦♦ Query
efficiency of your work and also lets you ♦♦ Forms
easily share the required information with ♦♦ Reports
multiple departments in the form of reports.

A database contains thousands of records with multiple tables in it, which may even increase
over time. Extracting specific information from such a huge database is a challenge.
MS Access offers features, such as queries, forms, and reports to make this task easier.
Let us learn about them in detail.

SETTING A RELATIONSHIP BETWEEN TABLES


MS Access is a Relational Database Management System. This type of database stores the
data and information in multiple tables with rows and columns, and provides the facility to
establish a relationship between different database tables.
Access has a feature called relationship which lets a user bring the information stored in
different tables together. Relationships are links that are used to associate a field in one table
with the exact same field in another table. Remember that a relationship functions only when
both the tables have a field with the exact same name.
Generally, these matching fields are the primary keys, which uniquely identify each record in
the tables. A primary key of another table is called a foreign key.
To set a relationship between the tables, follow these steps:
1. Create two tables, one named Students’ Info (Fig. 3.1) which contains the information
about students, such as Roll No, First Name, Last Name, Age, Class, and Section.
38
Name the second table as Guardian’s Info (Fig. 3.2) containing roll numbers of the
students along with the name of their parents. (Here, the Students’ Info table is the
parent table and the Guardian’s Info table is the child table since it contains the
information linked to the Students’ Info table and is not independent.)
2. The field Roll No is common in both the tables.

Fig. 3.1  Students’ info table Fig. 3.2  Guardian’s info table

3. Before setting a relationship between these


two tables, ensure that one table is open in
the Datasheet View.
4. On the Database Tools tab, click on the
Relationships button in the Relationships
group (Fig. 3.3).
Fig. 3.3  Selecting Relationships option
5. The Show Table dialog box appears
displaying the available tables in a
database (Fig. 3.4).
6. Select the desired table, and click on Add. The
selected table appears in the new tab named
Relationships (it is a new object added in the current
database). Similarly, add the second table as well.
Note: You can select both the tables at the same
time using the Shift key.
7. Close the Show Table dialog box. The database
window looks as shown in figure 3.5.
8. Click and drag the Primary Key, that is, Roll No from
the left table and drop it over the same field in the
right table, or vice versa. Fig. 3.4  Show Table dialog box
9. The Edit Relationships dialog box
appears with the Roll No field in
both the columns (Fig. 3.6).
10. Click on the Create button.
A linking line appears between
both the tables, indicating that
Access has created a relationship
between the two tables on the
basis of the linked field, that is,
39
Roll No (Fig. 3.7). Fig. 3.5  Tables added to set a relationship
11. Save the defined relationship by clicking on the Save button on the Quick Access Toolbar.

Fig. 3.6  Edit Relationships dialog box Fig. 3.7  Relationship defined between the tables

Once the relationship is defined between the tables, data from both the tables can be used
for queries, forms, or reports.

QUERY
The general meaning of a query is ‘question’. In MS Access, query is a database object.
It is used to retrieve data or information from data table(s) based on certain conditions
(or criteria). These conditions are specified by the users.
Microsoft Access provides different types of queries such as:
▶▶ Select ▶▶ Crosstab ▶▶ S  tructured Query Language (SQL)
▶▶ Parameter ▶▶ Action
Some examples of queries can be:
▶▶ the list of winners who belong to the same school
▶▶ the list of students who scored above 90 in all the subjects
▶▶ the list of people whose age is above 60
The result of a query is displayed in the form of a table. This table shows the set of records
that match the specified criteria. Access saves each query as a separate table called
Query table in a database. You can run a saved query anytime in the future.
Let us learn how to create a simple query based on a single table.
The two methods to create a query in MS Access are:
▶▶ Query Wizard ▶▶ Query Design
These two methods are available on the Create tab in the Queries group (Fig. 3.8). Here,
we will use the Teachers’ Info table (Fig. 3.9) to create a query.

40
Fig. 3.8  Query Options Fig. 3.9  Teachers’ info table
Creating a Query using Query Wizard
To create a query using the Query Wizard, follow
these steps:
1. On the Create tab, click on the Query Wizard
option in the Queries group.
2. The New Query dialog box opens (Fig. 3.10).
3. On the right pane, the Simple Query Wizard
option is selected by default. Click on OK.
4. The Simple Query Wizard screen (1 of 3) Fig. 3.10  New Query dialog box
appears (Fig. 3.11). If the current database has
multiple tables, click on the drop-down arrow
of the Tables/Queries box, and select the table
that contains the required data.
5. The data of the selected table appears in the
Available Fields pane (Fig. 3.11). Now, add
the field that you wish to see in the query results.
6. To add fields, follow these steps:
a. In the Available Fields pane, select the
required field.
Fig. 3.11  Simple Query Wizard screen (1 of 3)
b. Either click on the button or
double-click on the field. The selected
field moves to the right pane, that is, the
Selected Fields pane. Add the required
fields one-by-one.
c. If you wish to remove a field from the
Selected Fields pane, click on the
 button. The selected field will reappear
in the Available Fields pane.
d. After selecting the required fields, click on
Fig. 3.12  Selected Fields
Next (Fig. 3.12).

Ava’s Cool Tip


To move all the fields from the Available Fields pane to the Selected Fields pane at once,
click on the button. Click on button to remove all the fields from the Selected Fields 41
pane at once.
7. The next screen (2 of 3) of the Simple Query
Wizard (Fig. 3.13) appears, asking you
to select either Detail or Summary option.
The Detail option is selected by default.
Click on Next.
8. The last screen (3 of 3) of the Simple Query
Wizard (Fig. 3.14) appears. Access suggests
a title for the query. You can replace it by
entering a more suitable title for the query.
9. The Open the query to view information
Fig. 3.13  Simple Query Wizard Screen 2 of 3
radio button is selected by default. Click on
Finish (Fig. 3.14).
10. The output of the query appears in the Datasheet View (Fig. 3.15). Observe that the
Query name appears in the Navigation pane.

Fig. 3.14  Simple Query Wizard Screen 3 of 3 Fig. 3.15  Result of Teachers’ Info Query

Creating a Query using Query Design


Creating a query using the Query Design option lets you have
more control over the query. Unlike the Query Wizard, this
option lets you create a query from the scratch.
To create a query in the Query Design, follow these steps:
Adding a Table:
1. On the Create tab, click on the Query Design option
in the Queries group.
2. The Show Table dialog box appears (Fig. 3.16).
3. Select the required table. Click on Add or simply
double-click on the table. Here, we are using only one
table named Teachers’ Info. If you want to add multiple
42 tables, then repeat this step the requisite number of times.
4. Once the required table is added, click on Close. Fig. 3.16  Show Table dialog box
5. The selected table appears as a small window in the Query Design screen (Fig. 3.17).

Fig. 3.17  Query Design Screen

Adding Fields:
6. Select the fields to be included in the query from the Teachers’ Info table to the grid.
Use any of the following methods:
▶▶ Double-click on the field name in the table. Notice that the field is automatically
inserted in the first vacant column in the grid.
▶▶ Click and drag the field to the required column in the grid.
▶▶ Directly type the name of the field in the required column.
7. After adding the fields, the grid will look as shown in figure 3.18.

Fig. 3.18  Fields added in the Query Design Grid

8. The fields appear in the Field row followed by the table name in the Table row.
Rearranging the Order:
Suppose you want to rearrange the order of fields as you want them to appear in the query
result. Then, follow these steps:
9. Place the pointer over the selector bar (Fig. 3.19) right above the column that you
43
want to move to a new position.
Selector bar

Fig. 3.19  Rearranging the order of Fields in the Query

10. Click as soon as a tiny downward facing arrow appears. The entire column gets
selected (Fig. 3.19).
11. Click and drag it to the desired position.
Hiding the Field:
The Show row displays a checkbox in each column. Clearing the checkbox of a particular
field hides it while you run the query. Click on a checkbox to deselect it. In figure 3.20, the
Show checkbox of Subject is clear.

Fig. 3.20  Hiding a field in the Query Design Grid

Sorting the Field:


12. Click on the Sort box of the field whose data you wish to sort. Here, we have selected
the TeacherID as the Sort field.
13. Notice that a drop-down arrow appears at the right side of the box. Click on this
arrow. Select the Descending option in the drop-down list (Fig. 3.21).

Fig. 3.21  Sorting in the Query Design Grid

Setting Criteria:
44 This row lets you set a condition on the basis of which the data of the table will be filtered in
the Query result.
14. Click on the Criteria box of the Salary field, and type >=30000. This criterion will
display only those records in the Query output where salary is equal to or greater
than 30000.

Fig. 3.22  Setting condition in the Query Design Grid

Running a Query
Running a query means to perform the actions specified in that query. To run a query, follow
these steps:
1. On the Design tab, click on the Run button in the Results group (Fig. 3.23).
2. The query result appears in the Datasheet View (Fig. 3.24).

Fig. 3.23  Selecting Run option Fig. 3.24  Query Result

Saving a Query
To save a query, follow these steps:
1. Click on the File tab > Save option.
OR
Click on the Save button on the
Quick Access Toolbar.
2. The Save As dialog box appears if the
query is being saved for the very first time.
3. Enter a suitable name in the Query Name
45
text box, and click on OK (Fig. 3.25). Fig. 3.25  Saving a query
Let’s Review
Consider the Query Design Grid given below, and answer the questions that follow.

1. How many fields are there in the grid?


2. Name the source table of the fields.


3. Which component of the Query Design Grid lets you rearrange the order of data?


4. In which row of the grid you can set a condition?

FORMS
A form is a database object that facilitates the users to enter, edit, delete, and view data in a
table. Certain users might need to see only some fields in a table having many fields. A form
that contains only required fields makes it easier for users to use the database. Let us learn
how to create a form using the Form command and Form Wizard option. Here we will use
the Teachers’ Info table (Fig. 3.9).

Creating a Form using the Form Command


To create a form using the Form command, follow these steps:
1. In the Navigation pane, double-click on the Teachers’ Info table. The table opens in
the Datasheet View.
2. On the Create tab, click on the
Form button in the Forms group
(Fig. 3.26).
3. A simple form appears in the Layout Fig. 3.26  Selecting the Form command

46 View displaying all the fields used in the table (Fig. 3.27). By default, it opens the first
record of the table.
Fig. 3.27  Form in Layout View

4. Three additional tabs named Design, Arrange, and Format appear on the Ribbon
under the Form Layout Tools contextual tab (Fig. 3.27).
5. Select the first or any text box in the Form, and resize it using the resizing handle. The
rest of the text boxes resize as well.
To make any modifications in the data, first open it in the Form View.
To do so, follow these steps:
1. Click on the View button on the
Home tab. Select the Form View
in the drop-down menu
(Fig. 3.28).
2. Make the required changes in the
data. Use the Navigation buttons
present at the bottom of the work
area to move through the records.
To change the appearance of the form,
use the various options available on the
Design and Format tabs. First, switch
the view from the Form View to the
Layout View.
Fig. 3.28  Editing data in Form View
Using the Design Tab
1. Adding a Logo:
a. Click on the Logo button in the Header/Footer group (Fig. 3.29).

47
Fig. 3.29  The Design tab
b. The Insert Picture dialog box appears (Fig. 3.30). Locate and choose a suitable
picture. Click on OK.

Fig. 3.30  Insert Picture dialog box Fig. 3.31  Date and Time dialog box

2. Adding the Title:


a. Click on the Title option in the Header/Footer group.
b. The existing title gets highlighted. Replace it with Teacher Details.
3. Adding Date and Time:
a. Click on the Date and Time button in the Header/Footer group.
b. The Date and Time dialog box appears (Fig. 3.31).
c. Select the desired format for Date and Time in the respective sections. Click on OK.
d. By default, the Date and Time placeholders appear at the extreme right side of
the Header section. You can move these placeholders as per your requirement.

Using the Format Tab

Fig. 3.32  The Format tab

1. Formatting the Text:


a. Select the labels in the form.
b. On the Format tab, use the Font Color and Bold options available in the
Font group to change the text color and apply the bold effect, respectively.
2. Adding Background Color:
To apply background color to the form, follow these steps:
48 a. First, click anywhere inside the empty area of the form.
b. Click on the Background Color button in the Font group.
c. A drop-down color gallery appears.
Select the desired color under the
Theme Colors section.
d. The final form will look similar to
figure 3.33.
1. Click on File tab > Save. The Save As
dialog box appears (Fig. 3.34). Fig. 3.33  The final Form
2. Type a suitable name for the form and
click on OK.

Creating a Form using Form Wizard


To create a form using the Form Wizard, follow these steps: Fig. 3.34  Save As dialog box
1. On the Create tab, click on the Form Wizard
option in the Forms group.
2. The Form Wizard screen (1 of 3) appears
(Fig. 3.35).
3. Select the required table from the
Tables/Queries drop-down menu.
4. Select and add the fields that you wish to
see in the Form. Click on Next.
5. The next Form Wizard screen (2 of 3)
appears (Fig. 3.36). In this screen, you have Fig. 3.35  Form Wizard screen 1 of 3
to select a layout for the form. By default, the
Columnar radio button is selected. Change the layout if needed, and click on Next.
6. The final Form Wizard screen (3 of 3) appears (Fig. 3.37). Add a suitable name for
the form. Make sure that the Open the form to view or enter information option is
selected. Click on Finish.

49
Fig. 3.36  Selecting a layout for Form Fig. 3.37  Entering a name for Form
7. The formatted form appears (Fig. 3.38). Now, you can edit the data.

Fig. 3.38  Form created using Form Wizard

REPORTS
A Report is a database object used to display or get an output of the data in a desired
format. It collects the data and generates the reports as per the user’s required format. It
is an effective method to organise, view, and present data. You can control the size and
appearance of a report along with its components in MS Access. Let us discuss two methods
of creating reports:
▶▶ Report Command ▶▶ Report Wizard

Creating a Report using the Report Command


To create a report using the Report command, follow these steps:
1. In the Navigation pane, select a table or query. Here, we are using the
Teachers’ Info table.
2. On the Create tab, click on the Report button in
the Reports group (Fig. 3.39).
3. Access creates a report based on the selected table
or query, and displays it on the screen (Fig. 3.40).
By default, the report opens in the Layout View. Fig. 3.39  Selecting Report command

50
Fig. 3.40  Report created using the Report command
4. The four additional tabs named Design,
Arrange, Format, and Page Setup
appear on the Ribbon under the
Report Layout Tools contextual tab.
5. Apply formatting effects to the report to
change its appearance. Here, we have
applied some effects using the Design
and Format tabs as displayed in
figure 3.41. Observe that the size of the
field boxes is reduced, text formatting,
and background color is applied to the
report’s heading.
6. Click on the Save button on the
Quick Access Toolbar. In the Save As
dialog box, assign a suitable name to Fig. 3.41  Formatted Report

your report. The newly created report is displayed in the Navigation pane.
7. Click on the File tab > Print > Print Preview to view how the report will look on a
sheet of paper.

Creating a Report using Report Wizard


To create a report using the Report Wizard option, follow these steps:
1. On the Create tab, click on the Report Wizard button
in the Reports group (Fig. 3.42).
2. The first screen of Report Wizard (1 of 5) appears
(Fig. 3.43). Select the desired table or query in the
Tables/Queries drop-down list. Select and add the fields Fig. 3.42  Selecting Report
Wizard option
that you wish to see in the Report. Click on Next.
3. The second screen of Report Wizard (2 of 5) appears (Fig. 3.44). Add a grouping
level if needed. Here, we have selected the Subject field to add a grouping level.
Click on Next.

51
Fig. 3.43  Report Wizard screen 1 of 5 Fig. 3.44  Report Wizard screen 2 of 5
4. The next screen of Report Wizard (3 of 5) asks you to set the type of sorting order
and summary information for the Report. Click on the first text box, and select the
Salary field. By default, Ascending option is selected. Change it to Descending and
click on Next (Fig. 3.45).
5. The Report Wizard screen 4 of 5 opens (Fig. 3.46). Select the desired layout and
orientation for your report in the corresponding sections.
6. Click on Next.

Fig. 3.45  Report Wizard screen 3 of 5 Fig. 3.46  Report Wizard screen 4 of 5

7. The final screen of Report Wizard (5 of 5) appears (Fig. 3.47). Assign a suitable title
for the report. Ensure that Preview the report radio button is selected.
8. Click Finish.
The report appears as shown in figure 3.48.

52
Fig. 3.47  Report Wizard screen 5 of 5 Fig. 3.48  Report created using the Report Wizard
Flashback

▶▶ MS Access is a Relational Database Management System. It stores data and information in


multiple tables with rows and columns.
▶▶ In MS Access, you can establish a relationship between different database tables.
▶▶ Relationships are links that are used to associate a field in one table with exactly the same field
in another table.
▶▶ Query is a database object used to retrieve data or information from the data table(s) based on
certain conditions specified by the user(s).
▶▶ Form is an object that facilitates the users to enter, edit, delete, and view data in a table. It can
be created using the Form command and/or Form Wizard.
▶▶ A report is a database object used to display or get an output of the data in a desired format.
It can be created using the Report command and/or Report Wizard.

A. Tick (✓) the correct answers.


1. Which of the following is not a database object?
a. Form b. Report c. Essay
2. Which of the following is not used while setting a relationship between the tables?
a. Answer key b. Primary key c. Foreign key
3. What is the general meaning of query?
a. Quality b. Question c. Qualification
4. Query, Form, and Report Wizard options are available on which tab?
a. Home b. Format c. Create
5. Which view allows the users to change the appearance of a form?
a. Layout b. Print Preview c. Form

B. Fill in the blanks.


1. is a type of query.
2. and are two methods of creating reports.
3. The output of a query appears in the
4. To change the appearance of the form, use the and tabs. 53
5. is a database object used to retrieve data table.
C. Write T for True and F for False.
1. Columnar is the default layout for a Form.
2. Once a Form is created, it cannot be edited.
3. Access saves each query as a separate table called Query table.
4. A primary key of another table is called foreign key.
5. Parameter is a type of query.

D. Answer the following questions.


1. What is the utility of relationships feature of MS Access?
2. What is a Query in Access? Describe the use of options available in the Query Design Grid.
3. What do you understand by a Form? List the formatting effects that can be applied to
a  Form.
4. Explain the term Report. State any two methods to create a Report in Access.
5. How are objects like query, report, and form beneficial in creating and organising a
database? Explain.

Ava’s Activity Zone

Lab Activity

A. Create a table named ‘Student Details’ with the fields as shown in the figure given below.
Create  a query and report using this table.

54
Solution:
1. Start a new blank database with a table named Table1 in the Datasheet View.
2. Switch the view to the Design View using the View drop-down menu. Access prompts
to save  the table. In the Save As dialog box, assign a suitable name, say, ‘Student Details’
and  click on OK.
3. The Design View opens. Type in the Field Names, select Data Types, and add
Description (Optional) as shown in the figure above.
4. Set the Roll No field as the Primary Key. Now, switch back to the Datasheet View.
5. Enter at least 15 records in the table.
6. Create a form using the Form command in the Forms group on the Create tab.
The  form opens in the Layout View.
a. Using the Design tab, add a relevant Logo, edit the Title, and insert the
Date  and Time in the header of the form.
b. Apply font formatting and background color using the Format tab.
c. Save the form as Student Details Form using the Save button.
7. Create a query using the Query Design option in the Queries group on the Create tab.
a. In the Show Table dialog box, select the Student Details table. Click on Add, and
then click on Close.
b. Add the Roll No, Student Name, DOB, and Home State fields from the table to the
Query Design Grid.
c. Set DOB as Sort field, and select the Ascending option.
d. Run the query by clicking on the Run button in the Results group on the
Design  tab.
e. Save the query as Student Details Query.
8. Finally, create a report on the Student Details Query.
a. Select the Student Details Query in the Navigation pane.
b. On the Create tab, click on the Report button in the Reports group.
c. Access creates a report on the basis of selected query and opens it on the screen.
d. Save the report with the name Student Details Report.
e. To see the print preview of the report, click on the File tab > Print Preview. 55
B. Create a table named Holiday Destination to store the details of top ten holiday
destinations of India. The table must consist of the fields mentioned in the given figure.


Do the following:
1. Open MS Access 2016.
2. Define the fields, data types, and description in the Design View.
3. Enter minimum 10 records in Datasheet View.
4. Create a Query, and Sort the data in Descending order on the basis of No of Tourists
Visited field. Run the query.
5. Save the query with the name Popular holiday destinations.
6. Create and print a report on the basis of the above query. Save it.

Group Discussion

Conduct group discussion on the following topics:


▶▶ Query Design option gives more control over a query as compared to Query Wizard option.
▶▶ How important is the Primary Key in setting a relationship between tables?

Teacher’s Notes

▶▶  emonstrate to the students how to set a relationship between the tables. Describe the utility
D
of setting relationship between the tables.
▶▶ Discuss the term query with the help of real-life examples. Tell the students why queries are
used in a database.

56
GF-3, Virat Bhavan, Commercial Complex,
Mukherjee Nagar, Delhi 110009
Phone: (011) 43158350

You might also like