0% found this document useful (0 votes)
78 views

Access 2002

This document provides instructions on how to create a table and report in Microsoft Access. It includes the following steps: 1) Creating a table called "studentdetail" with fields for roll number, physics, chemistry, and math scores by using the design view. 2) Entering sample student data into the new table. 3) Generating a simple report on the table called "XYZ School" that displays totals for each subject using the report wizard. 4) Modifying the report design to add a calculated text box to display a total score.

Uploaded by

Stanley Gardner
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)
78 views

Access 2002

This document provides instructions on how to create a table and report in Microsoft Access. It includes the following steps: 1) Creating a table called "studentdetail" with fields for roll number, physics, chemistry, and math scores by using the design view. 2) Entering sample student data into the new table. 3) Generating a simple report on the table called "XYZ School" that displays totals for each subject using the report wizard. 4) Modifying the report design to add a calculated text box to display a total score.

Uploaded by

Stanley Gardner
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/ 23

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 1

CHAPTER 1
TABLE OPERATIONS AND REPORT
Access is a powerful relational database application made available by Microsoft Corporation. It is
part of the Microsoft office package. ACCESS enables you to create , organise and manage your
data . Access is popularly used as backend tool for Visual Basic.
Database is a systematic collection of data and related information. It is an organised selection
which you can easily retrieve. It is an integrated collection of automated data files which may be
related to each other. In Access database is the collection of tables, queries, Forms, Reports etc.
Data is unprocessed information. If you note down the names and addresses of your friends it is a
data.
Related information is the information stored in tables, queries ,Forms, Pages , Reports, Macros etc.
Relational database is a database where no tables are related but you can relate them when required.
Relational Database Management (RDBMS) supports Client/Server architecture and Distributed
databases. The relationship between tables may be specified at the time of table creation. It supports
high security . Many tables can be grouped under a database.
Data is organised in tables. A table is collection of data pertaining to specific topic. A single table
contains information in row and columns. The rows are called records and the columns are called
fields.
A sample table is as follows
4 Columns
3 Rows
FIG 1.01
There are three rows in this table and 4 columns. The columns are rollno, physics, chemistry and
maths.

CREATING A TABLE
Let use start practically by creating the above table
Step 1 : Double click on the ACCESS icon or choose
START->PROGRAM-> MICROSOFT ACCESS
You will get a screen as follows.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 2

Click here

FIG 1.02

Opening dialogue box

Step 2 Select 'Blank Database' and name the database as 'STUDENT'


Note that ACCESS will assign the MDB extension automatically to the database. The database can
contain many tables. The following screen will appear.
Double click on Create Table in design view. We
will see the other options later.
Database Window

FIG 1.03

You will get the following screen

Type field
names and
select type

Format Properties

Type the field names and select their type as shown in the figure. In the left side bottom window the
property 'indexed' is set to 'Yes(No Duplicates)' only for the 'rollno' field. And index makes it easy to

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 3
find data in the fields. An index speeds up queries on the indexed fields as well as sorting and
grouping operations.
When you are through with defining all the columns just close the table window.
Save the table by name 'studentdetail'. You will see this
name added to the database window.
Step 3 Entering the Data

Select Tables
Right click on
table name
and select
open to enter
data

FIG 1.05

Right click on the table's name and select open.Fill the data into the cells.

FIG
1.06
Do not bother if the ID column is shown on to the table. This is a column automatically inserted by
Access. This shows the row or record number. Similarly on extra row is shown at the bottom.
Close the window when you have completed inserting the data. Anytime you can right click on the
table name , open the table and Add/Modify the data.
Step 4

Creating a Report.

However I am making it early to create a report. But let us create a simple report from this small
table and you will find the things easier. Reports provide you an effective way to present the data..
When we make a report we have a control over how to represent it. Access provides Wizards to
create reports. These wizards are very helpful and allow to quickly create the report. The data for
reports is taken from the tables however the titles and labels are permanently stored in the report
format.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 4

Double click
here
Click on
Reports

FIG 1.07

Select 'Reports' from the left window. Double click on 'Create report by using Wizard.'
Move the fields
with this button

FIG 1.08
The report wizard first screen will appear. Select the fields one-by one and click on the > symbol. If
you want to select all the fields then you can click on >>. Similarly you can deselct the fields by
clicking on < arrow. We have selected the rollno, phy,chem and math fields.

FIG 1.09

Go on clicking NEXT button till you get the above screen. Change the title to 'XYZ School'
Select 'Mo
dify the Report design' and then click 'Finish' button. You will get the screen as shown.
We want to modify the report because we want to add the total of marks.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 5

The report is divided into 5 sections as follows;


1] Report header
2] Page Header
3] Detail
4] Page footer
5] Report footer.
The detail section will actually hold the values.

