Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Ms-Access Notes

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

Microsoft Access

MICROSOFT ACCESS
Database Management
A database is a collection of any related information/data that is stored together under
one logical structure. It is a collection of information related to a particular subject or
purpose (people, items, places, events etc); such as tracking customer orders or
maintaining a music collection. Examples include - Telephone directory, Flight-
schedules, Employees records, Stock inventories, Customer details, Class register, a
price list, etc.
A database management system (DBMS) is a tool or a program that allows one to
create, maintain, update and store the data within a database. Examples of DBMS
programs include:-
i) Ms-Access
ii) FoxPro
iii) Dbase III Plus
iv) Dbase IV
v) Dbase V
vi) Oracle
vii) Lotus Approach
viii) Visual Basic

Microsoft Access can be installed as a stand-alone program but it is mainly found within
the Ms-Office suite. It is very useful for routine and simple database management tasks
but it has a limit to the maximum number of records it can comfortably deal with. For
performing intensive database management you need powerful and advanced software
such as: Oracle or SQL server (used by K.P.L.C.).
These powerful programs allow simultaneous database entry and can accept up to 2
million new records daily.
Dbase and FoxPro were the biggest competition for Access in 1980’s and 90’s. The
Microsoft Company owns FoxPro and this has pushed Access into the position of
DBMS.
Ms-Access is commonly used because of its multiple tables and database objects like
queries, forms, reports, macros, modules etc that can be created within a database file.

Advantages of DBMS
You can link many database tables and source data from these tables.
With modern equipment there is easy recording of data.
There is first retrieval of stored information.
It is easy to maintain the database.
It is easy to analyze stored information and to prepare summary reports and charts.

Types of Databases
1. Hierarchical: - Records are stored in multiple levels, units further down the system
are subordinate to the ones above (in a tree-like structure). In most cases
hierarchical database uses arrows to connect data at different levels.

Compiled By Mbugua Maina1


Microsoft Access

2. Relational Database: - Data elements are stored in a tabular format, in rows and
columns. Each column represents a field and each row represents a record.

The records are grouped under fields. Each field/column must have a title/fieldname.
This type of database is flexible and easy to understand.

Definitions
Table:- It is a collection of related data organized in rows and columns.
Field:- Single unit of information within one column in a table.
Fieldname:- It is a column heading/title or a label for a field.
Records:- A set of all fields within one row in a table.
Database file:- A collection of all tables and objects (queries, forms, reports etc) used
to manage data.

Designing a database
Before you create a database file, you need to decide on certain factors:
Determine the purpose of the database file.
Determine the type of tables that you may need.
Determine the fields that you may want to use.
Determine the type of objects you need in the database.

Creating a database file


Syntax:-
1. Start Access - Start button, Programs, Ms-Access, or double click the Ms-Access
icon on the desktop.
The Microsoft Access Start-up dialog box then appears.
This dialog box contains three options namely:
Blank Database – used to create a new database file from the scratch.
Database Wizard – used to create a new database file from a wizard.
Open an Existing Database – used to retrieve/open an existing database file.

Creating a file using Blank database


1. Select Blank Database and click OK.
2. Specify the drive and type a name for the database file
3. Click Create
All Access database files are saved with an automatic extension of MDB.
The Database objects window then appears. This window displays all the possible
objects that can be created within a database file namely:
i) Tables- a collection of related data stored in rows and columns
ii) Queries – a group of records that have been filtered from a table
iii) Forms – used to give records a more presentable outlook
iv) Reports – a summary of records in a table or in a query
v) Macros - A macro is a set of one or more actions that each perform a particular
operation, such as opening a form or printing a report. Macros can help you to

Compiled By Mbugua Maina2


Microsoft Access

automate common tasks. For example, you can run a macro that prints a report
when a user clicks a command button.
vi) Modules – A small part of a program
At this point you can then click on the tab that has the Object you want to create and
follow the instructions provided in the resultant dialog box.

Creating a new table


i) From the objects window click on Tables.
ii) Click on New
iii) From the next dialog box choose Design View and click Ok.
Access then takes you to the design window of your table. This view lets you create
the structure of your table by specifying the following items:
• Fieldname – This is the column title. It is compulsory and can use a maximum
of 64 characters including spaces (some symbols are not acceptable).
• Data type – This specifies the kind of data you will enter in that column e.g. Text,
Number, Date/Time, Currency etc. It is compulsory and the default one is Text.
• Description – This is optional. It can be any text that describes the entries of
the field and it will be displayed in the Status bar when you will be entering
records within that field in your table.
• Field properties – This is optional. It is any information you can put to describe
the field and will be displayed on the Status bar whenever you are working in that
particular column within the table in datasheet view.
Type the field names one by one as you select the data types appropriately.
Select Save from File menu or click the Save button to save the table structure
permanently.
Specify the table name within the next dialog box and click OK.
Another dialogue box then appears asking you for a primary key.
Click No to continue.
A Primary Key is a field that uniquely identifies each record within a table (this is
discussed later.)
Choose Datasheet View from View menu or click the View button on the left edge of
the toolbar and choose Datasheet View. This will take you to a form where you can
now enter records within the table.
Type the records appropriately in your table and use the tab key, arrow keys or the
pointer to move from one field/record to another.
As you type a record, a new row is automatically added at the bottom of the table for a
new record
After the end of each record the update is automatically saved, but you can as well click
the Save button on the toolbar or choose Save from file menu to save the changes.

DATA TYPES
The data type determines the kind of data that a user can put in a field. Each data item
that you put into your database must fall within one of the following categories:
Text:- (Default) Alphabetical characters, symbols or combinations of text and numbers,
as well as numbers that don't require calculations, such as phone numbers. It can take

Compiled By Mbugua Maina3


Microsoft Access

up to a maximum of 255 characters or the length set by the Field Size property,
whichever is less.
Numbers:- This only includes numeric digits - 0-9
Date/Time:- Allows one to enter a date or time depending on the formats chosen.
YES/NO:- Allows one to choose a true or false state e.g. (Married? - (either Yes or No))
Memo:- The same as Text but allows one to enter large blocks of text up to a maximum
of 65,535 characters. Any data put in the memo field cannot be viewed directly from the
datasheet view.
Currency:- Allows one to enter number then it automatically displays the numbers with
the default currency symbol as a prefix or suffix.
Auto Number:- Automatically numbers the records in the table. It puts automatic
numbers at the beginning of each record as you enter them one by one.
Hyperlink:- This links the fields to another table within the same database or in a
different database.
OLE Object:- Allows one to bring data and files from another program into the current
field. (Object Linking and Embedding).

EDITING PARTS OF A TABLE


Selecting different parts:
From Datasheet view, click the row or column header to select a row or a column.
Click the button at the top-left corner of the table to select the whole table at once.

