Chapter 2access

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 28

CHAPTER 2

MS ACCESS 2007
introduction

Database is the arrangement of data in a


manner where it can be retrieved easily.
Microsoft Access is a database program that
is used for storing all kinds of information
in the form of tables, queries, forms, reports,
etc. It has many built- in features to assist
you in constructing and viewing the
information stored in the database. Once
information is stored in Microsoft Access
database, it is easy to find, analyse and print.
Some important terms related to database

Database: It is an integrated collection of logically- related


records in the form of tables and offers an organised mechanism
for storing, managing and retrieving information.

Database Management System (DBMS): It is a set of computer


programs that controls the creation, maintenance and the use of
the database in the computer by the user. For example, MS
Access, Foxpro etc.
Table: It is a collection of related information in the form of
rows and columns.
Record: It is a complete information arranged horizontally in a
table.
Field: It is a column arranged vertically in a table that stores the
information of the same type.
DATABASE
SCHOOL

TABLES

STUDENT LIBRARY
STAFF
DETAILS BOOKS

ADMISSION NO. BOOK CODE


STUDENT NAME SUBJECT STAFF CODE
ADDRESS AUTHOR STAFF NAME
CITY PUBLISHER DEPARTMENT
PHONE NUMBER COST SALARY
CLASS ISSUE DATE JOINING DATE
ADMISSION DATE RETURN DATE

RECORDS
Functions of DBMS

Data Definition: The DBMS provides functions to define the structure


of the data in the application. These include defining and modifying the
record structure, the type and size of fields and the various constraints
to be satisfied by the data in each field.

Data Manipulation: Once the data structure is defined, data needs to


be inserted, modified or deleted. These functions which perform these
operations are part of DBMS.

Data Security & Integrity: The DBMS contains modules which


handle the security and integrity of data in the application.
Data Recovery and Concurrency: Recovery of the data
after system failure and concurrent access of records by multiple
users is also handled by DBMS.

Data Dictionary Maintenance: Maintaining the data
dictionary which contains the data definition of the application is
also one of the functions of DBMS.

Performance: Optimizing the performance of the queries is
one of the important functions of DBMS.
Advantages of DBMS

Due to its centralized nature, the database system can


overcome the disadvantages of the file system-based
system
1. Data independency

2. Efficient data access


3. Data integrity and security
4. Data Administration
5. Concurrent access and Crash recovery:
6. Reduced application development time.
MS Access Database Objects
MS Access uses “objects" to help the user list and organize information,
as well as prepare specially designed reports.

Tables.
All data is stored in tables. When you create a new table, Access asks
you define fields (column headings), giving each a unique name, and
telling Access the data type.

Queries: These are used for sorting, grouping or filtering data in MS


Access. For example, a query might only display a list of
students in class 8 out of all school students.

Forms: Customised screens to provide an easy way to enter and view


data in a table or query.
Reports: These present data from a table or query in printed format.
MS ACCESS
Ms Access makes use of tables and records to store information.
It is a Database Management System from Microsoft. It can also
import data stored in other applications and databases.

Creating a Blank Database


1. Click on Blank Database in the New Blank Database section.
The Blank Database pane appears on the right.
2. Type a name for the file in the File Name: box.
3. Location of the database can also be changed by clicking on
the Browse icon in the right pane.
4. Click on the Create button. A new database titled Table1 will
be created seen in Datasheet tab.

NOTE: The extension of an access database file in MS Office is


.accdb
The Database window
Title Bar: It shows the name of the database created.
The Minimise, maximise/ Restore and Close buttons
are also present in this area.
Microsoft Office Button: It is the button on the left of
the Title Bar. It contains commands like New, Open,
Save, Save As, Print etc.
Quick Access Toolbar: It has some of the most
frequently used commands in Ms Access like Save,
undo and Redo. The toolbar can be shifted below the
Ribbon also and more commands can be added to it.
Ribbon: It contains the commands that can be
performed against different database objects. These
commands are classified under groups in different tabs.
Navigation Pane: It is the left pane of the window. Here,
database objects in the currently opened or freshly created
databases are displayed.

Tabbed Document: The database objects appear in tabs unlike


the overlapping windows in the earlier versions.

Status Bar: It is present at the bottom window and displays


the status and buttons to change the page views.
DATA TYPES

Text. Essentially the same as the Character type in xBase.


255 character maximum. You can and should define a width,
but Access doesn't use fixed width storage so is not as
wasteful of disk space.

Number. This category includes Byte (unsigned 8-bit),


Integer (signed 16-bit), Long (signed 32-bit), Single (signed
32-bit), and Double (signed 64-bit).

Currency. A 64-bit fixed point number, designed to give the


accuracy needed for financial data.

AutoNumber. (Access 95 onwards.) The AutoNumber


replaces the Counter as an automatically assigned number.
Date/Time. Access stores Dates as 8-byte floating point
numbers, where the integer part refers to the day, and the
fraction part refers to the time.