Make a room for the page header

Pull this lin

FIG 1.10
Make a little room into the Page Header section by pulling it down
from the left side with mouse. You can also move the title to the
centre.
Draw a label

FIG 1.11
Click on 'Label' or 'Aa' symbol on the toolbar and draw a label after 'MATH'.
Now in the detail section we want the calculation to take place. So click on 'ab|' or 'Text Box' on the
tools menu. And draw a text box below the heading 'Tota
l' in the detail section. The text box name as
'Text 16' appearing on the screen may be deleted.

Draw a text box

FIG 1.12

Right click on text


box

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 6

Right Click on the 'TOTAL' textbox and select 'Properties' . The properties screen will appear.

Change the control


source property
Select print preview
type = phy+chem+math into the control source field and close the window.
From the VIEW menu select Print Preview - and you get the report.

FIG 1.14

Anytime you can right click on the report name and select 'Design View ' to change the report
format.

Right click on
the report name

FIG 1.15

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 7

Now that you have a hand on experience of creating a table and report we will go about with a little
theory. We have chosen NUMBER format for all the fields . However there are other field types
also.
FIELD TYPES

TEXT : Text type data contains characters , numbers (numbers as character) . Text you can
not perform numeric operations as addition,subtraction, multiplication etc on the text data .
NAME , ADDRESS , PIN etc. are some of the text types.

NUMBER : NUMBER field is used for calculative data. This is numeric data on which we
want perform mathematical operations. BASIC, DA , GROSS_SALARY etc are some of the
field type which use NUMBER type data.

DATE/TIME : This type is used for storing dates. There are many formats in which dates
can be stored. DATE_OF_BIRTH , DATE_OF_JOINING etc. are some of the date type
datas.

MEMO : MEMO fields are used to store large amount of data. If you want a note on specific
information then MEMO type is used. Since these fields consume a lot of space the use of
this type is rare.

CURRENCY : This field is used for storing numbers related to currency transactions.

AutoNUMBER : AutoNUMBER is automatically added to the access table. ACCESS allots


a new unique number for each record. This identifies each row and is similar to row-id.
However any field can be assigned AutoNUMBER type. In our previous example ID was
autoNUMBER type which was assigned automatically by access for we did not select a
primary key.

Yes/No : This field stores only Yes/No values or True/False values. These are logical values.
e.g. if you want to indicate weather a bill is paid or not then you can use this type of field.

OLE object : In this field you can embed objects as pictures , graphs from EXCEL etc. OLE
means Object Linking and Embedding. When you link an object this way any change in the
object form will implement change in the object embedded.

Hyperlink : You can store an internet link in this field so that clicking on the address the
web page on internet is displayed.

Lookup Wizard : It starts a wizard that places lookup contraints on the field. The lookup
values may refer to the table , query or the value you enter.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 8

When we created the above table we opted for 'CR


EATE TABLE IN DESIGN VIEW' . There are
two other methods to create a table.
Create table by using wizard.
Create table by entering data.
CREATE TABLE BY USING WIZARD
The wizard shows you the standard table from which you can choose the required fields. This is not
always suitable but helps you in deciding the fields for your database. However it is very helpful for
both new and advanced developers.

Select fields using this arrow

FIG 1.16
STEP 1 : Double click on the 'Create Table using wizard ' and the 'Table' wizard will popup.
STEP 2: There are 2 categories 'Business' and 'Personal' . you can choose both and view the tables
available. Presently we have selected the 'Personal' category.

FIG 1.17

> arrow.
Add the required fields into 'Fields in new table box' by clicking on
Click next
STEP 3 : Select name for the table or keep the same name. Click next.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 9

FIG 1.18
STEP 4 : Since we do not want to set relation click once more on NEXT button.

FIG 1.19
STEP 5 : Enter data shown as above and more. Close the browser window. Use tab key to move in
the fields.
CREATE TABLE FROM ANOTHER TABLE
If you want to create a table from another table whose structure is same as of the first table you can
use the Copy/Paste commands . By structure we mean what remains of the table when we delete all
the data. i.e. the field names only.
However you have to remember that some of the properties like primary key properties of the
created table may not be the same.

FIG 1.20
You will be asked for the new table name and the same will be shown in the database window. You
can double click on the name to open the table. It is required that the data entry should be done.
This option can be used to copy all data i.e Structure and Data or append the data to the existing
table. i.e Add data of the current table to the existing table.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 10
Use COPY ,
PASTE to create
table with same
structure

FIG 1.21

CREATE TABLE BY ENTERING DATA.


STEP 1 : double click on 'Create Table by enter
ing data ' . (refer step 1 above)

Changing the name


of the column.

FIG 1.22

STEP 2: You will be required to change the field names. Right click on Field1 choose Rename and
rename the field as Rollno. Similarly rename other fields as Name , Address, City , Pin and Dob.