Renaming a column
From design view:
- Select the field you want to rename, delete its name and type a new one then save
the table.
From Datasheet View:
- Double click the fieldname and type a new one, or
- Select the field, choose Rename column from Format menu and type a new name.
- Right-click the field name, choose Rename column and type a new name.

Deleting rows/records and Columns


Records can only be deleted from datasheet view while columns/fields can be deleted
both from design view and from datasheet view.
Deleting records:
- Select the record(s) in datasheet view, press the delete key or choose Delete
Record from Edit menu, then choose Yes to confirm.
Deleting fields from Design view:
- Select the filed(s) you want to delete (as rows), press the delete key or choose
Delete Rows from Edit menu, then choose Yes to confirm.
Deleting fields from Datasheet view:
From this view you can only delete one field/column at a time.
- Select the filed/column you want to delete, choose Delete Column from Edit menu,
then choose Yes to confirm.

Compiled By Mbugua Maina4


Microsoft Access

Inserting Fields/Column
Column/fields can be inserted both from Design and from Datasheet view.
From Design view:
In this view you can insert the new field anywhere within the table, e.g. at the end or in
between the existing fields.
Position the cursor anywhere, choose Rows from Insert menu and type the name for the
new field, or put the cursor at the bottom of the last field and type the name for the new
filed.
From Datasheet View:
In this view you cannot insert a new column at the end of the table and there is no way
of choosing your own data type unless you go back to design view.
Put the cursor where you want the new column to appear, choose Column from Insert
menu then double-click the default fieldname to type the correct name

Resizing Rows and Columns


At default all the columns/rows will have uniform widths and heights respectively.
Row heights will change automatically as you size your text and they will always have
the same height.
You may need to change column widths if you have got long lines of text to type within a
column.
Position the cursor at the right border of the column you want to affect (within the
fieldname area), or at the bottom border of any row and drag to size it.
Select the row/column you want to affect, choose Row Height or Column Width
respectively from Format menu, specify the measurement and click Ok.
NB: The changes you make to one row will affect all the other rows the same way.

Hiding a Column:
This is the process of removing a column from view without deleting it. You may want to
hide a column for two reasons; Prevent anybody from accessing its information or to
reduce the size of a database table for viewing or printing specific columns only.
Select the column(s) you want to hide and choose Hide Column from Format menu, or
right-click the column and choose Hide Columns from the displayed list.

Unhiding a column
This is the process of bringing back/displaying a hidden column.
Choose Unhide Column from, click all the columns that are hidden one by one and click
Close.

Freezing Columns:
This is the process of locking or making a column stationary so that it doesn’t move
during scrolling. If there are too many columns in a datasheet table, you can freeze the
first column(s) so that they don’t move when scrolling through the screen. When a
column is freezed it stays at the left-most position while the rest of the columns continue
to move/scroll in and out of view.

Compiled By Mbugua Maina5


Microsoft Access

- Select the column, move to Format menu and select Freeze Columns, or right-click
the column and choose Freeze columns from the displayed menu.

To Unfreeze the column, move to Format menu and select Unfreeze All Columns.
You can then drag the unfrozen column back to its previous location.

SORTING:
This is the process of arranging records in a logical order, either in ascending or
descending order; Alphabetically, Chronologically, or Numerically.
The field you sort your records on is given the first priority in the arrangement of the
records.
- Select or position the cursor in the field to be sorted on.
- Click the Sort Ascending or Sort Descending button on the Standard toolbar, or
go to Records menu, select Sort, then choose either Ascending or Descending.

SEARCHING A DATABASE:
Access allows one to search for a string of characters within an entire database. This is
not a field or a record sensitive search. You can also find and replace data within a
table.
Finding Data:
- Select Find from Edit menu or press Ctrl + F or click the Find button on the Standard
toolbar.
- In the next dialog box, type the text to look for, choose any desired option and then
click Find First. To continue finding other occurrences of the same text, click Find
Next.
Replacing Data:
- Select Replace from Edit menu or press Ctrl +H.
- In the next dialog box, type the text to look for, type the replacement, choose the
necessary options and click Find Next.
- Click Replace to change the occurrences one by one, or lick Replace All to change
all the occurrences at once.

MOVING TO SPECIFIC RECORDS WITHIN A TABLE


There are several ways of moving to specific records within a table e.g. by using:
- The Go To command under Edit menu
- The ‘go to’ shortcut buttons on the left edge of the horizontal scrollbar at the bottom
of the table.
- Clicking the record with the mouse pointer
The active record will have its number displayed at the bottom of the table

FORMATTING A TABLE
You can apply formatting features to the whole table at once. These features include:
Font, Colour, Size, Bold, Italic, Underline, Cell Outline, Cell Colour, Cell effects, etc.
All these can be applied from the Formatting toolbar or from the Format menu.
NB:

Compiled By Mbugua Maina6


Microsoft Access

Any formats applied to the table will affect the whole table the same way i.e. you cannot apply
different formats for different fields or records.

Spell-checking a table
- Select the Spelling command from the Tools menu or press F7 key.
- Use the options inside the resultant dialog box to correct spelling mistakes if any.

SETTING UP THE PAGE


This involves setting the Margins, the Page Size and the Page Orientation.
You can change the Page setup for your table to affect the way it will print.
Move to file menu and select Page Setup.
The next dialogue box has two tabs - Margins and Page.
Page: - This allows you to change the orientation and the size of the page.
Margins: - Allows you to set your page margins. When ‘Print Headings’ is selected
under Margins, the name of the table and the current date are automatically printed as
the Page Header while the page numbers are automatically printed as the Page Footer.

PRINTING
You need to preview you table before printing it to make sure that everything is well
displayed. Use the Print Preview command under File menu, or the Print preview
button on the Standard toolbar.
To print a table;
Select the Print command from File menu or press Ctrl + P.
The print dialogue box has the following options:
Printer:- Allows one to change the type/name of printer
Print Range:- Allows you to specify specific pages or parts of the table to be printed.
Copies:- Specifies the number of duplicates to be printed (produced.)
Collate – specifies the order of printing incase of you are printing multiple pages and
multiple number of copies.
Print to file:- Allows one to save the file such that it can be printed using Ms-Dos.
When the command is selected and you click Ok, Access will ask you to enter a
filename(i.e. it is not printed directly on the printer). The name is given an automatic
extension of PRN (printer file). The printer file can then be printed form any computer
having Ms-Dos by using the print command.
E.g. C:\>Copy A:Table.prn>PRN or A:\>Print Table.prn>PRN