Yes/No. A Logical field can be displayed as Yes/No, True/False,


or On/Off. In code, use the constants True and False, equivalent
to -1 and 0 respectively.

Memo : It is used for lengthy text and numbers such as


definitions or descriptive notes. A maximum of 65536
characters are allowed.
Primary key

A primary is a column or set of columns in a table that uniquely


identifies rows in that table. This primary key should always
have a value that is not repeated for any other record.
NOTE: If the primary key is not assigned it is automatically
added as an ID at the time of saving the table. You can even
have multiple primary keys for a table.

Assigning a primary key


Select the required field and right-click on it. A shortcut menu
opens. Select the Primary Key option. A key will be displayed in
front of the column name to show that the column is now
working as a primary key in the table.
Creating tables in design view
1. Open the database.
2. Select datasheet tab Views group View
drop-down list Design View option.
3. The Design view window is divided into two
parts: Field Grid Pane and Field Properties
pane.
4. Enter the required information in the fieldgrid
and field properties opanes in the Design view.
5. Assign one of the fields in the Field Grid Pane
as the primary key.
Field Grid Pane
It is used to define the fields in the tables
along with their data types and an optional
description of the field. You can change
the data type of the field in this view.
Field Properties pane
You can give additional properties to the
Field
Name using Field Properties pane. It is used
to specify the field properties in detail such
as field size, validation, etc.
Field Properties
Property Description

Field size Used to set the maximum size for data stored in the field.

Format It allows you to display data in a format which is different from


the way it is actually

Caption It is used to display an alternate name for the field to make it


more explanatory.

Input mask It stores the condition to be followed at the time of accepting


data in Datasheet view.

Validation it sets constraints to the values that can be accepted into a


field.
rule
Validation It shows error messages that appear when the user violates the
set validation rule.
Text
Required It helps to set whether the data is compulsory in a column or
not.
Modifying Tables and their content

Tables created in Access 2007 can be


modified in the Datasheet view. Data types
can be changed and columns/ fields can be
added, deleted, moved and renamed.

The different groups in the Datasheet tab can


be used to modify the tables and its contents.
Changing data types
1. Select the desired column header.
2. Click on the drop-down list next to the data type
option in the Data type & Formatting group and
select the desired option.
Inserting a new field
3. Select the column header, on whose left you wish
to insert a field.
4. Click on the INSERT option in the Fields $
Columns group of the Datasheet tab.
Deleting a field
1. Select the column header of the field you
wish to delete.
2. Click on the Delete option in the Fields &
Columns group of the Datasheet tab.
3. Click on YES in the MS Office Access
dialog box.
Moving a field
1. Select the field to be moved.
2. Hold the left mouse button till the cursor
changes to.
3. Drag and drop the field in the desired
location.
Queries in MS Access
A query is a question pertaining to the data with a specific
answer to it. Thus, it is a way of retrieving specific information
from single or multiple tables of the database.
STEPS
1. Open the database.
2. Click on the Create tab in the MS Access ribbon.
3. Select the Query Design option in the other group.
4. The Show Table dialog box appears.
5.In the Tables tab, select the table from list of tables created
and click ADD.
6.Repeat the same step to add more tables. Click on Close
after the required tables have been added.
7. The QUERY tab opens. The upper pane displays the tables
selected. The lower pane represents the Design Grid.
8.Click on the down arrow in the
Field property boxes and add the
fields in the desired order.
9. Sort the data in the selected field
based on your preference using Sort
property.
10. Specify the criterion for the
query in the criteria property box.
11. If required, click on save.
Design Grid Pane: It is the portion of the query
tab where fields and criteria for the query are
added.
To run a query

1. Click on Design tab Results group


Run option.
2. The result for the query appears in the
Query window in the Datasheet view.

Forms in MS Access
Forms are customised screens for viewing,
entering, modifying and deleting data in a
table or a query.
Steps for creating a Form
1. Open a database.
2. Click on CREATE tab Forms tab Form
option.
3. The form is titled the same as the table chosen. It opens
in the Form View.
4. Move through the different pages of the form using the
Navigation box in the Status Bar.
5. Save the form using the Save As option in the Office
button drop-down list.
6. You can change the view of your form using the icons
given in the Status Bar. Layout View
can be used to change the layout of the form, just select
a style from the AutoFormat group of the Format tab.
The Design View can help in changing the design of
the form.
Reports in Ms Access
Reports are the representation of data in a
printed format. The size, appearance and
layout of the print can be customised based on
the requirements.
Steps to create a report in Ms Access
1. Open the database. Select the table or the query for
which a report has to be created.
2. Click on Create tab Reports group Report
option.
3. A report is created by Access and it will appear on
the screen.
4. Use the Layout View in the status Bar to format the
report.
5. Use Print Preview to see the report.

You might also like