Vous êtes sur la page 1sur 10

ISBT

Introduction to Microsoft Access


1. Introduction
Access is one of the application programs included in Microsofts Office Professional
package. Access is a relational database system that provides facilities for storing,
processing and managing information.
Where we might need to rearrange, select, summarise and produce lists, a
computerised database system is likely to provide the most efficient solution.
Typically, we might store personnel details, stock inventory, financial transactions
etc. Unlike many systems, Access stores all the components of the database in one
file. These components include:

a Data Dictionary (i.e. information concerning the structural details of the


data)

the Data

screen Forms (which provide the interaction with the system)

Queries and Reports (for extracting information from the data)

Programming code via Macros and Modules (to automate operational


procedures and control how the database interacts with the user)

In Access there are a number of terms which are commonly used in relational
database systems.

data is stored in a Table.

a Table contains Records (one record is represented by a row of the table)

each Record is broken down into a number of attributes or Fields (each field
is represented as a column of a table)

Data is normalised into separate tables of dependent attributes, with a link between
them (e.g. a staff table might be linked to a training table). This is where the concept
of a Relational database comes from.

Creating a New Database


On selecting the Access 2010 from the start programs menu or from an icon you
should follow these notes. Your first image will look like the one below. It gives you
the option to choose either a blank database or a customised one:

ISBT

Page 1

Task 1:
Select the Blank Database option and click on the folder icon in order to choose the
folder and location on your hard drive (or memory stick) where the database file is to
be stored.

Doing this creates a file which will contain any items set up in your database.
Task 2:
Once you have selected a personal drive enter the filename Property_Rentals and
click Create:

Your entry page will look like the following:

ISBT

Page 2

The Navigation Pane


This is the command console from which you can create and access any object in
your database.
The Navigation Pane will show the different objects as you create them in your
Database.
These are:
Tables data structures which store your information
Queries structures to extract or manipulate data held in tables
Forms screens designed to make input or viewing of data more accessible
Reports to format information for printing

Creating a Table
Each database file may contain one or more tables. A new table is the first structure
which would normally be specified.

Task 3:
You will need to click first on the Design Table View as it is indicated by the arrow
head above left. The name table tag will appear on your screen and you will insert
the name: tblBranch for this table and then click OK.
Tip: It is good practice to name objects with a prefix to identify object type eg tbl for
a table, qry for a Query

You are now inside the design dialog screen where you are expected to start
developing your table design in a format that will enable you to enter data:

ISBT

Page 3

The Design dialog screen (shown below), lets you specify the Field Names (i.e.
general title for each item of data to be stored) and their Data Type (e.g. whether
Text or Numbers are to be stored in the field). The Description is only needed if you
wish to provide detailed documentation in the system.
The General Properties options (in the area at the bottom of the screen) may be
used if you wish to alter features of the fields such as the number of characters

Design dialogue
box

allowed, the number of decimal places etc.

Task 4 :
Look at the Branch Table supplied and create the Data Dictionary for the table
Tip:Keep Field Names short and do not use spaces as these may cause problems in
later use
NB: You are simply creating the table structure consisting of the field names at this
stage. You must not enter any data yet !!

ISBT

Page 4
General
Properties

Key Fields
Tables comprising a database will normally need to be linked to each other. To do this
requires the selection of one (or occasionally multiple) fields as a Primary Key. This
has the advantages that the records will be automatically sorted in the key field
order and no duplicates will be allowed.
Task 5:
Make the Branch_No field a Primary Key (Access usually defaults to allocate the
first field as the Primary Key, but this button allows any key or keys to be nominated
as the Primary Key(s))

Do not use spaces in


field names, use _ to
separate if necessary

We continue by entering the names and types of the rest of the fields as in the
picture above:
Data can be entered from the spreadsheet view.

ISBT

Page 5

To summarise, any changes to the design of the database (field types, sizes,
formats, new fields) are carried out in the Design view.
Entering Data
When you wish to enter data into a file structure you can to switch to what is called
Datasheet View. This allows data to be entered in a simple column format (each row
being a record and each column storing a Fields data). It is a good idea to Maximise
the window to see as many of the fields as possible. When we do that it will ask to
save the file as in the picture below: We save the new structure with the original
name tblBranch.

Datasheet View
If the column widths require adjustment, you can do this (in the same way as in
Excel) by pointing at the field names right hand edge (a double arrow pointer will
appear) then hold the mouse button down and drag the edge to an appropriate
position.
The TAB key is used to move to each successive field. When a record is being edited
note the pencil symbol which appears in the record selector box at the left hand side
of the row. This shows that the data has not yet been saved to disk. On moving to a
different record the previous one is automatically saved to disk.
Other keys which are useful in editing are :
F2 to select or deselect the current entry
record

- Esc to cancel changes to the current

Modifying the Structure


If you wish to modify the file structure select the Design View icon

Task 6 :
Enter the data shown in the table below

tblBranch
Branch_
No
B002
ISBT

Street
56 Clover

City

Post_Co
de

London NW10
Page 6

tblBranch
Branch_
No

Street

City

Drive

Post_Co
de
6EU

B003

163 Main St Glasgo G11 9QX


w

B004

32 Manse
Rd

B005

22 Deer Rd London SW1 4EH

B007

16 Argylle
St

Bristol

BS99
1NZ

Aberde AB2 3SU


en

Question 1 :
What happens if you try to give a new branch a number already used ?

Linking Tables
Where there are a number of tables in a database it is possible to establish links
between them provided there is matching data in each table. The following notes
and exercises show how to create these relationships and explore some of the
associated issues.
Task :7
Create the Staff table using the same method as the Branch table. Enter the data
shown below

tblStaf
staf fna
No
me
SA9

lna positio se
me
n
x

Mary How Assistan f


e
t

DoB

salary

branch
no

19/02/19 9,000.0 B007


70
0

SG14 Davi Ford Supervis m


d
or

24/03/19 18,000. B003


58
00

SG37 Ann Beec Assistan f


h
t

10/11/19 12,000. B003


60
00

SG5

03/06/19 24,000. B003


40
00

ISBT

Susa Bran Manager f


n
d

Page 7

tblStaf
staf fna
No
me

lna positio se
me
n
x

DoB

salary

branch
no

SL21 John Whit Manager m


e

01/10/19 30,000. B005


45
00

SL41 Julie Lee

13/06/19 9,000.0 B005


65
0

Assistan f
t

To set up a link between the tables you need to open the


relationships window by clicking on the relationships icon (or use
the Edit / Relationships menu). You need to close any table
windows before relationships may be created or edited.
Task 8 :
Click on Database Tools and then on the Relationships icon which will allow you to
click on the Show Table icon/menu. The display should be like the one below. Select
the tblBranch table title and click on the Add button. Repeat this for the tblstaff
table before closing the Show Table dialog box

Task 9:
Identify the fields linking the two tables and drag and drop the two fields

Question 4 :
Research the term Referential Integrity and explain it below

ISBT

Page 8

Q5 Explain the significance of the two options Cascade update Related Fields and
Cascade Delete Related fields

The display should look something like the one here.

Task 10:
Close (and Save) this Relationship Window.

ISBT

Page 9

Task 11 :
In the main table display window open the tblBranch table and change the Glasgow
Branch number to B009. Look at the Staff table and describe the effect

Task 16 :
Julie Lee is moving to a new branch in Kingston, with a code of B021. Change her
Branch No to B021
What happens?

Explain why?

Create the remaining tables shown in the Property_Rentals database, input the data
and create the relationships between the tables
Start to create the tables required for your database, and create the relationships
between them

ISBT

Page 10