PRIMARY KEY
This is a field that uniquely identifies each record in the database table, just like a
number-plate uniquely identifies each car on the road. Examples of Key fields include:-
Identification numbers, Registration numbers, User codes, Admission numbers etc.
When you are setting a field as a primary key, make sure it is a field where no two
records can share the same information.

Effects of a Primary Key field:


Access will make sure that no two records have the same value/text within that field.

Compiled By Mbugua Maina7


Microsoft Access

All the records will be automatically sorted by the entries of the primary key fields in the
Ascending order.
The primary key field cannot be left empty whenever you are typing new records in the
table.
Make sure you set the primary key before typing any records in the table.
If you don’t set the primary key yourself, whenever you are saving a new table, Access
will ask you if you want a primary key. If you choose No, the table will be saved without
a primary key but if you choose Yes, Access will automatically insert a new field by the
name ID as the primary key and insert AutoNumber as the data type.

To set a field as Primary key:-


- Open the table in design view
- Click on the field you want to use as primary key
- Click the Primary key button on the standard toolbar or select Primary key from Edit
menu.
Note:- You can also remove the primary key by deselecting that command.

FILTERING
Filtering refers to sieving out particular records from the database. The records you
sieve out can be printed, deleted or edited separately. There are three types of filters in
Access.
Filter by Selection:- This filter allows you to choose a criteria/condition for sieving out
records by selecting them directly from the table in datasheet view.
Steps:
- Open the table in datasheet view
- Highlight the cell that contains the criteria that you need e.g. Under First Name,
highlight Philip.
- Move to Records menu, select Filter, then Filter by Selection or select the Filter
by Selection button on the Standard toolbar.
Access displays all the records that meet the criteria e.g. all people in the database
whose first names are Philip.
- To remove the filter and get back the original table, move to Records menu
and select Remove Filter/Sort, or click the Remove Filter button on the
Standard toolbar
You can also use the following methods:
- Select the first character of a name to find all names that begin with that character.
- Select the last character of a name to find all names that end in that character.
- Select any character inside a name to find all names that contain that character.
- Click twice inside a Yes/No field find True of False respectively
Note:- You can use Filter Excluding selection from the same menu to sieve out all the
records that do not meet the selected condition.

Filter by Form:
This filter opens up a form where you can give more elaborate criteria.
Open the table

Compiled By Mbugua Maina8


Microsoft Access

Move to Records menu, select Filter, then Filter by Form, or click the Filter by Form
button on the Standard toolbar.
A form will appear where you can type in or choose the criteria you want
Choose Clear Grid from Edit menu to remove any condition that might have been used
previously
Type you condition within the appropriate field e.g. to list all people called Philip, click
under Firstname, then type in ‘Philip’- or click inside that field and choose it from the
dropdown list.
Choose Apply Filter/Sort from Filter menu or click on the Apply Filter button on the
Standard toolbar.
Choose Remove Filter/Sort from Records menu to recover the original table.
The following can also be used:
Fname Lname
Peterson Kirui It will look for a person called Peterson Kamau.
Names
K* Will filter all records of people whose names begin with K.
*E* Will filter all records of people whose names contain letter E.
*A Will filter all records of people whose names end with letter A.
Age
>18 It will display all people with age of above 18.
Between 25 and 30It will display records of all people aged between 25 and 30.
>=25 and <=30 It will display records of all people aged between 25 and 30
Country
In(Uganda, Kenya) Displays people from Uganda or Kenya
Uganda or Kenya Displays people from Uganda or Kenya
Date
>74/10/31 It displays all records on the specified date and after it
Between 90/10/31 and 95/7/1 Displays records between the indicated dates.
Awards
Is Null Displays all records given the award ‘Null’.
Is Not Null Displays records that don’t have the award Null.
Sports
Like *ball Displays all records with all sorts of ball games.
Not Football Displays all records of people who don’t play football.
Date of Birth
Date ( )-30 Displays all records of people born 30 days ago.
Between Date ( ) and Date ( ) – 30 All records of people born within the last 30
days.
You can also combine more than one condition.

Advanced Filter/Sort
The above filter allows one to sort and filter records at the same time.
Open the table
Move to Records menu, select Filter then Advanced Filter/Sort

Compiled By Mbugua Maina9


Microsoft Access

Access will take you to QBE grid, from this grid you have a field list in the top half and
the grid table.
The grid table allows one to choose fields for sorting/filtering.
 Double click the field from the field list or click once in the Field Name row within the
grid and select the field name from the dropdown list.
 Type your condition within the Criteria row under the correct field
 Choose the sorting order, if any, within the Sort row under the correct field.
Choose Apply Filter/Sort from Filter menu or click on the Apply Filter button on the
Standard toolbar.
Choose Remove Filter/Sort from Records menu to recover the original table.
You can insert as many fields as you may want to sort on or specify criteria in.
You can also combine several conditions using AND or using OR;
To combine with AND, type the conditions within the same row but under the correct
field names.
To combine with OR, type the conditions in different rows but under the correct
fieldnames.
NB: For a YES/NO field you can use NO/OFF/FALSE/0 for a false condition and
YES/ON/TRUE/-1 for a true condition.
The criteria that was previously used stays in effect until you delete it from the QBE grid
so remember to choose Clear Grid from Edit menu every time you want a new criteria.

RENAMING, DELETING AND COPYING & MOVING A TABLE


One can use the keyboard, Edit menu, the shortcut buttons, or THE right clicking
method to quickly rename, erase, reproduce or move tables and/or data from one file to
another.

Renaming a table:
 Open the database file
 Select the table name
 Click the table name, or right-click the table name, or choose Rename from Edit
menu within the Objects window
 Type in the new name and click anywhere outside that name

Deleting a table
 Open the database file
 Select the table name
 Press Delete key, or choose Delete from Edit , or right-click the table name and
choose Delete.
 Click yes to confirm

Moving a table
 Select the table name
 Choose Cut from Edit menu, or click the Cut button on the Standard toolbar, or right-
click the table name and choose Cut from the displayed menu.
 Close the file

Compiled By Mbugua Maina10


Microsoft Access

 Open the file you want to move the table to


 Choose Paste from Edit menu, or click the Paste button on the Standard toolbar.
 In the next dialog box, type the table name, choose ‘Structure and Data’ then click
Ok.

Copying a table
A table can be copied within the same file or to a different file. If you copying a table
within the same file, the copy must be given a different name but if you are copying a
table to a different file, you can use the same name or change the name.
Copying within the same file
 Select the table name
 Choose Copy from Edit menu, or click the Copy button on the Standard toolbar, or
right-click the table name and choose Copy from the displayed menu, or press
Ctrl+C
 Choose Paste from Edit menu, or click the Paste button on the Standard toolbar.
 In the next dialog box, type a new name, choose ‘Structure and Data’ then click Ok.
