Creating Database Objects Tvet
Creating Database Objects Tvet
Creating Database Objects Tvet
MODULE DESCRIPTION:
This module defines the competency required to operate database applications and
perform basic operations.
LEARNING OUTCOMES
Entity Integrity: Involves the structure (primary key and its attributes) of the entity. If the primary key is
unique and all attributes are scalar and fully dependent on the primary key, then the integrity of the entity is
good. In the physical schema, the table’s primary key enforces entity integrity.
Domain Integrity: It defines that data should be of correct type and we should handle optional data in correct
way. We should apply Null ability to those attributes which are optional for organization. We can define
proper data types for different attributes based on organization’s requirement so that correct format data
should present in system.
Referential Integrity: This defines if any entity is dependent on another one then parent entity should be there
in the system and should be uniquely identifiable. We can do this by implementing foreign keys.
User defined integrity: There are few business rules which we cannot validate just by primary keys, foreign
keys etc. There has to be some mechanism so that we can validate complex rules for integrity. We can
implement these rules in following ways:
Performance: As we know that information should be readily available as requested. Performance of the
system should be up to the mark. As data in increasing day by day so at some time there will be impact on
performance if database design is poor or we’ll not take any actions to improve performance.
Availability: The availability of information refers to the information’s accessibility when required regarding
uptime, locations, and the availability of the data for future analysis. Disaster recovery, redundancy,
archiving, and network delivery all affect availability.
Security: For any organizational asset, the level of security must be secured depending on its value and
sensitivity. A sometime organization has suffered a lot because of data leaks which results in loss of faith and
tends to business risk. So security is one of the most important aspect of good database design.
Introduction to Database
A database can best be described as a way of storing large amounts of information.
The data can be retrieved and we can even ask questions of the data and get answers.
For example: You may want to know how many Students enrolled in every occupational
level.
MS Access (MS Office Access 2007) is a database management tool that enables one to store
relevant data.
This also has the capabilities to retrieve, sort, summarize report and result immediately and
effectively.
It can combine data from various files (tables) through creating relationships and can make data
entry more efficient and accurate through the use of forms.
Microsoft Access (MS Access) enables to manage all important information from a single
database file.
Within the file, can use the different objects/items:
The design process
Determine the purpose of your database. This helps prepare you for the remaining steps.
Find and organize the information required. Gather all of the types of information you might want
to record in the database, such as product name and order number.
Divide the information into tables. Divide your information items into major entities or subjects,
such as Products or Orders. Each subject then becomes a table.
Turn information items into columns . Decide what information you want to store in each table.
Each item becomes a field, and is displayed as a column in the table. For example, an Employees
table might include fields such as Last Name and Hire Date.
Specify primary keys. Choose each table’s primary key. The primary key is a column that is used
to uniquely identify each row. An example might be Product ID or Order ID.
Set up the table relationships. Look at each table and decide how the data in one table is related to
the data in other tables. Add fields to tables or create new tables to clarify the relationships, as
necessary.
Refine your design. Analyze your design for errors. Create the tables and add a few records of
sample data. See if you can get the results you want from your tables. Make adjustments to the
design, as needed.
Apply the normalization rules. Apply the data normalization rules to see if your tables are
structured correctly. Make adjustments to the tables, as needed.
Tables - A table is a collection of data about a specific topic, such as products or suppliers
Queries –Queries used to view, change, and analyze data in different ways. You can also use them as a
source of records for forms, reports.
Forms - A form is a type of a database object that is primarily used to enter or display data in a database.
You can also use a form as a switchboard that opens other forms and reports in the database, or as a custom
dialog box that accepts user input and carries out an action based on the input.
Reports - A report is an effective way to present your data in a printed format. Because you have control
over the size and appearance of everything on a report,
Data Base Tables: - Recently, we define it as a file but technically, it was defined as a container or a
worksheet-like container where the collection of data has been stored.
Before we proceed to creating your first table, we need to know first the basic components of a table:
Meta Data – Database Structure
Field – Column – Data
Fieldname
Record - Row - Information
Text: allows for the storage of any kind of data, characters, digits and special characters.
Memo: is used for texts of more than 255 characters such as comments or explanations.
Number: for numerical data used in mathematical calculations.
Date/Time: for the introduction of date and time from the year 100 to 9999.
Currency: For monetary/economic values and numerical data used in mathematical calculations in
which the data involved contains between one and four decimals.
Autonumber: a unique sequential number (increasing one by one), or a number that Access assigns
every time it adds a new record to a table.
Yes/No:Yes and No values, and fields that contain one of two values (Yes/No, True/False or
Activated/Deactivated).
OLE Object: an object such as a Microsoft Excel spreadsheet, a Microsoft Word document,
graphics, images, sounds, or other binaries.
Used to embed or link to documents from other programs like Excel and Word.
Hyperlink: text or a combination of text and numbers stored as text and used as a hyperlink address.
Attachment: Used to store files in an Access database.
The attachment data type lets you store one or more files per record.
Lookup wizard…: A lookup wizard field lets the user choose from a predefined set of options, like a
"male" or "female" selection or a "country" selection.
Designing a table involves:
Entering unique names of the columns of the table in the ―field name” column of the design view. N
Names of fields and objects in Microsoft Access can be up to 64characters long.
They can include any combination of letters, numbers, spaces, and special characters except a period (.),
an exclamation point (!), an accent grave (`), and brackets ([ ]). They also can't begin with leading spaces.
Normalization
Normalization is the process of efficiently organizing data in a database.
There are two goals of the normalization process:
1. Eliminating redundant data (for example, storing the same data in more than one table) and
2. Ensuring data dependencies make sense (only storing related data in a table).
Both of these are valuable goals as they reduce the amount of space a database consumes and ensure that
data is logically stored.
Every template that is included with Access is a complete tracking application that contains predefined tables,
forms, reports, queries, macros, and relationships. These templates are designed to be immediately useful out-
of-the-box, so that you can create a new database that is based on a template and get up and running quickly.
However, there might be times when you want to modify your new database — for example, to add or rename
a field, or change a report. You can easily add a field to a table in Datasheet view. However, you can also add
a field to a table in Design view. To learn more about adding a field to a table in Datasheet view, see the
article Add or delete a column in a datasheet. When you add a new field to a table, the field is not
automatically added to your existing forms and reports. You must manually add the field to those forms and
reports in order for it to appear in them.
If possible, you should avoid deleting a field from a database that was generated from one of the supplied
templates — it is likely that the field is employed in other database objects, such as forms and reports. Thus,
deleting the field will create consequences when you attempt to use the other database objects that employ the
field — the database objects will not work as expected. You will have to remove any references to the field
from all of the objects that employ it in order for those other objects to work correctly.
When you decide that you must delete a field from a database that was generated from a template, you can do
so in either Datasheet view or Design view. Remember that if other database objects reference the deleted
field, you must modify those other objects to remove the reference. For example, if a report includes a control
that is bound to the deleted field and you run the report, an error message appears, because Access cannot find
the data for the field.
Before you can delete a field, you must ensure that it doesn't participate in any table relationships. If you try
to delete a field for which relationships exist, Access warns you that you must first delete the relationships.
Table Relationship
Newcomers to the world of databases often have a hard time seeing the differences between a
database and a spreadsheet.
They see tables of data and recognize that databases allow you to organize and query data in new
ways, but fail to grasp the significance of the relationship that gives relational database
technology& its name.
Relationships allow you to describe the connections between different database tables in powerful
ways.
Once you’ve described the relationships between your tables, you can later leverage that
information to perform powerful cross-table queries, known as joins.
A relationship is a logical connection between two tables.
Keys are fields that are part of a table relationship. There are two kinds of keys
Primary key
A table can have only one primary key.
A primary key is used to identify each record that you store in the table.
It will not allow a duplication of the Primary Key thus make it unique.
Primary Key is the unique identification of one record.There is a uniquely identification number,
such as
ID number
A serial number
A code that serves as a primary key
Foreign key
A table can also have one or more foreign key.
A foreign key contains values that correspondent to values in the primary key of another table
You use table relationship to combine data from related table
Customer Employee
c-id e- id
c-name e- name
c-age e- age
c-sex e- sex
c-phone e- address
c-address e- salary
c-id
One-to-one relationships: occur when each entry in the first table has one, and only one,
counterpart in the second table.
One-to-many relationships: Is the most common type of database relationship. .
Many-to-many relationships: occur when each record in the first table corresponds to
one or more records in the second table and each record in the second table corresponds
to one or more records in the first table.
An Entity Relationship Diagram (ERD) is a visual representation of different data using conventions
that describe how these data are related to each other.
For example, the elements writer, novel, and consumer may be described using ER diagrams this way:
In the diagram, the elements inside rectangles are called entities while the items inside diamonds denote
the relationships between entities.
This ER diagram tutorial for beginners covers most things related to ER diagram, for quick
navigation use the links below.
ER Diagram Usage
ER Diagrams Symbols and Notations
How to Draw ER Diagrams
ER Diagram Templates
Benefits of ER Diagrams
ER Diagrams Usage
ER diagrams are most often associated with complex databases that are used in software engineering
and IT networks.
In particular, ER diagrams are frequently used during the design stage of a development process in order
to identify different system elements and their relationships with each other.
For example, inventory software used in a retail shop will have a database that monitors elements such
as purchases, item, item type, item source and item price. Rendering this information through an ER
diagram would be something like this:
In the diagram, the information inside the oval shapes is attributes of a particular entity.
Elements in ER diagrams
1. Entity 3. Relationship
2. Attribute
There are more elements which are based on the main elements.
Cardinality and ordinalily are two other notations used in ER diagrams to further define relationships.
Entity
An entity can be a person, place, event, or object that is relevant to a given system.
For example, a school system may include students, teachers, major courses, subjects, fees, and other
items.
Entities are represented in ER diagrams by a rectangle and named using singular nouns.
Weak Entity
In more technical terms it can defined as an entity that cannot be identified by its own attributes.
It uses a foreign key combined with its attributed to form the primary key.
An entity like order item is a good example for this. The order item will be meaningless without an order
so it depends on the existence of order.
Attribute
For example, the attribute Inventory Item Name is an attribute of the entity Inventory Item. An entity can
have as many attributes as necessary.
For example, the attribute ―customer address‖ can have the attributes number, street, city, and state.
Note that some top level ER diagrams do not show attributes for the sake of simplicity.
Attributes in ER diagrams, note that an attribute can have its own attributes (compositeattribute)
Multivalued Attribute
If an attribute can have more than one value it is called a multivalued attribute.
It is important to note that this is different to an attribute having its own attributes. For example a teacher
entity can have multiple subject values.
Derived Attribute
For example for a circle the area can be derived from the radius.
Relationship
For example, the entity ―carpenter‖ may be related to the entity ―table‖ by the relationship ―builds‖ or
―makes‖.
Relationships are represented by diamond shapes and are labeled using verbs.
Recursive Relationship
If the same entity participates more than once in a relationship it is known as a recursive relationship.
In the below example an employee can be a supervisor and be supervised, so there is a recursive
relationship.
These two further defines relationships between entities by placing the relationship in the context of
numbers.
In an email system, for example, one account can have multiple contacts.
Chen, UML, Crow’s foot, Bachman are some of the popular notations. Greatly supports Chen, UML and
Crow’s foot notations. The following example uses UML to show cardinality.
Below are some ER diagram templates so you can get started quickly.
Clicking on the image and in the new page that opens click the ―Use as Template‖ button.
ER diagrams constitute a very useful framework for creating and manipulating databases.
First, ER diagrams are easy to understand and do not require a person to undergo extensive training to be
able to work with it efficiently and accurately.
This means that designers can use ER diagrams to easily communicate with developers, customers, and end
users, regardless of their IT proficiency.
Second, ER diagrams are readily translatable into relational tables which can be used to quickly build
databases.
In addition, ER diagrams can directly be used by database developers as the blueprint for implementing
data in specific software applications.
Lastly, ER diagrams may be applied in other contexts such as describing the different relationships and
operations within an organization.
There are several ways to update data in an Access database. You add a record to your database when you have a
new item to track, such as a new contact to the Contacts table. When you add a new record, Access appends the
record to the end of the table. You also change fields to stay up-to-date, such as a new address or last name. To
maintain data integrity, the fields in an Access database are set to accept a specific type of data, such as text or
numbers. If you don't enter the correct data type, Access displays an error message. Finally, you can delete a
record when it is no longer relevant and to save space.
You use a form to manually update data. Data entry forms can provide an easier, faster, and more accurate way
to enter data. Forms can contain any number of controls such as lists, text boxes, and buttons. In turn, each of the
controls on the form either reads data from or writes data to an underlying table field.
Datasheets are grids of data that look like Excel worksheets. You can change data by working directly in
Datasheet view. If you are familiar with Excel, datasheets should be relatively easy to understand. You can
change data in tables, query result sets, and forms that display datasheets. Typically, you use datasheets when
you need to see many records at once.
The following table shows some of the record selector symbols you might see when updating data and what they
mean.
Symbol Meaning
This is the current record; the record has been saved as it appears. The current record is indicated by a
change in color in the record selector.
You are editing this record; changes to the record aren't yet saved.
This record is locked by another user; you can't edit it.
This is a new record in which you can enter information.
This is the primary key field and contains a value that uniquely identifies the record.
Information Sheet 8
Saving a database or an object in a different format:
Saving a database
Saving your work in Access is a little different from saving in most Office apps. Changes to data, the primary
reason for saving your work in most apps, are automatically saved in In Access, instead of saving data changes,
you save changes to the database design, or you save the whole database, data and all, with a new filename as a
backup, or in a different format, such as an earlier Access file format, a database template, or a compiled
database (a database where you can't change the design). You can also save individual database objects as new
objects.
In the Blank Database pane, type a file name in the File Name box. If you do not supply a file name
extension, Access adds it for you. To change the location of the file from the default, click Browse for a
location to put your database (next to the File Name box), browse to the new location, and then
click OK.
Click Create.
Access creates the database with an empty table named Table1, and then opens Table1 in Datasheet
view. The cursor is placed in the first empty cell in the Add New Field column.
Begin typing to add data, or you can paste data from another source, as described in the section Copy
data from another source into an Access table.
Options dialog box or the mode that was set by an administrative policy.
Click Open to open the database for shared access in a multi-user environment so that you and other
users can read and write to the database.
Click the arrow next to the Open button and then click Open Read-Only to open the database for read-
only access so that you can view but not edit it. Other users can still read and write to the database.
Click the arrow next to the Open button
click Open Exclusive to open the database with exclusive access. When you have a database open with
exclusive access, anyone else who tries to open the database receives a "file already in use" message.
In the File Name box, type a file name for the new database.
To browse to a different location to save the database, click the folder icon.
Click Create.
In the Open dialog box, select the database that you want to open, and then click Open.
In the Open dialog box, select and open the database in which you wish to create a table.
On the Create tab, in the Tables group, click Table Templates and then select one of the available
templates from the list.
On the External Data tab, in the Import group, click one of the available data sources.
Follow the instructions in the dialog boxes that appear at each step.
In the Open dialog box, select the database in which you want to create the new table, and then
click Open.
In the Create New List dialog box, type the URL for the SharePoint site where you want to create
the list.
Enter a name for the new list and its description in the Specify a name for the new list and
Description boxes.
To open the linked table after it is created, select the Open the list when finished check box
(selected by default).
Click Custom.
In the Create New List dialog box, type the URL for the SharePoint site where you want to
create the list.
Enter a name for the new list and its description in the Specify a name for the new list and
Description boxes.
To open the linked table after it is created, select the Open the list when finished check box
(selected by default).
In the Get External Data dialog box, type the URL for the SharePoint site that contains the data that
you want to import.
Click Import the source data into a new table in the current database, and then click Next.
Select the check box next to each SharePoint list that you want to import.
On the Home tab, in the Views group, click View, and then click Design View.
In the table design grid, select the field or fields that you want to use as the primary key.
A key indicator appears to the left of the field or fields that you specify as the primary key.
Steps to Remove the primary key
Select the table whose primary key you want to remove.
On the Home tab, in the Views group, click View, and then click Design View.
Click the row selector for the current primary key. If the primary key consists of multiple fields,
hold down CTRL, and then click the row selector for each field.
On the Home tab, in the Views group, click View, and then click Design View.
On the Design tab, in the Show/Hide group, click Property Sheet.The table property sheet is
shown.
Click the box to the left of the property that you want to set, and then enter a setting for the
property.
On the Datasheet tab, in the Fields & Columns group, click New Field.
Select one or more fields in the Field Templates pane, and then drag them to the table where you
want to insert the new column.
In the Navigation Pane, right-click the table that you want to open.
In the Data Type list, in the Data Type & Formatting group, select the data type that you want.
In Datasheet view, click the field for which you want to set the property.
On the Datasheet tab, in the Data Type & Formatting group, select the properties that you want.
In the Data Type column, choose a data type from the list.
Find links to more information about data types and field properties in the See Also section.
Rename a table
In the Navigation Pane, right-click the table that you want to rename ,and then click Rename on
the shortcut menu.
After you have created a table for each subject in your database, you must provide Office Access 2007 with the
means by which to bring that information back together again when needed. You do this by placing common
fields in tables that are related, and by defining table relationships between your tables. You can then create
queries, forms, and reports that display
4. If you have not yet defined any relationships, the Show Table dialog box automatically appears. If it does not
appear, on the Design tab, in the Relationships group, click Show Table.
The Show Table dialog box displays all of the tables and queries in the database. To see only tables, click Tables.
To see only queries, click Queries. To see both, click Both.
5. Select one or more tables or queries and then click Add. After you have finished adding tables and queries to the
Relationships document tab, click Close.
6. Drag a field (typically the primary key) from one table to the common field (the foreign key) in the other table.
To drag multiple fields, press the CTRL key, click each field, and then drag them.
7. Verify that the field names shown are the common fields for the relationship. If a field name is incorrect, click on
the field name and select the appropriate field from the list.
To enforce referential integrity for this relationship, select the Enforce Referential Integrity check box. For more
information about referential integrity, see the section Enforce Referential Integrity
8. Click Create.
Access draws a relationship line between the two tables. If you selected the Enforce Referential Integrity check
box, the line appears thicker at each end. In addition, again only if you selected the Enforce Referential
Integrity check box, the number 1 appears over the thick portion on one side of the relationship line, and the
infinity symbol (∞) appears over the thick portion on the on the other side of the line, as shown in the following
figure.
NOTES
To create a one-to-one relationship Both of the common fields (typically the primary key and foreign key fields)
must have a unique index. This means that the Indexed property for these fields should be set to Yes (No
Duplicates). If both fields have a unique index, Access creates a one-to-one relationship.
To create a one-to-many relationship The field on the one side (typically the primary key) of the relationship
must have a unique index. This means that the Indexed property for this field should be set to Yes (No
Duplicates). The field on the many side should not have a unique index. It can have an index, but it must allow
duplicates. This means that the Indexed property for this field should be set to either No or Yes (Duplicates OK).
When one field has a unique index, and the other does not, Access creates a one-to-many relationship.
In Office Access 2007, you can add a field to an existing table that is open in Datasheet view by dragging it from
the Field List pane. The Field List pane shows fields available in related tables and also fields available in other
tables in the database. When you drag a field from an "other" (unrelated) table and then complete the Lookup
Wizard, a new one-to-many relationship is automatically created between the table in the Field List pane and the
table to which you dragged the field. This relationship, created by Access, does not enforce referential integrity
by default. To enforce referential integrity, you must edit the relationship. See the section Edit a table
relationship for more information.
On the Datasheet tab, in the Fields & Columns group, click Add Existing Fields.
Steps to Add a field and create a relationship from the Field List pane
1. On the Datasheet tab, in the Fields & Columns group, click Add Existing Fields.
2. Under Fields available in other tables, click the plus sign (+) next to a table name to display the list of fields in
that table.
3. Drag the field that you want from the Field List pane to the table that is open in Datasheet view.
4. When the insertion line appears, drop the field into position.
When you drag a field from an "other" (unrelated) table and then complete the Lookup Wizard, a new one-to-
many relationship is automatically created between the table in the Field List and the table to which you dragged
the field. This relationship, created by Access, does not enforce referential integrity by default. To enforce
referential integrity, you must edit the relationship. See the section Edit a table relationship for more
information.Steps to Edit a table relationship
You change a table relationship by selecting it in the Relationships document tab and then editing it.
1. Carefully position the cursor so that it points to the relationship line, and then click the line to select it.
If you have not yet defined any relationships and this is the first time you are opening the Relationships
document tab, the Show Table dialog box appears. If the dialog box appears, click Close.
All tables with relationships are displayed, showing relationship lines. Note that hidden tables (tables for which
theHidden check box in the table's Properties dialog box is selected) and their relationships will not be shown
unless Show Hidden Objects is selected in the Navigation Options dialog box.
For more information about the Show Hidden Objects option, see the article Guide to the Navigation Pane.
5. Click the relationship line for the relationship that you want to change. The relationship line appears thicker
when it is selected.
6. Double-click the relationship line. -or-
The Edit Relationships dialog box allows you to change a table relationship. Specifically, you can change the
tables or queries on either side of the relationship, or the fields on either side. You can also set the join type, or
enforce referential integrity and choose a cascade option. For more information about the join type and how to
set it, see the section Set the join type. For more information about how to enforce referential integrity and
choose a cascade option, see the section Enforce referential integrity.
You should think about the result you will most often want from a query that joins the tables in this relationship,
and then set the join type accordingly.
The following table (using the Customers and Orders tables) shows the three choices that are displayed in
the Join Properties dialog box, the type of join they use, and whether all rows or matching rows are returned for
each table.
CHOICE RELATIONAL LEFT RIGHT
JOIN TABLE TABLE
1. Only include rows where the joined fields from both tables Inner join Matching Matching
are equal. rows rows
2. Include ALL records from 'Customers' and only those Left outer join All rows Matching
records from 'Orders' where the joined fields are equal. rows
3. Include ALL records from 'Orders' and only those records Right outer join Matching All rows
from 'Customers' where the joined fields are equal. rows
When you choose option 2 or option 3, an arrow is shown on the relationship line. This arrow points to the side
of the relationship that shows only matching rows.
If you have not yet defined any relationships and this is the first time you are opening the Relationships
document tab, the Show Table dialog box appears. If the dialog box appears, click Close.
All tables that have relationships are displayed, showing relationship lines. Note that hidden tables (tables for
which the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be
shown unless Show Hidden Objects is selected in the Navigation Options dialog box.
For more information about the Show Hidden Objects option, see the article Guide to the Navigation Pane.
5. Click the relationship line for the relationship that you want to change. The relationship line appears thicker
when it is selected.
6. Double-click the relationship line. -or-
On the Design tab, in the Tools group, click Edit Relationships.
The Edit Relationships dialog box appears.
7. Click Join Type
8. In the Join Properties dialog box, click an option, and then click OK.
9. Make any additional changes to the relationship, and then click OK.
If you have not yet defined any relationships and this is the first time you are opening the Relationships
document tab, the Show Table dialog box appears. If the dialog box appears, click Close.
All tables with relationships are displayed, showing relationship lines. Note that hidden tables (tables for which
the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be shown
unless Show Hidden Objects is selected in the Navigation Options dialog box.
For more information about the Show Hidden Objects option, see the article Guide to the Navigation Pane.
5. Click the relationship line for the relationship that you want to change. The relationship line appears thicker
when it is selected.
6. Double-click the relationship line. -or-
On the Design tab, in the Tools group, click Edit Relationships.
The Edit Relationships dialog box appears.
7. Check Enforce Referential Integrity.
8. Make any additional changes to the relationship, and then click OK.
After you have enforced referential integrity, the following rules apply:
You cannot enter a value in the foreign key field of a related table if that value doesn't exist in the primary key
field of the primary table — doing so creates orphan records.
You cannot delete a record from a primary table if matching records exist in a related table. For example, you
cannot delete an employee record from the Employees table if there are orders assigned to that employee in the
Orders table. You can, however, choose to delete a primary record and all related records in one operation by
selecting the Cascade Delete Related Records check box.
You cannot change a primary key value in the primary table if doing so would create orphan records. For
example, you cannot change an order number in the Orders table if there are line items assigned to that order in
the Order Details table. You can, however, choose to update a primary record and all related records in one
operation by selecting the Cascade Update Related Fields check box.
The common field from the primary table must be a primary key or have a unique index.
The common fields must have the same data type. The one exception is that an AutoNumber field can be related
to a Number field that has a FieldSize property setting of Long Integer.
Both tables exist in the same Access database. Referential integrity cannot be enforced on linked tables. However,
if the source tables are in Access format, you can open the database in which they are stored and enable
referential integrity in that database.
If you have not yet defined any relationships and this is the first time you are opening the Relationships
document tab, the Show Table dialog box appears. If the dialog box appears, click Close.
relationships will not be shown unless Show Hidden Objects is selected in the Navigation
Options dialog box.
For more information about the Show Hidden Objects option, see the article Guide to the Navigation
Pane.
Click the relationship line for the relationship that you want to change. The relationship line appears
thicker when it is selected.
Double-click the relationship line. -or-
On the Design tab, in the Tools group, click Edit Relationships.
The Edit Relationships dialog box appears.
Select the Enforce Referential Integrity check box.
Select either the Cascade Update Related Fields or the Cascade Delete Related Records check box,
or select both.
Make any additional changes to the relationship, and then click OK.
To remove a table relationship, you must delete the relationship line in the Relationships document
tab. Carefully position the cursor so that it points to the relationship line, and then click the line. The
relationship line appears thicker when it is selected. With the relationship line selected, press
DELETE. Note that when you remove a relationship, you also remove referential integrity support
for that relationship, if it is enabled. As a result, Access will no longer automatically prevent the
creation of orphan records on the "many" side of a relationship.
To Delete a record
The deletion process is fairly simple, except when the record is related to other data and resides on the "one" side
of a one-to-many relationship. To maintain data integrity, by default, Access does not let you to delete related
data. For more information, see Guide to table relationships.
Open the table in Datasheet View or form in For
m View.
Select the record or records that you want to delete.
Press DELETE, select Home> Records >Delete, or press Ctrl+Minus Sign
Layout view is the most intuitive view to use for report modification, and can be used for nearly all the
changes you would want to make to a report in Access. In Layout view, the report is actually running, so you
can see your data much as it will appear when printed. However, you can also make changes to the report
design in this view. Because you can see the data while you are modifying the report, it's a very useful view
for setting column widths, add grouping levels, or performing almost any other task that affects the
appearance and readability of the report.
Introduction
Toolbar Sometimes referred to as a bar or standard toolbar, the toolbar is a row of boxes, often at the top of
an application window, that control various functions of the software. The boxes often contain images that
correspond with the function they control, as demonstrated in the image below.
A toolbar often provides quick access to functions that are commonly performed in the program. For
example, a formatting toolbar in a Microsoft Access gives you access to things like making text bold or
changing its alignment, along with other common buttons
Common computer software toolbars
Commands bar - A bar that shows available commands in a program.
Formatting toolbar - Toolbar that shows text formatting options.
Formula bar - Bar in a spreadsheet program that allows you to edit a formula.
Menu bar - A bar at the top of the screen that gives access to all of the menus.
Navigation bar - Gives access to all navigation features in a browser.
Places bar - A pane that shows common places to access files.
Scroll bar - A bar on the bottom or side of the window to scroll through a page.
Split bar - A bar that divides the window into multiple sections.
Status bar - One of the few bars at the bottom of the window that shows the status.
Title bar - A bar at the very top of a window that describes the program or window.
A font is a graphical representation of text that may include a different typeface, point size, weight, color, or
design. The image shows some examples of different computer fonts. Software programs like Microsoft
Word, Microsoft Excel, and Ms-access allow users to change the font used when typing text in the document
or spreadsheet, as do web designers.
Formatting Fonts Sometimes users want to specify or change the appearance of a group of words or
characters, or even of a single word or character, and they are not familiar enough with all of Word's font
formatting options to know how to achieve the effect that they are seeking. Although most users are probably
familiar with some different font families and sizes and with the italic and bold typefaces, many users do not
know how to determine and apply the settings that are needed to add a colored background to their text or to
type
Operation Sheet 1
Adjusting page layout and settings
Steps to Change page setup
Use the Page Size and Page Layout groups on the Page Setup tab to change size, orientation, margins,
and so on.
Note You cannot delete a built-in toolbar. When you select a built-in toolbar in the Toolbars list, the
Delete button is unavailable, and the Reset button becomes available. If you click the Reset button,
the built-in toolbar returns to its original default appearance.
Operation Sheet 3
Formatting Fonts
To Changing font type
Highlight the text you want to change.
Click the down arrow next to the font field on the format bar. (If you want to change the font to
bold, italic, or underlined, click on the B, I, or U on the format bar.)
After clicking the down arrow for the font, you should be able to select from each of the installed
fonts on your computer. Click the font you want to use and the highlighted text will change.
Changing font size
Highlight the text you want to change.
Click the down arrow next to the size box on the format bar. Often, the default size is 12, as shown
in the above example.
After clicking the down arrow for the size, you should have a selection of different sizes to
choose. Some fonts may not scale properly, so they may have limited size options.
To Changing font color
Highlight the text you want to change.
Click the down arrow next to the color icon. It is usually displayed as the letter "A" with a red
underline, as shown in the example above.
After clicking the down arrow for the color, select the color you want to make the text.
Task3
o Make the type Bold
o Make the font size 20
o Make the font color red
Justified layout If you use the Report Wizard to create your report, you can choose to use a
justified layout. This layout uses the full width of the page to display the records as compactly as
possible. Of course, you can achieve the same results without using the Report Wizard, but it can be
a painstaking process to align the fields exactly. The following illustration shows an employee report
that was created by using the Report Wizard's justified layout.
Creating Reports using a wizard Creation of a report by using a wizard is a fastest and easy way to
create a report by following the series of steps and choosing a pre-defined template for your report.
Creating Reports using design view Creation of a report by design view is a user customized way
setting-up your report so to meet the users desired output and format.
Information Sheet 2 Modifying Report
2.1 Understand Layout view
Layout view is the most intuitive view to use for report modification, and can be used for nearly all the
changes you would want to make to a report in Access. In Layout view, the report is actually running, so
you can see your data much as it will appear when printed. However, you can also make changes to the
report design in this view. Because you can see the data while you are modifying the report, it's a very
useful view for setting column widths, add grouping levels, or performing almost any other task that affects
the appearance and readability of the report. The following illustration shows a Customer Phone Book
report in Layout view.
The report you see in Layout view does not look not exactly the same as the printed report. For example,
there are no page breaks in Layout view. Also, if you have used Page Setup for format your report with
columns, the columns are not displayed in Layout view. However, Layout view gives you a very close
approximation of the printed report. If you want to see how the report will look when printed, use Print
Preview.
Understand Design view
Design view gives you a more detailed view of the structure of your report. You can see the header and
footer bands for the report, page, and groups. The report is not actually running in Design view, so you
cannot see the underlying data while working; however, there are certain tasks you can perform more easily
in Design view than in Layout view. You can:
3.1 Introduction
Report is a document containing information organized in a narrative, graphic, or tabular form, prepared on
ad hoc, periodic, recurring, regular, or as required basis. Reports may refer to specific periods, events,
occurrences, or subjects, and may be communicated or presented in oral or written form. Liberate your
Access reports and distribute them far and wide. For example, email them to one or more users, export them
to SharePoint document libraries, and archive them on network folders.
When you distribute an Access report, you create a static report of data at a certain moment in time, such as
daily, weekly, or monthly. By doing so, you have a single point of truth that information workers can use to
make good business decisions, answer questions, find alternatives, determine best plans, evaluate risks, and
improve quality. The term "business representative" is often used as a general reference for sales
professionals, customer service professionals or anyone serving as an interface between customers and a
company However, this term has a very specific meaning and application in the business world.
Methods to distribute report
Personalized emails: Segment your email list down to the exact audience that would benefit most
from your piece of content. Write a custom email to each of these audience members to add a level
of personalization to your message. Explain what the content is, and why you think he or she will
enjoy it..
Guest posting: Write an article that discusses -- in a non-promotional way -- the key findings or
points within your content, and send it to the editor of an online publication that reaches your
target audience. But be strategic about it. Make sure the publication not only helps you achieve
your own reach goals, but also, has something to gain by sharing your insights, from your
particular brand.
Follow-up emails: Encourage your sales team to include a link to your content in their follow-up
emails to prospective clients, to answer their questions and position your company as a resource
they can trust. Note: This tactic works best when the content you create is educational and
addresses specific questions or concerns your leads have --and is actionable enough for them to
immediately apply it to their own plans or strategies.
Lead interviews: Work with your sales reps to identify prospective clients you can interview for your
content. Include a quote in your content, and share it with them once it's published. Not only can
that keep your leads engaged over time, but they'll appreciate the opportunity to be featured -- and
you benefit from the additional exposure to their networks when the content is shared with that
audience.
Proposal references: The best proposals are often supported with relevant data that corroborates
the solutions you’re suggesting to a prospect. And while we suggest citing a variety of authentic,
reliable sources -- otherwise, you might look biased -- referencing your own research content can
be effective. Not only is it another way to distribute your work, but also, it illustrates the time and
thought your company has invested in this school of thought.
That said, some prospective clients like proposals to be brief. In these cases, if you preemptively
anticipate additional questions, you can amend your proposal with a link to the content as a source
of further reading and information.
To save a eport
Click the Save button on the Quick Access toolbar. Access saves the report unless you are
saving for the first time. If you are saving for the first time, the Save As dialog box appears.
Type the name you want to give your report.
Click OK. Access saves the report. You can now access the report by using the Navigation pane.
Right-click the report in the Navigation Pane, and then click the view you want on the shortcut
menu.1313
Right-click the report's document tab or title bar, and then click the view you want on the
shortcut menu.
On the Home tab, in the View group, click the View button to toggle between available views.
Alternatively, you can click the arrow under View, and then select one of the available views
from the menu.
Right-click in a blank area of the report itself, and then click the view you want. If the report is
open in Design view, you must right-click outside of the design grid.
Click one of the small view icons on the Access status bar.
On the Design tab, in the Tools group, click Add Existing Fields.
o The list of available fields is displayed. If there are fields available in other tables, these
will be displayed under Fields available in other tables:.
Drag a field from the Field List onto the report. As you move the field, a highlighted area will
indicate where the field will be placed when you release the mouse button.
Note: To add multiple fields at once, hold down the CTRL key and click each field in the Field List
that you want. Then, release the CTRL key and drag the fields onto the report. The fields will be
placed adjacent to each other.
You create a new report by clicking Report in the Reports group on the Create tab.
You create a new report by clicking Blank Report in the Reports group on the Create tab, and
then dragging a field from the Field List pane to the report.
On an existing report, you can create a new control layout by doing the following:
Select a control that you want to add to the layout.
If you want to add other controls to the same layout, hold down the SHIFT key and also select
those controls.
Do one of the following:
o On the Arrange tab, in the Table group, click Tabular or Stacked.
o Right-click the selected control or controls, point to Layout, and then click Tabular or
Stacked.
To Change page setup
Click the Page Setup tab.
In the Page Size group, click Size to select a different paper size.
In the Page Size group, click Margins to make adjustments to the report's margins.
In the Page Layout group, click Portrait or Landscape to change the paper orientation.
To Change the formatting of a field
Select the field that you want to format.
On the Format tab, use the tools in the Font group to apply the formatting you want.
To Add or modify a logo or other image
To Add a logo
On the Design tab, in the Header/Footer group, click Logo.
Browse to the folder where your logo file is stored, and double-click the file.
Add or edit a report title
To Add a title to a report
On the Design tab, in the Header/Footer group, click Title.
o A new label is added to the report header, and the report name is entered for you
as the report title.
When the label is created, the text in the label is selected for you so that if you want to
change the text, you can just begin typing the title you want.
Press ENTER when you have finished.
To Edit the report title
Double-click the label containing the report title to place the cursor in the label.
Type the text you want to use as the report title, and press ENTER when you have finished.
1. Click to choose the fields you want to sort by. Click the single right-arrow to select a single field,
click the double right-arrow to select all fields, click the single left-arrow to deselect a single field,
click the double left-arrow to deselect all fields.
2. Click Next. The Label Wizard moves to the next page.
1. Type a title for your report. The title will appear in the Navigation pane.
2. Click Finish. Access displays the labels in Print Preview.
To Print a Report
1. click the Print button in the Print group.
2. The Print dialog box opens
3. select your print options.
To change to Print Preview:
1. Open your report.
2. Activate the Home tab.
3. Click the down-arrow under the View button. A menu appears.
4. Click Print Preview. Access changes to Print Preview.
Select the Report command on the Create tab on the Ribbon, as seen above.
The report is automatically generated and includes every field in the table in order of their
appearance in the table. This can be seen in the example below, which was created from the
table above.
The layout and formatting of the report can be manipulated in Layout View.
Creating a report based on a query
Access 2007 can also create a report using a query as the source. The process for creating a report
based on a query is identical to the process for creating a report based on a table, which was outlined
on the previous page. And just like when making a report from a table, every field and record that
appears in the query results will appear on the report.
To limit the number of records in a report
It is possible to limit the number of records in a report, but only if the report was based on a query.
The limit is set in the query itself, using the query design screen.
To limit the records returned in a query:
Open the query in Design View.
Use the Return option in the Query Setup command group to set the number of records you
want to see in the query results and the final report.
Click Run! to make sure the query results look like you want the report to look.
Create the report using the Report command on the Create tab.
Format the report as desired.
To add a level of grouping to a report:
With the report open, select the Group & Sort command from the Grouping &
Totals command group on the Format tab on the Ribbon.
Open a Group, Sort, and Total dialog box in the lower portion of the window.
In the Group, Sort, and Total dialog box, select Add a group.
Select the field you wish to group by from the drop-down list. We chose to group our list
by Category.
When you release the mouse button, the report will now appear with items grouped. Our
report is grouped on Category now, as seen below.
The Group, Sort, and Total dialog box will remain open until you close it.
To Format a report in Layout View
Access 2007 opens the created report in Layout View so you can easily make modifications. In
Layout View, you can change the look of your report in many different ways, including:
Deleting columns and other report elements
Moving and resizing columns
Adding a logo
Changing the title and other text on the report headings
Applying a report style with AutoFormat
Select a format from the drop-down list. The change is applied instantly.
Select the layout option you wish to alter from the Page Layout command group on the
Ribbon.
To save a report
As with all Access objects, to save a report:
Right-click on the report tab.
Choose Save from the list that appears.
When the Save as dialog box opens, give the report a name.
Click OK.!
On the Format tab of the property sheet, set the Repeat Section property to Yes.
Name
LAP Test Practical Demonstration :
_____
_____
______________________Date:_____________________________
Time started: _____________________Time finished: ____________________________
Task 1
Create Reports
Use the Report Button
Use the Report Wizard
Task2
Modify a Report
Change view
Change the Size of a Field or Label
Report Properties
o Add a field
o Delete a field
o Move a column
o Change a title
What Database
A database is an organized collection of data, generally stored and accessed electronically from a
computer system. Where databases are more complex they are often developed using formal design and
modeling techniques.
Types of databases. Databases have evolved since their inception in the 1960s, beginning with …
Relational database. A relational database, invented by E.F. Coded at IBM in 1970, is a tabular …
Distributed database. A distributed database is a database in which portions of the database are …
Cloud database. A cloud database is a database that has been optimized or built for a virtualized
Open an existing database
There are the different methods you can use to open existing Access databases. You can open databases from
Windows Explorer or from within Access itself. You can open multiple databases at once, and you can also
create desktop shortcuts that open database objects directly.
Information Sheet 3 Rearranging Objects with in the form
Objects: A Form object refers to a particular Microsoft Access form. A Form object is a member of the
Forms collection, which is a collection of all currently open forms. Within the Forms collection, individual
forms are indexed beginning with zero.
Forms are made up of controls, such as text boxes, buttons, document tabs, and drop-down lists,
grouped in a way that makes them easy to use and helps you get work done.The controls in the form are
usually bound, or connected, to the tables or queries in your database — but not always. For example, a
control that displays your corporate logo doesn't have to be bound to a table field. It can just point to the
image it displays. In addition to entering data, you can use forms in other ways. For example, you can create
a form that asks for input, and then generates a custom report based on that input.
You can use the Navigation bars to move through the records on a form.
1 Go to First Record
2 Go to Previous Record
3 The Current Record
4 Go to Next Record
5 Go to Last Record
6 Create a New (Blank) Record
Tip: After you create a form, you can save it. You can open a saved form at any time.
Steps to save a form
1. Click the Save button on the Quick Access toolbar. Access saves the form unless you are saving for
the first time. If you are saving for the first time, the Save As dialog box appears.
2. Type the name you want to give the form.
3. Click OK. Access saves the form. You can now access the form by using the Navigation pane.
You can also save by right-clicking a form’s tab and then selecting Save from the menu that appears.
Access saves the form unless you are saving for the first time. If you are saving for the first time, the Save
As dialog box appears. Type the name you want to give the form and then click OK. Access saves the form.
You can now access the form by using the Navigation pane.
Create a Split Form
A split form is a form in which the same data is displayed in two views simultaneously. One part of
the form displays in Form view (stacked fields), while the other part displays in Datasheet view. The two
views are synchronized, so as you select a field in one view, it is automatically selected in the other view.
You can add, change, or delete the data in either view. Using a split form gives you the benefits of two types
of forms in a single form. For example, you can use the datasheet portion to locate records and the form
portion to edit records.
To create a split form
Tip: A view is a way of looking at an Access object. Forms have three views: Form view, Layout view, and
Design view. You can enter, edit, and view data in Form view. You can modify a form in Layout view or
Design view. In Layout view, you can see your data, and the form you see closely resembles what your form
will look like when you view it in Form view. You can make most, but not all, changes to your form in
Layout view. Design view displays the structure of your form. In this view you cannot see the underlying
data, but you can perform some tasks in Design view that you cannot perform in Layout view. This tutorial
focuses on Layout view.
To change the view
1. Open the form.
2. Activate the Format tab.
3. Click the down-arrow under the View button. A menu appears.
4. Click the view you want.
To change the size of a field
1. Click a side of the field and drag to change the width of the field.
2. Click the top or bottom of a field and drag to change the height of a field.
To move a datasheet
1. Click the datasheet to select it.
2. Click and drag the four-sided arrow in the upper-right corner to move the datasheet.
To resize a datasheet
1. Click the datasheet to select it.
2. Click a side of the datasheet and drag to change the width.
3. Click the top or bottom of the datasheet and drag to change the height.
To apply an AutoFormat
The AutoFormat option on the Format tab enables you to apply formats quickly, such as background
colors, field colors, field label colors, and fonts.
1. Activate the Format tab.
2. Click AutoFormat. The AutoFormat menu appears.
3. Click the format you want to apply.
To change a form title
When you create a form, by default, Access uses the form name as the title. You can change the title.
1. Activate the Format tab.
2. Click the Title button.
3. Type the new title.
To add the date and time
You can easily add the date and time to your form.
1. Activate the Format tab.
2. Click the Date and Time button. The Date and Time dialog box appears. Select the date and time
format you want. The date and time appear on your form.
Operation Sheet 2 Opening &Modifying Existing database
To Open a database from within Access
On the getting started page of Access, Click Open Other Files.
On the Open area of the backstage view, click Browse.
Click a shortcut in the Open dialog box, or in the Look in box, click the drive or folder that contains the
database that you want.
In the folder list, browse to the folder that contains the database.
When you find the database, do one of the following:
o Double-click the database to open it in the default mode specified in the Access Options dialog box
or the mode that was set by an administrative policy.
o Click Open to open the database for shared access in a multi-user environment so that you and other
users can read and write to the database.
o Click the arrow next to the Open button and then click Open Read-Only to open the database for
read-only access so that you can view but not edit it. Other users can still read and write to the
database.
o Click the arrow next to the Open button and then click Open Exclusive to open the database with
exclusive access. When you have a database open with exclusive access, anyone else who tries to
open the database receives a "file already in use" message.
o Click the arrow next to the Open button and then click Open Exclusive Read-Only to open the
database for read-only access. Other users can still open the database, but they are limited to read-
only mode.
To open one of the last several databases you had open,
click the file name in the Recent list on the getting started page. Access opens the database with the
same option settings it had the last time you opened it. If the list of recently used files is not displayed:
Click File>Options.
In the Access Options dialog box, click Client Settings or Advanced.
Under Display, type a number in the Show this number of Recent Databases box.
Create a desktop shortcut to open a database object
Open the database containing the object for which you want to create a shortcut.
Resize the Access window and minimize any other open windows so that you can see the desktop
behind the Access window.
In the Navigation Pane, find the object for which you want to create the shortcut.
Drag the object from the Navigation Pane to the desktop. When you release the mouse button, the
shortcut is created on the desktop.
If you want the shortcut in a location other than the desktop, use Windows Explorer to move the
shortcut to the location you want.
Operation Sheet 3 Rearranging objects within the form
To Add a Command Button Using a Control Wizard
o Open the form in Design View
Verify the Control Wizards command is selected in the Controls group on the Form Design Tools
Design Contextual tab
Click the Button command in the Controls group on the Form Design Tools Design Contextual tab
Click on your form where you want the command button to be inserted
Figure 3.2. Command Button Wizard - Choose the Command Button Options
Set your command button option
Click Next
Figure 3.3. Command Button Wizard - Choose How the Button Should Work
Choose how the button should work
Click Next
Locate specific records in a database: As your database grows, locating specific records will involve more
than a quick glance at a datasheet. In this article, learn five ways to locate specific records based on your
needs.
Browse through all records you can browse through records by using the TAB key when you want to move
through one record at a time, in order, to locate a specific record. You can also browse through records in a
table in Datasheet view using the record navigation buttons. The record navigation buttons are available at
the bottom of the table or form.
Browse through all records You can browse through records by using the TAB key when you want to move
through one record at a time, in order, to locate a specific record. You can also browse through records in a
table in Datasheet view using the record navigation buttons. The record navigation buttons are available at
the bottom of the table or form.
The techniques that you can use to search and filter records are very useful for finding specific records for
the case at hand. However, you might want to perform the same search or filter operation regularly. Instead
of reproducing a set of search and filter steps every time, you can create a query. A query is a powerful and
flexible way to locate specific records because it lets you perform customized searches, apply customized
filters, and sort records. You can build your own queries to help you focus on specific records and to answer
specific questions. Once created, a query can be saved and reused, and can also be used in building forms
and reports.
Information Sheet 2 Creating Simple Query to Retrieve Information
A query is a request for data results, for action on data, or for both. You can use a query to answer a simple
question, to perform calculations, to combine data from different tables, or even to add, change, or delete
table data. A query is a derived item in the database meant
to answer specific questions that relate to the information in the database. It is the means to retrieve relevant
information in one or more tables.
2.1Types of Queries
Select Query
The select query is the simplest type of query and because of that, it is also the most commonly used
one in Microsoft Access databases.
Parameter Query
In Microsoft Access, a parameter query works with other types of queries to get whatever results you
are after.
This is because, when using this type of query, you are able to pass a parameter to a different query,
such as an action or a select query.
It can either be a value or a condition and will essentially tell the other query specifically what you want
it to do.
It is often chosen because it allows for a dialog box where the end user can enter whatever parameter
value they wish each time the query is run. The parameter query is just a modified select query.
A parameter query is a query that when run displays its own dialog box prompting you for information,
such as criteria for retrieving records or a value you want to insert in a field.
You can design the query to prompt you for more than one piece of information; for example, you can
design it to prompt you for two dates.
Access can then retrieve all records that fall between those two dates.
Parameter queries are also handy when used as the basis for forms, reports, and data access pages.
The following tables shows some sample criteria and explains how they work.
Criteria Description
This criterion applies to a Number field, such as Price or UnitsInStock. It includes
>25 and <50 only those records where the Price or UnitsInStock field contains a value greater than
25 and less than 50.
DateDiff ("yyyy", This criterion applies to a Date/Time field, such as BirthDate. Only records where the
[BirthDate], Date()) > number of years between a person's birthdate and today's date is greater than 30 are
30 included in the query result.
This criterion can be applied to any type of field to show records where the field value
Is Null
is null.
As you can see, criteria can look very different from each other, depending on the data type of the field to
which they apply and your specific requirements. Some criteria are simple, and use basic operators and
constants. Others are complex, and use functions, special operators, and include field references.
This topic lists several commonly used criteria by data type. If the examples given in this topic do not
address your specific needs, you might need to write your own criteria. To do that, you must first familiarize
yourself with the full list of functions, operators, special characters, and the syntax for expressions referring
to fields and literals.
Here, you will see where and how you add the criteria. To add a criteria to a query, you must open the query
in Design view. You then identify the fields for which you want to specify criteria. If the field is not already
in the design grid, you add it by either dragging it from the query design window to the field grid, or by
double-clicking the field (Double-clicking the field automatically adds it to the next empty column in the
field grid.). Finally, you type the criteria in the Criteria row
Criteria that you specify for different fields in the Criteria row are combined by using the AND operator. In
other words, the criteria specified in the City and BirthDate fields are interpreted like this:
What if you want only one of these conditions to be met? In other words, if you have alternate criteria, how
do you enter them?
If you have alternate criteria, or two sets of independent criteria where it is sufficient to satisfy one set, you
use both the Criteria and the or rows in the design grid.
4.1 Introduction
Data selection is defined as the process of determining the appropriate data type and source, as well as
suitable instruments to collect data. The primary objective of data selection is the determination of
appropriate data type, source, and instrument(s) that allow investigators to adequately answer research
questions.
4.2 The function of displaying data
Displaying data in research is the last step of the research process.
It is important to display data accurately because it helps in presenting the findings of the
research effectively to the reader.
To make the findings more visible and make comparisons easy.
Steps to browse through all records you can browse through records by using the TAB key when you
want to move through one record at a time, in order, to locate a specific record. You can also
browse through records in a table in Datasheet view using the record navigation buttons. The
record navigation buttons are available at the bottom of the table or form.
The Find and Replace dialog box appears, with the Find tab selected.
In the Find What box, type the value for which you want to search.
To change the field that you want to search or to search the entire underlying table, click the
appropriate option in the Look In list.
In the Search list, select All, and then click Find Next.
When the item for which you are searching is highlighted, click Cancel in the Find and Replace
dialog box to close the dialog box. Records that match your conditions are highlighted
Steps to create a query to find a specific record
On the Create tab, in the Queries group, click Query Design.
In the Show Table dialog box, double-click Issues, and then click Close.
In the query designer, double-click the asterisk (*) in the Issues table. This helps make sure that the
query will display all the fields from the records it returns.
Issues.* appears in the first column of the design grid, in the Field row. This indicates that all the
fields from the Issues table should be returned.
In the query designer, double-click Status on the Issues table.
Status appears in the second column in the design grid, in the Field row.
In the second column of the design grid, clear the check box in the Show row. This helps make sure
that the query does not display the Status field.
If you do not clear the Show check box in the Status column, the Status field will be displayed two
times in the query results.
In the second column of the design grid, in the Criteria row, type ="Closed". This is your search
criterion. This is how you make sure that the query will return only those records where the value of
Status is "Closed."
Note: In this example, only one search criterion is used. You can use many search criteria for any
given search by adding criteria to more fields, and by using the
Note: Unless you have already begun tracking issues and therefore have data in the Issues table —
and you have set the status of at least one issue to "Closed" — the query will not return any results.
However, you can save the query, and use it at any time in the future.
The simplest way to create a query is by using the Query Wizard. It presents a list of tables and queries you can select
from the current database.
StepsTo use the Query Wizard, 17
1. on the Ribbon, you can click the Create tab and, in the Other section, click Query Wizard . This would
display the New Query dialog box:
2. On the New Query dialog box, you can click Simple Query Wizard and click OK. The first page of the Simple
Query Wizard expects you to choose the origin of the query as a table or an already created query. After selecting
the table or query, the second page of the wizard would present the fields of that list and you can select those you
want:
The next page of the wizard allows you to specify the name of the query:
If the Show Tables dialog box is closed or for any reason you want to display it:
In the Query Setup section of the Design tab of the Ribbon, you can click the Show Table button
You can right-click anywhere on the query window and click Show Table...
When a query is displaying in Design View, the Design tab of the Ribbon displays the buttons used for a query:
One of the operations you can perform on the Query window consists of resizing its top and bottom sections by
dragging the splitter bar up or down:
Once you have decided on the originating object(s), you can select which fields are relevant for your query:
To select one field from the list, just click it
To select many fields on the same range, you can click one of them, press and hold Shift. Then click one field
on the other end of the desired range
To select fields at random, click one of the desired fields, press and hold Ctrl; then click each one of the desired
fields
To select all fields, you can click the * line on the list of fields
To Add Columns
To make a field participate in a query, you have various options:
Once you have made your selection on the list in the top part of the query window, you can drag it and drop it
in the bottom section of the query window
You can also select more than one field and drag them:
Instead of dragging a field or all fields, you can either double-click a field to add it to the query, or double-click
the line with * to add all fields to the query
In the bottom part of the query window, click an empty Field box to show a combo box. Then click the arrow
of that combo box and select an item from the list:
Executing a Query
To execute a query:
If the query is currently closed, from the Navigation Pane:
o You can double-click it
o You can right-click it and click Open
If the query is already opened and it is in Design View, on the Ribbon:
o You can click the View button or you can click the arrow of the View button and click
Datasheet View
If you manually write a SQL statement and want to execute it, change the view to Datasheet View.
Selecting a Column
Some operations require that you select a column from the bottom section of the query window:
To select a field in the lower section of the view, click the tiny bar of the column header:
Moving a Column
Columns on a query are positioned incrementally as they are added to it. If you do not like the arrangement, you can
move them and apply any sequence of your choice. Before moving a column or a group of columns, you must first
select it. Then:
To move a field
1. click its column header once.
2. Click it again and hold your mouse down,
3. drag in the direction on your choice
4. To move a group of columns, first select the group and then proceed as if it were one column
1. Click the QUERY DESIGN icon (located in the OTHER group of the CREATE ribbon). The
QUERY DESIGN window then opens along with the SHOW TABLE dialog form.
2. The next step is to add tblMoreNames to the QUERY DESIGN window. Do this by clicking ADD
in the SHOW TABLE dialog form. Notice it is the table containing the data to behappended that we
have selected.
3. Click the APPEND icon from the QUERY TYPE group of the DESIGN ribbon. As you do this, you
will see the APPEND dialog box open.
4. You are now asked to select the name of the original table to which the new data is to be appended.
So select tblContacts from the drop down list.
5. You are also asked whether this table is stored in the current database or in an external database. In
this exercise both tables are stored in the current database. This is the default button displayed in the
option group, so there should not be any need to change it.
6. Click OK to close the dialog box.
7. Next we are going to select the fields from tblMoreNames to be appended. To do this drag and drop
the Initials and LastName fields from the table (in the top half of the window) down onto the design
grid.
8. Next we are going to tell Access which fields the data from Initials and Lastname will be
appended to. To do this go down to the APPEND TO row of the design grid (see figure 3 below),
and ]select FirstName in the Initials column, and Surname in the LastName Column.
9. We could add query criteria at this stage, but this particular exercise does not require any. If we did,
however, this is added in the CRITERIA row just like it is with a select query.
10. If you want to view the data that is going to be appended, click the VIEW icon from the RESULTS
group of the DESIGN ribbon. It is especially important to do this if any if any criteria is applied in
step 9 above.
11. Once you are satisfied the correct data is going to be appended, click the RUN icon, again from the
RESULTS group of the DESIGN ribbon.
12. A dialog box opens informing us that 10 rows are going to be appended, and asking us to confirm
that we want to go ahead with this operation. Click YES to complete.
Note that Tom Gumman and Tina Gumman are currently employees.
To Add fields
1. In the field list of the Employees table, click-and-drag the * field to the first column of the
design grid.
3. In the field list of the Employees table, double-click the Last Name field.
To Add criteria
1. In the Last Name column of the design grid, click in the Criteria row.
2. Type: Gumman then press the ENTER key. It should look like this:
Note that Tom Gumman and Tina Gumman are no longer listed as employees.
2. Exit Microsoft Access.
Example 2
The Select Query has now been created. It should look like this:
It is advisable to run the query at this point and check the results are correct. They should look like this:
As you can see, our select query has found four records from tblContacts matching the criteria of Company
5". Since this is the correct result for the dataset we are working with, we can move onto the second stage
of the process: converting the Select Query to a Delete Query.
1. If you look at the QUERY TYPE group of the DESIGN ribbon, you will notice that the SELECT
QUERY icon is highlighted orange. We need to change this to DELETE QUERY. To do this just
click the DELETE QUERY icon further along the group.
2. After clicking the DELETE icon, you will notice that the row of SHOW tick boxes disappears from
the DESIGN GRID, along with the row for SORT. A new row entitled DELETE has taken their
place. Access has filled in the values of FROM and WHERE in the first and second columns
respectively. These are SQL Keywords: the FROM keyword indicates the first column contains
fields from tblContacts, and WHERE indicates the Company column contains a criteria against the
data stored in this field.
Figure 4: The QUERY DESIGN GRID for our DELETE Query. Notice the new row for DELETE
containing the SQL FROM and WHERE Keywords.
Steps to
2. From the Query Type button on the toolbar, select Make Table
The Make Table dialog box appears, where you should enter the name for the new table. Here we can
also select whether we want to create the new table in the current database or in another database.
Ensure that the current database is selected and click OK.
3. Select the mailing information fields, in our case CustomerTitle, CustomerName, Address, City,
Postcode from the Customers table, and OrderDate from the Orders table.
4. Specify the chosen City criteria in the City field and add the criteria required in the OrderDate field to
only show records from the last 12 months - using the DateAdd function: >=DateAdd("yyyy",-1,Now())
5. To check that the results are returned that we expect, click on the datasheet button on the toolbar.
Once you have verified this, switch back to query design view.
6. In query design, deselect the Show: property for the OrderDate field, as we do not need this to be
visible in our new table.
7. Click on the Run button on the toolbar. Microsoft Access now displays a message to indicate how
many records will be copied to the new table.
8. Click Yes to complete the query, and create the new table.
Using an Update QueryExample 1
1. When the Show Table window appears, select the tables that you wish to use in the query
2. Click on the Add button. When you have finished adding your tables
In this example, we've selected the Big and Bot tables. You can select multiple tables by holding down the
Ctrl key while selecting the table names.
4. Next, right-click somewhere next to the tables (but not on a table) in the query editor,
5. select Query Type > Update Query from the popup menu.
This query will update the MFG field in the Bot table with the value in the MFG field in the Big table when
the PART values match.
The SQL for this query is as follows:
UPDATE Big INNER JOIN Bot ON Big.PART = Bot.PART
SET Bot.MFG = [Big].[MFG];
Example 2
Here are the steps that we follow to produce the required outcome:
1. Create a new query using the Products table and the Suppliers table. Include the fields that you are
going to use to update the data (ProductID, ProductName and UnitPrice from the Products table, and
CompanyName from the Suppliers table)
We have also included criteria in the CompanyName field to limit the results to only those of the
Supplier that we are updating the records for.
Also, in the image below, you will see that we have included an additional field, just to test our
expression. This will give us a value for the 3% increase, just to check that the results will be returned
correctly. This field will be removed before we run the update, but we will use the expression later.
Creating a SELECT query, that will later be changed to the UPDATE Query
2. To check what results this will produce, run the query by clicking on the datasheet button
Example 3
1. Open the Products table.
2. Note the price (to customers) of French Truffles ($8.99) and Blue Mountain Coffee ($9.99).
3. Note the cost (to the store) of French Truffles ($6.15) and Blue Mountain Coffee ($8.00).
12. Type:
[Cost]*1.25
To Verify results
1. Open the Products table. It should look like this:
Note the updated price of French Truffles ($7.69) and Blue Mountain Coffee ($10.00).
2. Close the Products table.
Parametric Query
Example 1
1. View the query in design view
2. In the criteria cell for the appropriate field(s), type in the desired expression within the square brackets([ ])
For example, using a parameter to query for date valWhen the query is run, Microsoft Access displays this
text to prompt the user for the criteria. The text of the prompt must be different from the field name,
although it can include the field name.
3. Run the parameter query
4. When you are prompted to enter a parameter value, enter the value of the data that you want to view and
click OK.:
Steps To create and run a parameter query:
1. Create a query as you normally would, modifying the table joins if necessary, selecting the fields
to include in your query, and adding any non variable criteria to the appropriate fields in
the Criteria: row.
2. Locate the field or fields where you would like the variable criteria to appear, and place your
cursor in the Criteria: row.
3. Type the phrase you would like to appear in the prompt that will pop up every time you run your
query. Make sure to enclose the phrase in brackets [ ]. For example, in our parameter query that
searches for orders placed on a certain date, we might type our criteria like this: [What date?].
4. On the Query Design tab, click the Run command to run your query. A dialog box will appear
with the prompt you specified. Enter your search term, then click OK to view your query results.