Sie sind auf Seite 1von 13

Database Overview

A database is an electronic filing cabinet which makes it easy to quickly work with the data
sort them, create reports, merge the data with other documents, etc. A database is a collection of
objects that allow you to store data, organize it and retrieve it in any way you want.
It enables us to:
1. collect together sets of related data and keep the data organized
2. update the data once collected, adding or deleting records, or changing the contents of
existing records

MSAccess is a Database Management System. It handles data management tasks. A database is a


collection of objects that allow us to store data, organize it and retrieve it in any way you want.
with MSAccess1. we create structures called tables that allow us to organize the data so that it is easy to
find later
2. we create forms that let us input the data into the tables and
3. we create reports that print selected information from the tables.

Database Objects:
Access is an object-oriented relational database management system. The database objects that
we can create using Access are :
1. Tables - a collection of data about a specific topic, such as products or suppliers.
2. Queries - a command for viewing or analyzing data in different ways or a result of the
command.
3. Forms - a friendly interface to add a new record
4. Reports - an object that present data in an organized way according to your specification.
Examples are telephone bills, sales summary etc.
5. Macros - a set of one or more actions that each performs a particular operation, such as
opening a form or printing a report. Macros can help you to automate common tasks. For
example, you can run a macro that prints a report when a user clicks a command button.
6. Module - a collection of Visual Basic for Applications declarations and procedures that
are stored together as a unit.
Creating database through Table Wizard

When we create a database, we store our data in tablessubject-based lists that contain rows and
columns. For example, we can create a Contacts table to store a list of names, addresses, and
telephone numbers, or a Products table to store information about products.
Because other database objects depend on tables, we should always start our design of a
database by creating all of its tables and then creating any other objects.

A table is a database object that we use to store data about a particular subject, such as
employees or products. A table consists of records and fields.

Each record contains data about one instance of the table subject, such as a particular
employee. A record is also commonly called a row or an instance.

Each field contains data about one aspect of the table subject, such as first name or e-mail
address. A field is also commonly called a column or an attribute.

A record consists of field values, such as Contoso, Ltd. or someone@example.com. A


field value is also commonly called a fact.

1. A record
2. A field
3. A field value

Keys
Fields that are part of a table relationship are called keys. A key usually consists of one field, but
may consist of more than one field. There are two kinds of keys:

Primary key A table can have only one primary key. A primary key consists of one or
more fields that uniquely identify each record that you store in the table. Often, there is a
unique identification number, such as an ID number, a serial number, or a code, that
serves as a primary key. For example, you might have a Customers table where each
customer has a unique customer ID number. The customer ID field is the primary key of
the Customers table. When a primary key contains more than one field, it is usually
composed of pre-existing fields that, taken together, provide unique values. For example,
you might use a combination of last name, first name, and birth date as the primary key
for a table about people.

Foreign key A table can also have one or more foreign keys. A foreign key contains
values that correspond to values in the primary key of another table. For example, you
might have an Orders table in which each order has a customer ID number that
corresponds to a record in a Customers table. The customer ID field is a foreign key of
the Orders table.

you use the relationship to identify which data from the Customers table corresponds to which
records in the Orders table.

A table relationship, shown in the Relationships window.


1. A primary key, identified by the key icon next to the field name.
2. A foreign key note the absence of the key icon.

Create a new table


In a database, a table stores information for a group of things we call fields. For example, a table
might hold an address book, a stock list, a phone book or a price list. A database can have from
one to several tables.

Using the Wizard to create a table

A form is a database object that we can use to create a user interface for a database application. A
"bound" form is one that is directly connected to a data source such as a table or query, and can
be used to enter, edit, or display data from that data source. Alternatively, we can create an
"unbound" form that does not link directly to a data source, but which still contains command
buttons, labels, or other controls that we need to operate our application.

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. Queries that you use to retrieve data from a table or to make
calculations are called select queries. Queries that add, change, or delete data are called action
queries.

a file is a related collection of records. For example, you might put the records you have on each
of your customers in a file. In turn, each record would consist of fields for individual data items,
such as customer name, customer number, customer address, and so forth. By providing the same
information in the same fields in each record (so that all records are consistent), your file will be
easily accessible for analysis and manipulation by a computer program.

Data types
Think of a field's data type as a set of qualities that applies to all the values contained in the field
and that determines what kind of data those values can be. For example, values that are stored in
a Text field can contain only letters, numbers, and a limited set of punctuation characters. In
addition, a Text field can contain a maximum of 255 characters.
There are ten different data types in Access:

Attachment Files, such as digital photos. Multiple files can be attached per record.
This data type is not available in earlier versions of Access.

AutoNumber

Currency

Monetary values.

Date/Time

Dates and times.

Hyperlink

Hyperlinks, such as e-mail addresses.

Memo Long blocks of text and text that use text formatting. A typical use of a Memo
field would be a detailed product description.

Numbers that are automatically generated for each record.

Number Numeric values, such as distances. Note that there is a separate data type for
currency.

OLE Object

Text

Yes/No

OLE objects, such as Word documents.

Short, alphanumeric values, such as a last name or a street address.


Boolean values.

Creation of queries:

Select the Create tab in the toolbar at the top of the screen. Then click on the Query Design
button under the Other group.

Next, highlight the tables that you wish to use in the query. In this example, we've selected the
Employees table and clicked on the Add button. When you are done selecting the tables, click on
the Close button.

Add the fields to the query. You can do this by double-clicking on the field name. In this
example, we've added the LastName, FirstName, and Address fields.
Then click on the Save button at the top left of the window (this is the button with the picture of
the disk).

The Save As window should appear. Enter the name that you'd like to assign to the query and
click on the OK button. In this example, we've saved the query as Query1.

You should now see the query appear in the left window.

000000000000000
Microsoft Access advantages?
Easy to install and use Access gives data managers a fully functional, relational database
management system in minutes. Like many other Microsoft applications, Access contains
Wizards that walk you through each step of the way. The user interface is intuitive; accelerating
data information retrieval.
Ease to integrate Access works well with many of the developing software programs based in
Windows. It also can be used in the front-end as back-end tables with products like Microsoft
SQL Server and non-Microsoft products like Oracle and Sybase.
.NET-friendly Access is a go-to choice for users who plan to develop software using .NET;
linking to Access database. Its graphical user interface also offers easy functionality and set up.
Widely popular Microsoft Access is the most popular desktop database system in the world.
Saves you money Microsoft Access is hundreds of dollars more economical than other larger
systems; offering the same functions and usage.

Convenient storage capacity A Microsoft Access database can hold up to 2 GB of data.


Multi-user support About ten users in a network can use an Access application.
Importing data Microsoft Access makes it easy to import data.
creating reports in MS Access
Reports organize and summarize data for viewing online or for printing. A detail report displays
all of the selected records. You can include summary data such as totals, counts, and percentages
in a detail report. A summary report does not list the selected records but instead summarizes the
data and presents totals, counts, percentages, or other summary data only. Access has several
report generation tools that you can use to create both detail and summary reports quickly. This
lesson teaches you how to create reports.

There are many ways to create a report in Access. You can use the Report Wizard to generate a
report using Microsoft's step-by-step report wizard to create and format a report automatically.
This handles all of the "heavy lifting" so that you don't have to drag and drop controls.
A second way to create a report is to re-save an existing report and then make customizations to
the new report.
A third way is to create a report "from scratch". This is what we will do for the purposes of this
tutorial so that you understand exactly how to design and create your own reports.
To create a report, select the Create tab in the toolbar at the top of the screen. Then click on the
Report Design button in the Reports group.

This will allow you create a report and open that new report in Design View.

In this example, we are going to invoke the Query builder by clicking on the button with the
three dots to the right of the Record Source property.

When the Show Table window appears, select the table(s) that you'd like to use to populate your
report. In our example, we've selected the Suppliers table. Then click on the Add button.
Once you've added all of the tables that you need, click on the Close button.

When the Query Builder window appears, you can now build your SQL statement that will be
used to populate your report. In this example, we've chosen to select all fields from the Suppliers
table, but only those records where the SupplierID is less than 10.
You can now click on the X button on the top right of the window.
When prompted with the message box, click on the Yes button.

Now when you return back to the Properties window for the Report object, you should see your
SQL in the Record Source property.

How to add objects to report


Our next step in Access 2007 is to add objects from the Suppliers table to our report.
Since we've already specified our Record Source, Access gives us some nice features to quickly
drop objects onto our report.

Select the Design tab in the toolbar at the top of the screen. Then click on the Add Existing
Fields button in the Tools group.

Once you do this, you should see a Field List window display over top of where the Property
Sheet was displayed.

This window lists all of the fields that are available for your report to use, based on the Record
Source property.
To add one of these fields to your report, highlight the object in the window, and then drag it to
the location in the report where you wish to add this object.

Here we've added four text boxes to the report - SupplierID, CompanyName, ContactName, and
ContactTitle.

view the finished report