Copying to a different file
 Select the table name
 Choose Copy from Edit menu, or click the Copy button on the Standard toolbar, or
right-click the table name and choose Copy from the displayed menu.
 Close the file
 Open the file you want to copy the table to
 Choose Paste from Edit menu, or click the Paste button on the Standard toolbar.
 In the next dialog box, type the table name, choose ‘Structure and Data’ then click
Ok.

Paste Options
There are three options that appear within the Paste dialog box whenever you are
copying or moving tables namely:
i) Structure Only – This copies/moves the structure of the table (Fieldnames) only
ii) Structure and Data – This copies/moves the structure and data (fieldnames and
records).
iii) Append Data to Existing Table – This copies/appends only the records to an
existing table with similar fieldnames. Type the name of the existing table within the
Table name box

IMPORTING AND EXPORTING DATA


This is the process of copying data from other programs into Access and copying data
from Access into other programs. Access will only accept data from programs that
support database management e.g. Dbase, Excel, Foxpro etc.
Importing and Linking Data
Access allows you to bring in data from other programs into the database file. Once the
data is imported it is stored as a table. The Import command creates a copy of the

Compiled By Mbugua Maina11


Microsoft Access

original file as an independent entity. I.e. Once you import, the new imported table will
have nothing to do with its source.
When you link tables/data, Access maintains a connection between the source and the
new table. Any changes you make to the source will be reflected in the new table and
some properties of the table cannot be changed from Access but only from the original
table/data. I.e. the linked table remains dependent on the original data.

Importing data from an Excel Worksheet


Make sure you know the filename, its location and the worksheet that contains the data
you want to import.
The data must be arranged in the correct format of a database and should be the only
information within that worksheet.
 Open the database file in Access
 Click on the Tables button
 Select Get External data-Import from File menu, or click the New button on the right
edge and choose Import Table from the next dialog box.
 In the Import dialog box that appears, Select the type of files under ‘ Files of type’
e.g. Microsoft Excel, choose the location (drive or folder) under ‘Look In’ and select
the filename from the displayed list of files.
 Click on Import
 Within the Import wizard that appears, answer the questions correctly one by one as
you click on Next to move to the next step until you finish.
E.g.
 Choose the worksheet that contains the data and click Next
 Choose ‘First Row Contains Column Headings’ and click Next
 Choose ‘In a New Table’ and click Next.
 Specify the field options e.g. change any fieldnames if necessary & choose ‘Do not
Import field’ if there is any field you want to skip (otherwise don’t change anything)
and click Next.
 Specify whether on not to have a primary key and click Next
 Type the table name and click Finish.
 Click Ok to complete the import
The imported worksheet will appear as an independent Access table.

Linking a table/data
 Open the database file in Access
 Click on the Tables button
 Select Get External data-Link Tables from File menu, or click the New button on the
right edge and choose Link Table from the next dialog box.
 In the Link dialog box that appears, Select the type of files under ‘Files of type’ e.g.
Microsoft Excel, choose the location (drive or folder) under ‘Look In’ and select the
filename from the displayed list of files.
 Click on Link
 Within the Link wizard that appears, answer the questions correctly one by one as
you click on Next to move to the next step until you finish.
E.g.

Compiled By Mbugua Maina12


Microsoft Access

 Choose the worksheet that contains the data and click Next
 Choose ‘First Row Contains Column Headings’ and click Next
 Type the table name and click Finish.
 Click Ok to complete the link
The linked worksheet/data will maintain the icon of Excel.
EXPORTING DATA
 Open the database file in Access
 Select the table you want to export and choose Save As/Export from File menu, or
right-click the table and choose Save As/Export from the displayed menu.
 Choose ‘To an External File or Database’ within the next dialog box and click Ok.
 In the Save Table dialog box that appears, Select the type of files under ‘Save as
type’ e.g. Microsoft Excel 97, choose the location (drive or folder) under ‘Look In’
and select the name of the file you want to export the table to.
 Click on Export
The exported table appears in Excel as anew worksheet within the file it has been
exported to.

Creating a table using Wizards


Open the database file and click on the Tables button
From the database window click on New
Select Table Wizard and click Ok.
Answer the questions provided by the wizard correctly as you click Next until you finish
creating the table.
E.g.
 Under ‘Sample Tables’, choose the sample table that is related to the information
you want to keep within your table
 Under ‘Sample Fields’, select all the fields you want to include in your table one by
one. (You can even choose fields from more than one table)
NB: Remember to choose one field with the name of ID to use as your primary key
since a primary key is compulsory here.
 Click Next
 Choose ‘Yes, set a primary key for me’ and click Next
 In the next dialog box don’t change anything unless it is necessary, just click Next.
 In the next dialog box, choose ‘Modify the table design’ or ‘Enter data directly
into the table and lick Finish.
You can then change any fieldnames and data types before you start typing records in
your table.

FIELD PROPERTIES
These are some effects/features or conditions you can apply to different data types to
control the data that can be entered within specific fields.
Most of them should be specified before you type any records within the table but some
of them can still be changed even after keeping records in a table.
Different data types have different field properties. They are all specified within the
Design view of a table. The tables design view is divided into two parts:

Compiled By Mbugua Maina13


Microsoft Access

The upper part is used for typing field names, specifying data types and putting field
description if any.
The lower part is used for displaying and assigning field properties to selected fields.
Each data type has a different set of properties.
You have to position the cursor within the field you want to affect.
These properties include:
Caption:- This lets you define/type an alternative fieldname to be used in datasheet
view and as labels in tables, forms and reports. They provide a neat and descriptive
name since the fieldname should be kept small for practical use.
Format:- This allows you to determine the way data appears in a field. The formats
include Currency, Fixed, General, Percent, Scientific, General data, Medium date,
Medium time. E.g.
You can change the date or time format to affect the way dates and time will be
displayed within the table.
You can also choose Fixed format for numbers then specify the number of decimal
places to appear automatically next to the numbers as you type them.
Decimal places:- It is used to define an automatic number of decimal places to appear
in values. The option will only work on value fields that already have the Fixed format.
Default Value:- Lets you define a value/label that will automatically be inserted in the
field as you add new records. If it is a label, it must be enclosed in double quotes.
E.g. You could use it in an Address field to insert the text “P.O. Box” automatically as
you enter records within the Address field
The default value affects only new records inserted after setting it.
Field Size:- Lets you specify the maximum number of characters you can type within a
field. It only works for text and number fields. The sizes available for numeric fields
are; Byte (range 0 to 25), Integer (range 32768 to +32768), Long integer (range -
2,147,483 to +2, 147,482). The default for a text field is 50 and the maximum you can
set is 255 characters. It must set before typing records within the table.
Input Mask:- Lets you define a pre-formatted pattern for the entry of data into a date or
a text field. The data in that field must conform to the specified pattern. It works almost
like the filed size property but it uses a pattern instead of a number and when both of
them are used it is given the first priority.
It uses letter a/A (small or capital) to represent the number of characters you can enter
in a field.
A small a specifies the maximum number of characters you can enter in a field while a
capital A specifies the exact number of characters that must be entered within that field.
A greater than symbol > at the beginning of the pattern converts the text to capital
letters while a less than symbol< converts all the entries in that field to small letters.
Examples of patterns include: -
0#/0#/0# - This forces a two-digits entries for the year, month and date in a date field.
AAAAAA – You must type six characters in that field.
aaaaaa:- You can type six or less characters in that field.
A and a:- Act as place holders; i.e. They control the number of characters entered into a
field.
>aaaaa:- All the text will appear in capital letters but they can be five characters or less.
>AAAAA:- All the text will appear in capital letters and they must be five characters.