STEP 3 : Close the window and save the table. Name the table 'studentmaster'

FIG 1.24
STEP 4 : Answer YES for primary key. Your table is now saved.
The primary key and other key concept is explained in chapter 4.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002


ENTERING AND EDITING DATA

Rajendra Salokhe
Page 11

You need to perform certain basic operations on the data as


Entering/adding Data
Modifying/ Changing Data
Deleting Data
Inserting a new field
We will see some advanced operations later.

ENTERING DATA :
There are three ways to enter data
1. In Datasheet view
2. Use Edit mode
3. Use Data entry mode.

ENTERING DATA IN DATASHEET VIEW :


We want to enter data into our 'studentmaster' table. We have not set the field types of this table
properly. So open the table in Design view by right clicking on the table name and selecting 'Design
View '.

FIG 1.25
Change the Data Type of rollno field to NUMBER
Change the Data type of DOB field to DATE/TIME.
Change the format of DOB to Medium Date or short date .
Short date has a format dd/mm/yyyy e.g . 19/06/2006 . Medium date has a format 19-JUN2006
------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 12
The date format can be changed to English style by selecting Regional and Language options from
the windows control panel. Select English(U.K.) type there.
Look for this icon in
windows control panel.

FIG 1.26
Right click on the table name and click on 'Open' . The table willpen
o in the data sheet view. This is
similar to Excel worksheet.

FIG 1.27
Similarly complete the table with other values. Note how date is entered.
There is a box at the bottom which is called record selector box, You can navigate the sheet with the
help of various buttons on this box. There are buttons to move on the first record, last record, next
and preceding record.
The record number box
New record button

You can also use the following shortcut keys


Enter or Tab
Shift+Tab
Page up
Page Down
home
Ctrl+Down Arrow
End
Ctrl+End
Ctrl++
Ctrl+F2
Shift+F2

Move to the next field


Move to preceding field
Up one screen
Down one screen
first field in the current record
Go to last record
Last field in the current record
Last field in the last record
Add new record
Delete current record
Insert on/off
Open zoom window

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002


ENTERING DATA USING EDIT MODE :

Rajendra Salokhe
Page 13

FIG 1.28

Click on the New Record button . A new record will be added at the end of the table.
ENTERING DATA USING DATA ENTRY MODE

FIG 1.29

Click on records menu and select 'Data Entry' . Only new added record is shown.
Use tab key to move in the fields.
Our studentmaster table now has the following data. Do not bother about the ID field.

FIG 1.30

DELETING A RECORD

Click here

FIG 1.31

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 14

Click on the record selector column of the record to be deleted.


Click on DELETE RECORD button or simply press the delete button . A confirmation box will
appear. On confirming the record will be deleted.

Right click on the record


selector to get this menu.

FIG 1.32

Or you can Right Click on the record and select 'Delete record ' from the pop
-up.
DELETING MULTIPLE RECORDS
Click the record selector for the first record . Then select a group of records by holding down the
shift key. Press delete when the selection is over.

INSERTING A NEW FIELD


If you have forgotten to add a field or you decide to add a field later on , this can always be done.
Click
on
insert
rows

FIG 1.33

In the design view click on the row selector below which you want to add a new field.
Click on 'Insert Row' button as shown in the above figure.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 15

Blank field is inserted

FIG 1.34
A new blank field will be inserted. Name it address1. Close the windows Now feed data in all
address1 fields by opening the table.

HIDING THE COLUMNS


STEP 1 : Select the column or columns you want to hide.

FIG 1.35
Clicking on the field selector will select
the entire column.
STEP 2 : Right Click on the selected column or choose FORMAT-> Hide Columns menu.
STEP 3 : The column will be hidden.

Select hide
Columns to hide
a column

FIG 1.36

STEP 4 : You can unhide the column from FORMAT-> Unhide columns.
The unhide dialogue box will appear. Check the name of the columns you want to unhide.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 16

Unhide column
dialogue box

FIG 1.37
The ID column will be unhidden.

FREEZING THE COLUMN


Sometimes you want that a particular column should be always shown. Our table is not long enough
to go beyond the screen. If it goes out of the screen then the left most columns will not be shown.
This case you can freeze the column. The process for freezing the column is similar to hiding. You
can right click on the column and choose Freeze.

MOVING THE COLUMN


Moving the column is not necessary always because you can use reports to view the data in any
manner you wish. However for browsing purpose or for editing the data you need that the certain
columns are together. You can move the columns to required position in following way. It is obvious
that the data is also moved.
STEP 1: Select the column by clicking on the name..

FIG 1.38
STEP 2 : With mouse drag the column icon to required place

Drag ->
FIG 1.39

STEP 3 : Release the mouse.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 17