Compiled By Mbugua Maina14


Microsoft Access

<aaaaa:- All the text will appear in small letters but they can be five characters or less.
<AAAAA:- All the text will appear in small letters and they must be five characters.

> &< symbols work hand in hand with the ‘A’ and ‘a’ place holders i.e. they can’t work
on their own.
Required:- This can be set to Yes or No. When this option is on (YES) an entry must be
made within that field and vice versa i.e. that field cannot be left blank when entering
records.
Validation Rule:- Lets you create an expression/formula that test data as it is entered
into the field. It automatically rejects faulty entries e.g. entering very large or very small
figures in the Age or Salary fields.
E.g. To limit an age field from 18 to 55 type Between 18 and 55, or >=15 and <=55
An error message will then appear any time you enter a value prohibited by that rule.
>=Date( ):- Will allow entries whose dates are the current date or later.
<=Date( ):- Will allow the current date or before
Country:-
>Kenya:- Allows entry for any country starting with K to Z
Validation Text:- This is the error text/message that will be displayed when the
validation rule is broken. It allows one to type an alternative error message that will
appear whenever you enter a value prohibited by the validation rule above. You can put
in a useful message that can be clearly understood by the input clerk e.g. wrong value.
Indexed: - Indexing is the process of arranging records alphabetically, numerically or
chronologically in the ascending order only.
This property can be set to three different options namely:
No – Use this if you don’t want your records to be sorted on this field.
Yes (Duplicate Ok)- Automatically sorts the records on that field in the ascending order
and allows duplicates.
Yes (No Duplicates) - Automatically sorts the records on that field in the ascending
order but does not allow duplicates.

QUERRIES
A query is simply a group of records that have been filtered from an original table and
stored separately but still dependent on the table.
You use queries to view, change, and analyze data in different ways. You can also use
them as the source of records for forms and reports.
By using a query, you can narrow down your database table and sieve out specific
information for printing, viewing, editing or saving.
A query can be used to:
i) Bring together data from multiple tables and sort it in a particular order
ii) Perform calculations on groups of records
iii) Create a new field for combining the contents of several fields together and even
to add new labels/data to the contents of existing fields
iv) Calculate a sum, count or another type of total and then group the results by two
types of information – one down the left side of the datasheet and another one
across the top i.e. it can create a brief summary of records (totals query)

Compiled By Mbugua Maina15


Microsoft Access

There are three main types of queries:


i) Select Query
ii) Cross tab Query
iii) Action Queries (Delete, Make-table, Append & Update)

SELECT QUERIES
It is a passive query that lists information in a table calling to certain field or criteria.
They are similar to filters but:-
Can allow you to choose a field to show or hide
Allows one to create calculated fields
Allows you to query more than one table at a time (join tables).
Allows one to create a totals query for a summary

To create a select query:-


- Open the database window
- Click on the Query tab, then select New
- From the new query dialog box, click Design view then click on Ok.
- From the Show table window/dialogue box, specify the table(s)/queries that you
want to use in the new query.
- Click on the table & then click on Add or just double click the table name.
When you click on ‘Add’ you will be taken to QBE grid. The grid is divided into two:-
The first half of the grid displays the table you have added (Table area). You can add
tables to the table area by selecting Show table from the Query menu.
To get rid of the table, click on its title bar then click Delete from Edit menu or press
delete key.
The second part of QBE grid is for one to specify the fields to be displayed, sort order
for those fields and the criteria to be used.
To add a field into the table area into the grid, click on it and drag it to the field area or
double click it, or click in the field box and choose the field from the dropdown list.
To clear the whole grid, select ‘Clear grid’ from Edit menu.
Once you have specified criteria and fields for your query, you can view the record-set
( a view of records sieved through query an displayed in datasheet view) by choosing
Datasheet view from View menu, or by clicking the Run button on the standard toolbar,
or by choosing the Run command from Query menu..

CREATING NEW FIELDS IN A QUERY


Assuming that the table has Test1, Test2, you can simulate a field that can contain the
average or the sum of the two fields.
Type the following under field: Average:([Test1]+[Test2])/2 or Total:[Test1[+[Test2]
Average and Total will be the names of the new fields displayed in the database view of
the query.
All fields used in the expressions/formulas must be enclosed in square brackets and
any new text/label added to the field contents must be enclosed in double quotes.
E.g. Assuming that the table has FName and LName fields, you can create a new field
called Full Names that will combine FNames and LNames together as follows:

Compiled By Mbugua Maina16


Microsoft Access

Full Names:[FName] & “ ” & [LName]


A space is also considered as a new label and it must be enclosed in double quotes.
Likewise you can create a new field called Customer Name that combines the title
“Mr/Mrs.” as a new label with the FNames and LNames together as follows:
Customer Name: “Mr/Mrs.” & [Fname] & “ ” & [Lname].
When joining characters you can either use the & symbol or the + symbol.

Combining Tables
You can combine tables from the same database provided that the tables have a
common field.
The common field should have the same name, data type and information arranged in
the same order.
E.g. If the common field is Names, it must appear in both tables and its contents must
all be similar and arranged the same way in both tables.
- From the database window, choose Query tab
- Click on New then Design view
- From the Show table dialog box, select all the tables you want to join one by one as
you click on Add and then click Close.
- In the QBE grid, both/all tables should appear in the table area.
- Click on the common field from one table and drag to the common field of the other
table. A link line appears between the two.
If you right click this line, you can delete the join or you can change the join properties.
- Once the tables are joined, insert the fields into the gird as usual.
You will able to choose fields from both tables and arrange them, as you desire.
The common field should only be selected once since its contents are similar in both
tables.
You can as well specify any criteria and any sorting order.

SETTING CRITERIA PARAMETERS


Instead of changing criteria every time you need a new list e.g. you want a list of
Kenyans, Rwandese, Ugandans, you can set parameters in your query instead of
specific values/text. The parameter acts as a placeholder for the condition/entries you
intend to make when you run the query.
This relieves you from the task of creating so many queries if the conditions are falling
under the same field i.e. instead of creating a query for each country, you can create
one query that will give you different countries at different times.
A criteria parameter makes a query more flexible since it is not limited to one condition
only. You will be required to type your condition every time you open or run the query.
To create a parameter:-
- Create the query omitting criteria.
- Click on the criteria cell of the field you want to search e.g. Country
- In place of the data you are searching for, type the parameter in square brackets. It
is best recorded as a question e.g. [Which country do you want?], or [Enter country],
etc. You can enter multiple parameters if you want to.
- Choose parameters from the Query menu to open the parameter box.

Compiled By Mbugua Maina17


Microsoft Access

- Type the first parameter exactly as you have entered it in the criteria cell except
without square brackets e.g. which country do you want?
- In the next column choose the data type for the parameter according to the filed you
are using e.g. Text. It should match the data type of the field where the criteria is.
- Repeat steps 4 & 5 for other parameters, if any.
When you run your query, the same text will appear and you will type your condition
within the provided area.

Using a Total query to summarizing Records


Within the design view of a query, you can use the Totals button to mathematically
summarize and group data in the table.
When you click the Totals button, Access inserts the totals row in the QBE grid.
GROUP BY: - Will be displayed in each column/field that you have in your Query.
Therefore only insert fields that you want to use for unique grouping e.g. By Country,
grade, age, Sex, etc.
Choose one of the Summary options in the Totals cell for the value field you may want
to summarize. Summary options include:-
Sum Count Max Avg. Min Fist Last
Run Query to view the Summary.
Note: In the QBE grid, you should only have the fields you want for summary purposes.

CROSS TAB QUERIES


This is a query that groups data into categories and displays values in a spreadsheet-
like format. You can use summary totals to compare values and to see trends in the
data e.g. Monthly, Quarterly, Yearly sales in a production table.
You cross-tabulate data in rows by column fashion. The cross tab query can be used to
answer a question like; Which customer bought how many of which product.
It allows a user to group on at least two fields and then perform calculations on one
value field.
One of the fields for grouping becomes the Row Heading while the other one becomes
the Column Heading.

Steps:
- In Query design view, choose the table you want to use in your cross tabs.
- Choose Crosstab Query from the Query menu or from the Query Type button.
- Choose the two fields you want to group on, one by one e.g. Country and City
- Choose the Value field that you want to calculate
- On the Total row, select what you want to calculate under the Value field e.g. Sum,
Average, Max, Min, Count etc.
- Under Crosstab row, specify the Row Heading and the Column Heading under the
two fields for grouping appropriately and under the value field, choose Value.
- Run your query to view the summary.

NB: You can use more than one Row Heading but there should only be one
Column Heading and one Value field.

Compiled By Mbugua Maina18


Microsoft Access

ACTION QUERY
These are queries that make changes to many records in just one operation. There are
four types of Action queries namely:-
Delete Query
Update Query
Make Table Query
Append Query
These queries don’t need to be saved because after they are run, the changes are
permanently made within the tables.

Delete Query
Deletes a group of records from one or more tables at once. E.g. you could use a
delete query to remove products that are discontinued or for which there are no orders.
It is faster to use a delete query than to delete each record separately.
Syntax:
- Create a new query that contains the table from which you want to delete records.
- Click on Query type button on the standard toolbar and then select Delete Query, or
choose it from Query menu.
The delete row is then added to the grid.
- From the table which you want to delete records, drag the (*) asterisk from the field
list to the query design grid (put it inside the first column under field.)
The word “From” appears in the delete cell, this indicates that the values/records
deleted will be from the table specified.
- In the next column, specify the fieldname and the criteria for the records to be
deleted.
“Where” appears in the delete cell within that column.
- Choose Datasheet View from View menu to view the records that will be deleted
first to ensure that you are not deleting the wrong records.
- Change back to Design view
- Run the Query.
A warning/confirmation message then appears.
- Click on “YES” to complete the action.
You don’t need to save the query since after running it the changes are permanently
made within the table.
You have to open the table to view the changes that have been made.

Update Query
This query makes global changes to a group of records in one or more tables. E.g. you
can raise prices by 10% for all dairy products or you can raise salaries by 5% of people
within a certain job category.
You can also use it to add some new labels/characters within records e.g. adding the
title “Dr. “ at the beginning of all FNames within a table.
Syntax:
- Create a new query in design view.
- Select the table in which you want to update records.

Compiled By Mbugua Maina19


Microsoft Access

It should contain the fields you want to use for setting the criteria
- Choose Update Query from Query menu or from the Query Type button
The ‘Update to’ row is then added to the grid.
- Add the field(s) you want to update to the query design grid by double clicking on the
it/them.
- In the “Update to” row type in the expression/formula that you will use to update
information in your table for each field(s) appropriately
- Give any condition if need be.
You can’t update a field more than once within the same query.
To see a preview of the records to be updated– click the Datasheet view button on the
standard toolbar.
WHY?: Because once you update the records you cannot reverse the action.
Switch back to design view.
Run the query and click “Yes” after the warning that will appear.
Don’t run the query again because if you do, it will keep on making the same changes
every time you run it.
Examples:
To increase the values under Age by 1, write [age]+1 within the ‘Update to’ row under
Age field.
 To increase the Salary by 20%, write [SALARY]+20/100*[SALARY] or
120/100*[SALARY] within the ‘Update to’ row under Salary field.
 To add the title “Dr. “ at the beginning of Names, write “DR. “ & [NAMES] within
the ‘Update to’ row under Names field.

Make Table Query


It creates a new table from all or part of the data in one or more tables. It's helpful for
making a backup copy of a table.
In enables a user to create a new table using all or part of the records and fields within
an existing table.
Syntax:
Create a new query based on a table or a query that contains the records you want to
put into the new table.
On Query menu, select ‘Make table Query’ or click on Query type button and select
‘Make table query’.
The make table dialog box appears.
In the table name box, type the name of the new table you want to create.
Click “Current Database”, or “Another Database” and type in the name of the database
file you want to put the new table in.
Click on OK.
In the design view, double click on the fields you want to include in the new table you
are about to create.
Specify any criteria and a sorting order if need be.
Use Datasheet View to see the records before running the query.
Run query, click “YES” to complete the task
The new table can be viewed from the database window.

Compiled By Mbugua Maina20


Microsoft Access

Append Query
It adds/copies a group of records from one or more tables to the end, or at the bottom of
an exiting table.
Append query appends data in the matching fields and ignores the others.
Data can only be appended within tables that have similar field names or data types e.g.
the contents of Names can be copied from one table to another table with the same
fieldname.
Syntax:
Create a query that contains the table whose records you want to append to another
table.
In Query design view, click 'Query type' button and select "Append Query".
The Append window appears
In the table name box type/choose the name of the table you want to append records to.
Select the table from the dropdown list, click 'Current database' to put the query results
to a table in the currently opened database.
Incase another database is to be used, enter the table name, click "Another
database" option and type the name of the database file.
Click OK.
Double click on the fields you want to append from, from the field list one by one.
The fields should include the ones for setting criteria and the primary key fields, if any.
The fieldnames that the records will be appended to will appear automatically within the
‘Append to’ row if the fieldnames are similar, otherwise you have to click as you
choose the fieldnames to append to one by one.
View the records to verify the results before running the Query.
Change back to Design view
Run the Query and click YES to confirm.

FORMS
A form offers a presentable and a more flexible way to view and work with data in a
table. Unlike datasheet view, which displays data in rows and columns, forms displays
data in a variety of formats (some created by the user).
You can still add new records, delete records and edit records within the form
A from is used to:
1. Display only the information that the designer of the form wants to see.
2. To view records as well as input new records. Calculated fields can then be
developed.
3. It allows a user to apply different formats for the fieldnames and the records
4. It allows user to present data in different styles/layouts e.g. tabular, columnar etc.

Forms can be created from Design view, using the AutoForms (Columnar, Tabular etc)
and by using the Form Wizard.
Forms can be created from Tables or from Queries and they can share the same names
as the queries or as the tables.

Compiled By Mbugua Maina21


Microsoft Access

Creating forms using the AutoForms


This feature automatically creates a form with all the records and fields within the
selected table or query using the default settings.
- Click the Forms button within the Database Objects window
- Select New
- Choose AutoForm: Columnar or AutoForm: Tabular
- Select the table or the Query which contains the records you want to present on the
form.
- Click Ok.
Access creates that form and displays the records in Form view one at a time or all at
once depending on whether you have used Columnar or Tabular layout.
Use Print preview to see the number of forms that will print per page.
To make changes to this form, choose Design view from View menu or from the Form
view button.
In Design view you don’t see the records but the structure of the form i.e. the
placeholders for the Fieldnames and the placeholders for the records
Select the placeholders appropriately and apply any formats from the Formatting toolbar
that appears.
Choose AutoFormat under format menu to change the style e.g. Clouds, International,
Standard etc.
The style will affect the background colour, the format for fieldnames and the format for
records.

Creating a Form using the form Wizard:


This wizard enables a user to choose only the fields he/she intends to include in the
form, the form layout and the form style.
- Click the Forms button within the Database Objects window
- Select New
- Choose Form Wizard
- Click Next
- Select the table or the Query which contains the records you want to present on the
form.
- Choose all the fields you want to include in your form one by one
- Click Next
- Choose the form Layout e.g. Columnar, Tabular, Justified etc.
- Click Next
- Choose the Style you would like e.g. Clouds, Colourful1, Pattern etc.
- Click Next
- Specify the Form name
- Click Finish.

When using a form, use the Status bar for record navigation.
Use the New records button to insert records into your database and use the delete
button (Records) to get rid of records.

Compiled By Mbugua Maina22


Microsoft Access

Creating Custom Forms from Design View


You can design your own form based on another form (from a wizard or Autoform) or
you can create your form from scratch.
A form is basically made up of controls - These are used in the display of information
that is typed into a form or a table and to display the way the form looks.
There are three main types of controls:-
Bound Controls
Unbound Controls
Calculated Controls

Bound Controls:- They have their data sources in a field from a table or query. They
can be used to input values, dates or numbers into the database.
Unbound Controls:- They do not have data sources, they can be used to display text,
lines, boxes and pictures.
Calculated Controls:- These are expressions as their data sources. They can be used
to display calculated values as a result of data entry. An expression is a statement
written down that gives specific results after evaluation e.g. to get the average of three
tests; you can use =([Dos]+[Windows]+[Word])/3
=[Salary]*1.1 - To calculate a salary increment of 10%
Each expression must start with an equal sign (=).

Syntax: - (Creating a Custom Form)


From database window, click on form view (design view), put in the relevant controls
onto your form.
Use the Toolbox to choose which controls you want to insert. If the tool is not visible,
select Toolbox from View menu.
The pointer in the toolbox: - Lets you move, resize, control.
The Wizard tool: - Automatically starts a wizard when some controls are selected.
When designing your form you can use a field list to help you quickly insert fields.
A field list will contain all lists from the underlined table or query.
To insert the field list, select View menu, select Field list or click the field list icon.
When the field list appears, drag the field into the form area from the field list.
Access will create a text box, a check box, list box, option button, depending on the data
type of that field.
There are various toolbars that makes working with forms easy. These are: -
Formatting toolbar
From Design toolbar
Tool box
If they do not appear select them from the View menu.
To change the size of the form, click on the boundary of the form area and drag the
double-ended arrow.

AVAILABLE TOOLS/CONTROLS
There are several controls used in forms. The controls can be bound or unbound and if
they are bound, they will be from underlined table or query. For bound controls, the

Compiled By Mbugua Maina23


Microsoft Access

type of objects placed on the forms depend on the display control properties from the
look up tab of the table structure.
The controls are: -
Labels: - These are unbound controls that display descriptive text such as titles,
captions, long fieldnames or even instructions. Most labels are attached to other
controls. When creating a label;
You can break a line by pressing Ctrl + Enter
Text Box: - This control allows you to enter text into your form. This text can be used
for an event or a field entry. A text box can also be a calculated control containing a
valid expression (=). The expression can be typed in directly into the text box or by
following these steps: -
Click on the control
Select the Property sheet from View menu
Click on Data tab
Type the expression under Control Source
If you make a text box for a memo field, you can increase the size of a text box then add
scrollbars to it.
Select the text box.
Select Properties from View menu
On Format tab, under Scroll bars choose Vertical.
Check Box: - (Toggle, Option, ….)These three controls are primarily used in YES/NO
field. When Unbound they can be used in decision making in dialogue boxes.
List Box: - It creates a control to give a list of choices and for data entries into a certain
field. To use a list box, make sure that the control wizard is on (from the toolbox).
Select the tool and drag its dimensions on form.
The wizard asks you: how you want the list box to get its values – choose “I will type the
values that I want”; Asks you the number of columns you want the list box to display
and the different entries you want listed.
Click in the grid, type them pressing tab after each.; Where you want to store that
information – select “Store that value in this field”, then choose a field from the list.;
Asks for a label for the control.
Combo box: - It is a combination of a text box and a list box; saves space within the
form. Follow the same steps as when creating a list box.
Command buttons: - Creates a control that can be assigned to a proceeding event.
Examples: Okay & Cancel button in dialogue boxes.
Make sure the control wizard is on, before creating command button.
Image control: - It inserts pictures into the form (unbound)
Bound objects: - It inserts bound control that can be used to display the contents of an
OLE object.
Drawing tools: - Used for drawing objects.

Property Sheet
You can use it to view and change the properties of a selected control. The properties
depend on the data type of that field. To open the property sheet:
Right click a control then choose properties or select properties from View menu.
The basic tabs found on the sheet are:

Compiled By Mbugua Maina24


Microsoft Access

Format:- Lets you define appearance properties.


Data:- Lets you define data sources and data display format. It also shows options for a
field’s properties.
Event:- Lets you control what happens when a control is selected.

Locking a field
You can lock a field so that its contents do not change when editing data in a table.
Select the control that has that field.
Open the property sheet and select data tab.
Click on Locked then choose ‘YES’ from the drop-down list.

FORM SECTIONS
Every form is divided into five parts:
Details: - To show the field from an underlined table or query.
Form Header: - Appears at the top of the form for page one only.
Form Footer: - Appears at the bottom of the form for the last page only.
Page Header: - Appears at the top of each page but it is not visible from form view.
Page Footer: - Appears at the bottom of each page but it is not visible from form view.
To see the effects of different controls in different sections, use print preview.

Adding Date and Time


Make sure Form Header/Footer is selected on View menu
Select Date/Time from Insert menu
Choose the date and/or time format then click OK.
It will be placed in the form header section but you can still change its position.
Select the its place holder to format it

Adding Page numbers


Select page numbers from Insert menu
Choose the format you want
Select whether you want it as a page header or as a page footer.
Specify the alignment and click Ok.

Compiled By Mbugua Maina25


Microsoft Access

Inserting custom Headers and Footers


Make sure Page Header/Footer and Form Header/Footer are selected on View menu to
display their sections.
Display the Toolbox from View menu.
Use the Label tool within the toolbox to draw a text frame where you can type your text
for the header or the footer appropriately.
You can then use the formatting toolbar to format your text as you wish.

NB:
Page Header/Footer will only appear in print preview while the Form Header/Footer will
appear both in Form view and in Print preview.
In Design view you only be able to see the Page-number and the date and tine markers
or placeholders.

Changing the number of columns in a form


This is only possible if you have used the Columnar layout.
The default number of column is one but you can change it to any number depending
on the page width and the form/column widths.
- Select Page Setup from File menu
- Click on the Columns tab
- Specify the number of columns
- Specify the column layout (Down, then Across, or Across, then Down)
- Click Ok.
NB: If the number of columns specified cannot fit on the page access will inform you
that some data will be hidden.

CHARTS
You can easily create a chart from the database table by following this syntax:
From the database window, click on Form tab.
Click on New, then select Chart wizard
Select the table or query for your chart
Access’ chart wizard asks you which fields you want in the chart (add them to the list
and click on ‘NEXT’).
Select the chart type you want, ‘NEXT’.
Preview your chart from the Preview chart button, ‘NEXT’.
Enter the title for your charts, choose whether you want a legend or not, ‘FINISH’.
The chart is inserted as an object onto the form.

REPORTS
Report is used to summarize the contents of a database. It could summarize a table or
a Query, and make it presentable and easy to understand.
Reports allow one to group data together and create SubTotals (Mathematical
summaries for groups.)
These calculations can include Average, Sum, Max, Min etc.

Compiled By Mbugua Maina26


Microsoft Access

A report can be used to:


i) Create mailing labels
ii) Add a logo or a picture
iii) Group records into categories
iv) Calculate totals
v) Show totals in a chart