FIG 1.40
In the above example the PHY column has moved to the right of CHEM.

RENAMING THE COLUMN


Sometimes we want that the name of the field should be changed. If you change the name of the field
the data in that field is retained i.e. the data is not lost.
STEP 1 : Select the column by clicking at the column header. Right click on the column.

FIG 1.41

STEP 2: Type PHYSICS as the name. The column name will change to PHYSICS.

REPLACING DATA
Data replacement help you to change a particular occurrence of the data with other value. Supposing
you enter MUM in place of MUMBAI while entering the data then you can change all the
occurrence of MUM with MUMBAI through this replacement method.
The options like Replace all are dangerous as they do not give you an opportunity to correct the
error you make. You have to be doubly sure when you use this option. Finding the next occurance
and replacing is always the safer option

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 18

FIG 1.42

STEP 1 : Select the column in which the data is required to be replaced.


STEP 2 Select REPLACE from EDIT menu.
FIG 1.43

Replacing Pune
with Mumbai

STEP 3 In find and replace box the value Pune is shown. This is to be replaced with Mumbai so type
Mumbai after 'Re
place with'
STEP 4 Click on 'Replaceall' so thatall the occurrences of 'Pune ' will be replaced with 'Mumbai'

STEP 5 Again replace the values to Pune as original.

FIG 1.44

You can also use the wild cart to search field values . Some of the examples are as below
Example
What it matches
Sample find
P*
values starting with P
Patekar , Punekar
*kar
Values ending with kar
Karmarkar , Chiplunkar
D?te
One character for ?
Date , Dite
J[aio]n
One of aio
Jan, Jin , Jon
P[x-z]
Range
Px, Py, Pz
A#
Number in place of #
A1 , A2, A3 etc

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 19

DEFAULT VALUES
Sometime we need that the table field should accept a default value . Which means when we add a
record the field should be filled with this value automatically. We have to specify the default values
in the Table design view.
STEP 1 : Right click on the table name . Choose Design View.
STEP 2: Click in the City field.
STEP 3 : In General Tab (Left down window) . Type Pune in default value.
Any new record you will add will have the default value 'Pune'. You may change it if required.

Default value for a field


FIG 1.45
You can also use VB functions for specifying default values. As DATE() will put current date as
default value in the field.

INPUT MASK
Input masks are useful to display the field values in required formats. Input masks work only on
character and date fields. As you can display PIN as 415-605 with the help of input mask. We have
earlier used a 'Medium Date ' mask for the date field.
Input mask consists of literal display characters as parentheses, periods, and hyphens and mask
characters that specify where data is to be entered as well as what kind of data and how many
characters are allowed.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 20

FIG 1.46

Click here

STEP1 : Open the table 'studentmaster'


in design mode. Click on the PIN field. Click on '...' shown at
Input mask. You can chose the standard mask or design your own. Click on edit-list if you do not
find the masks suitable.

FIG 1.47
STEP2: Click on the add new record button. Which has a symbol as >* . In the Customise input box
wizard.

Input Mask

FIG 1.48

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 21

STEP 3 : Type PIN in the description. '999


-999' as Input mask. '_' as
aceplholder. In sample data
type 415-605. Keep the mask type Text/Unbound. Click on 'Close' . Then select the 'PIN' mask and
click 'FINISH'.
STEP 4: The table studentmaster will use this mask for PIN field.

FIG 1.49
The following characters can be included in the input mask.
Character
0
9
#
L
?
A
a
<
>

Field using
input mask

Function
number from 0 to 9 , no +/- signs
0 to 9 and space
Optional number, space and +/- sign
Letter required A-Z
optional letter
letter or number
optional letter or number
character gets converted to lowercase
character gets converted to upper case e.g >LL

Let us take a break here and do some exercise.

------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

EXERCISE

Rajendra Salokhe
Page 22

Exercise 1 : Create a table (Employee Table) with following fields . Enter values and print report.
EmployeeNo
BasicSalary
DA
GrossSalary
Deductions
NetSalary
NetSalary will be calculated as GrossSalary - Deductions
Question 1: How can you create a new table?
Question 2 : How do you rename the field ?
Question 3: How can you add a new field to existing table ?
Quetion 3: What are the various field types ?
Question 4 : How can you replace data in the table ?
Question 5 : What are input masks ?
Question 6 : What are default values ?
Question 7 : How can you delete a record ?

FOR COMPLETE BOOK CONTACT US THROUGH OUR WEBSITE

http://www.geocities.com/arutacomp/
or

[email protected]
other books :
AutoCAD 2007
Visual Basic 6
------------------------------------------------------------------------------------------------------------

ACCESS TO ACCESS 2002

Rajendra Salokhe
Page 23

------------------------------------------------------------------------------------------------------------

You might also like