If you have a table or a query that has Stock Records, you can group it according to the
order date field and summarize using sum on the buying price, selling price, and profit
fields.
If you had a table or a query with students grade, you could group the table according
the grades, summarize using the count to find out how many students scored a
particular grade.

Creating reports using wizards and Auto-reports.

Using AutoReport.
This option does allow you specify any grouping fields and the value fields to be
calculated. It creates a report that is more less like a form.
- Select Reports from the Database objects window
- Click on New
- Choose AutoReport: Columnar or AutoReport: Tabular
- Choose the table or the query that contains the records.
- Click Ok

Using the Report Wizard.


This option does allow you specify any grouping fields and the value fields to be
calculated. It creates a report that is more less like a form.
Select Reports from the Database objects window
Click on New
Choose Report Wizard and click Ok
Choose the table or the query that contains the records.
Select all the fields to include in your report one by one. You must include the field(s)
for grouping and the value field(s) to be calculated.
Click Next
Choose the grouping field(s) and click Next
Click on Summary Options, specify what you want to calculate (Sum, Average, Max or
Min) within the correct value field(s) and click Ok.
Specify the sorting field and order if need be and click Next
Choose the report Layout (Stepped, Block, Outline 1 etc)
Specify the page orientation and click Next
Choose the report style (Bold, Casual, Compact etc) and click Next.
Type the report name and click Finish.
The report is then displayed in Print preview.
You can change to design view to change the formats and the layout if need be.
NOTES:

Compiled By Mbugua Maina27


Microsoft Access

The Report name appears automatically as the Report Header.


The Fieldnames appear automatically as the Page Header
The current date and page number appear automatically as the Page Footer
The grand total appears automatically as the Report Footer.

MAKING CUSTOM REPORTS.


The report design view, is very similar to form design view, For the purpose of
grouping and summarizing options. It is normally preferred to create a report using a
wizard and then to modify the created report. You can start a report from the beginning
provided you put the correct controls into the correct sections:

Report section
One of the main differences between reports and forms is the ability of reports to group
database records.
The report has got an extra grouping section; the sections are as follows:
Report header : Appears at the top of the report on the cover/first page only.
Page header : Appears at the top of each page
Group header; Appears at the top of each group, it normally displays the group name
e.g. Grade.
It prints once for each record.
Group footer: Appears at the bottom of each group, It shows the summary totals e.g.
Total fee =sum([fee])and Average AGR =Avg([age])
Page footer: Appears at the bottom of each page e.g. =NOW ( ) , "page " and " page "
Report footer : Appear at the end of the report, can be used to display grand totals.
Each group is available from the Design view.

GROUPING DATA
You can create or remove grouping and sorting fields by clicking on ,Sorting and
Grouping, from the view menu or by clicking the icon from the toolbar within the report
design view.
A dialogue box appears where you can select the field to group by and give a sort order.
The group properties within the dialogue box are:
1 The group header ; - set it to " YES " if you want it.
2 The group footer : - """""""""""""""""""""""""""
3 The group on: : used to choose how you want to form the groups.

Compiled By Mbugua Maina28

You might also like