Documente Academic
Documente Profesional
Documente Cultură
Document1
2
Tutorial:
Access 2007
Access 2007 is the database application in the Microsoft Office 2007 suite. Get Access help designing an
Access database and sorting and filtering records, among other tasks.
Document1
3
10 Sorting Records
11 Filtering Records
Extras
Quiz
Document1
4
Access 2007:
Why Do I Need a Database?
INTRODUCTION
WHY DO I NEED A DATABASE?
What is a database?
Why not use Excel?
EXCEL EXAMPLE: CUSTOMER LIST AND ORDER TRACKING
Sorting and filtering to locate data in Excel
Data entry in Excel
ACCESS EXAMPLE: CUSTOMERS AND ORDERS TRACKING
Entering data in Access
CHALLENGE!
Introduction
Access 2007 is a program that allows you to create and manage databases.
A database is a place where you can store information related to a specific
topic. How you intend to use the information will determine whether you need
an Access database or a different program to create and manage your data.
Document1
5
In this lesson, we will discuss what a database does and how to decide
whether you need a database to manage your information.
What is a database?
A database allows you to store information related to a specific topic in an
organized way. In addition to storing data, you can sort, extract,
and summarize information related to the data. One of the software programs
that allows you to do this is Microsoft Office Access 2007, which is a database
creation and management program.
Document1
6
spreadsheet program like Microsoft Excel. How do you know which data can
be adequately managed with Excel and which data requires Access to manage
it more efficiently? It depends on how much data you have to manage and
what you want your data to do for you. Let's try to answer this by looking at a
bookstore scenario.
If you work for a bookstore business, you might have to keep track of your
customers and their orders. You could use Microsoft Excel to store and
manage this type of data; however, Excel is a spreadsheet software program
that is traditionally used to manage numerical information, like totaling up all
purchases by one customer. While it can do an adequate job of storing some
types of text-based datalike a customer's name and contact information
it's not really what Excel was designed to do.
The examples on the following pages will show you why an Access database
may be a better choice for the bookstore business.
Document1
7
However, if you want to see very specific results in your datalike how many
orders a single customer placed in a yearExcel is not as efficient as Access at
providing you with that data.
Document1
8
As you can see in the image above, customers Tonya Bullock and McKenzie
Grant each placed several orders on different days and for different books.
Their customer contact information was entered every time they placed an
order. This is the limitation of spreadsheet software such as Excel because it
is a single, flat file.
In addition to the table with customer information, you would probably also
want a table with information about the products you sell and another table to
Document1
9
hold data related to specific customer orders. These tables would be linked
together to help you make the most of your data.
In this example, the Customer Info and Orders tables are linked by Customer
ID and Book ID.
Now, let's assume that you want to identify the book that was most popular in
the state of North Carolina. With Access, this is possible because you can
search and retrieve information from multiple tables at the same time.
The Customer Info table contains information about each state, while
the Order Info table includes information about which books were ordered.
You will need information from both tables to identify the book that was most
popular in a specific state.
You could look at the information in these tables separately to answer your
question of which book was most popular in North Carolina. In the Customer
Info table, you could see all of the customers from a specific state: NC. And in
the Books table, you can see all of the books you have in stock. The real power
of Access comes in being able to link and extract information from multiple
tables to answer specific questions.
As you can see below, the results of your specific questionor queryare
displayed for you.
Document1
10
Challenge!
Try to answer these questions:
What is a database?
What type of software program is Microsoft Excel?
What type of software program is Microsoft Access?
What are at least two differences between Access and Excel?
Document1
11
Access 2007:
Exploring an Access Database
INTRODUCTION
EXPLORING DATABASES
Databases in our lives
Think about it
GETTING STARTED WITH ACCESS
OPENING A DATABASE
To view templates included with Access
To open an existing database
THE ACCESS WINDOW
The Ribbon
The Quick Access toolbar
The Microsoft Office button
The navigation pane
To open and close the navigation pane
PARTS OF A DATABASE
To change how objects are ordered in the navigation pane
Document1
12
Introduction
Once you have determined that an Access database will help you store and
manage your data, you will need to learn the parts of a database, how to start
using Access, and how to navigate the Access window. In this lesson, we will
provide a basic overview of Access, including the parts of a database and
common tasks you can complete using a database.
Exploring databases
Watch the video! (Part 1) (5:16min) (Part 2) (3:26min)
When you make a purchase, the store needs to be able to store the sales
information to determine the daily sales total and how to track the decrease in
inventory. A database could store this information, and it could also allow the
Document1
13
store to quickly determine how many Brand X toasters are in inventory
without needing to count inventory on the shelves.
Think about it
Think about what is going on around you in everyday situations and whether
there might be a database at work.
Grocery store: The grocery store is stocked with items. Items must be
ordered, shipped, and stocked in the store. The store must pay for the
items. When a customer buys items, the cash register retrieves prices
and the customer pays for products. Where might databases be
involved in this situation?
Document1
14
Restaurant: Where does the food come from? How does management
know when to reorder a product? How are bills paid?
Traffic lights: Who or what controls when the lights turn red or green?
A database maintains order and structure in our lives. Databases are created
using programs such as Microsoft Access 2007, which is a relational database
program.
In the example below, the featured templates are selected, and the template
options are displayed in the center area of the screen. Featured templates
Document1
15
include database template options that are available online, as well as
templates that are available as part of the local version of Access.
Opening a database
You have three main options on the Getting Started page. You can open a
template database stored locally or online, an existing database, or a blank
database.
Document1
16
In the left pane of the Getting Started window, you will see a list of categories
for the templates available on Office Online. You must have an Internet
connection to download these database templates.
The Blank Database command allows you to create a database from scratch.
la
OR
Click the More link. A dialog box will appear.
Document1
17
Document1
18
The Ribbon
Like other software in the Microsoft Office 2007 suite, Access 2007 has
a tabbed Ribbon system you use to navigate the database. The Ribbon is
organized into tabs. Each tab contains groups of commands you use to
perform tasks in Access.
For example, on the Home tab you'll see that there is a Font group that
contains font formatting commands such as font type, size, color, and
alignment. Unless you use keyboard shortcuts for everything, the Ribbon is
how you get work done in Access.
Document1
19
add them to the Quick Access toolbar. By default, the toolbar appears above
the Ribbon on the left side of the Access window and includes the Save, Undo,
and Redo commands.
Document1
20
Document1
21
Document1
22
Parts of a database
A Microsoft Access database is made up of several components,
including tables, forms, queries, and reports. These components are
called database objects. One or more of these objects is formed when a
database is created, and all of the objects appear in the navigation pane. To
make the database easier to navigate, beginner Access users may want to
reorder objects in the navigation pane.
Document1
23
Select a menu option. The navigation pane will appear reordered based
on your selection.
If you are new to databases, arranging the objects by type in the navigation
pane is usually a good idea. This will group tables, forms, queries, and reports
into individual groups in the pane.
Document1
24
Parts of a database
A database is made up of several components, or objects. These objects
include:
Tables
Queries
Forms
Reports
We'll look at each of these objects in more detail in later lessons, but you can
access them from the navigation pane like you can with tables.
Tables
A table is the database object that contains the basic information you want to
store. A blue and white icon represents the table in the navigation pane.
Document1
25
Queries
Another database object is called a query. A query allows you to retrieve
information from one or more tables based on a set of search conditions you
define using the table fields.
For example, if you want to know the name of the books that have sold in
Colorado and Kansas, you could create a query that would retrieve information
from multiple tables to determine the answer. In this example, you would
retrieve information from the Order Info table and Books table. Queries are
covered in more detail in later lessons.
Forms
A third database object is the form. Forms are an Access tool you can create to
make data entry in database tables easier.
Entering data directly into a table can be difficult if there's a lot of information
to enter. Similar to an Excel spreadsheet, an Access table is essentially a screen
filled with blank rows where you enter records. Forms, however, give you an
Document1
26
easy-to-read interface where you can enter table data. Forms are especially
useful for Access users who aren't comfortable working with databases.
Reports
The final database object is the report. A report is an effective way to analyze
and present data using a specific layout. The text can be formatted in an
Access report, just like it can be in Word documents.
To close an object:
Select the tab for the object you want to close. (The highlighted tab is
the active tab).
Right-click the tab, and select Close from the menu.
Challenge!
See if you can answer these questions:
Document1
27
Access 2007:
Thinking about Database Design
INTRODUCTION
DESIGNING A DATABASE
The Ready-2-Read bookstore scenario
Determine the purpose of the database
Plan database tables
Plan table fields
CHALLENGE!
Introduction
The first step in creating a database is to think about why you need itwhat is
its purpose? Once you know the answer, you can begin designing your own
database. Ask yourself questions like What kinds of information will it
store? How will I have to break down this information so it can be stored in
my database? How will I use the data once it's in there?
In this lesson, we'll walk you through the steps of database design using a
bookstore scenario. You will determine the purpose of the database and plan
the tables and fields you will need for a simple bookstore database.
Designing a database
Document1
28
Watch the video! (4:22min)
At Ready-2-Read, our customers will place orders for books. At the very least,
we will want our database to track the books we sell, the customers we sell
them to, and the date of each of the orders.
Document1
29
The database will also be able to tell us where our customers live when we
need to send them books or coupons. Additionally, we can use it to track our
sales or to make a bestseller list to post in the store.
TIP: Keep your database usable to others by giving your tables simple,
easy-to-understand names.
Let's look at our Ready-2-Read bookstore example again. There will be several
fields in our Customers table. We'll obviously want each customer's first
Document1
30
name and last name. We'll also need an address if we need to send a
customer his order. Email will be necessary if we need to contact the customer
if there is an issue with the order.
We will also need several fields in the Books table. Title and Author make
sense for books. We'll need a Price for each book. Category will help us know
what type of books sell the best so we can order more books that fit into this
category.
The Orders table will have fewer fields. We'll need this table to track
the Customer who is placing the order, the Book the customer is ordering, and
the Date the order is placed.
Document1
31
Don't worry if your plan doesn't include every possible field you may need.
Access lets you add fields to tables whenever you need another one!
Challenge!
Let's imagine that you want to use a database at your new coffee shop. Plan
your database by answering the following questions:
Document1
32
Access 2007:
Setting up Tables and Fields
INTRODUCTION
SETTING UP TABLES AND FIELDS
CREATING A NEW DATABASE WITH ACCESS
SETTING UP TABLES
NAMING A TABLE
To rename a table
To close a table
To open a table
ADDING MORE TABLES TO THE DATABASE
ADDING FIELDS TO A TABLE
To switch views
Adding fields in Datasheet view
Adding fields in Design view
Moving fields
Deleting fields
SETTING THE DATA TYPE FOR A FIELD
To change data type from the Ribbon
Introduction
Now that we have a handle on what the database should look like, we need to
work on setting up our tables and the fields within these tables.
In this lesson, we'll walk you through the steps of setting up a database in
Access 2007. You'll be setting up tables according to the plan for our
bookstore scenario. You'll also be setting up the fields for each table, including
establishing what data types can be entered in a given field.
Document1
33
You will also see the New Blank Database option, which allows you to build
your own database from scratch.
When you choose the New Blank Database option at the top of the window,
you will be prompted to rename the database from the default name, which
is Database1.accdb. Rename the database whatever you want. In the example
Document1
34
below, we named the database Ready2Read because it's the name of the
store in our scenario.
Setting up tables
The new database opens with one table showing as a default. It also defaults
to naming this table Table1 in both the navigation pane and the Table
tab itself. You will want to name your tables based on your database design
plan.
Document1
35
Naming a table
To give the table a unique name, you must first click on the Microsoft Office
button in the upper-left corner of the application.
Next, select Save from the menu. The Save As dialog box will appear to let you
save the table whatever name you want.
Document1
36
The new table names appear in both the navigation pane and the Table
tab itself, as you can see in the picture below.
To rename a table:
With the table closed, right-click the Table you want to rename in
the navigation pane. Select the Rename option that appears in the menu.
Document1
37
The table name will be highlighted and a cursor will appear, which means you
can now type the new name right there. Left-click anywhere outside of the
table name to make the change.
To close a table:
There are several ways to close an active table. You can right-click the Table
tab and choose Close from the menu.
A more common method is to click the X that appears in the top-right corner
of the active database object window.
To open a table:
To open a table, right-click the Table name of the table you want to open in
the navigation pane, then choose Open from the menu.
Document1
38
Next, select Table from the Tables command group. A new table will open in
the active database object window. You must name your table using
the Save command from Microsoft Office menu.
Document1
39
TIP: You can tell which table you are currently in by seeing which table tab
is highlighted.
To switch views:
Select the Views command group from either the Home tab (seen below) or
the Datasheet tab on the Ribbon. Select the view option you want from the
menu.
Document1
40
By default, Access 2007 creates one field in each new table: the ID field. This
field auto-numbers to give each record in the table a unique number identifier.
Recall that records are the rows in a table.
TIP: You may want to rename the ID field with a unique name because the
ID field appears automatically in every table you create. While this is not
necessary, it may help avoid confusion when setting up table relationships.
To add more fields to a table in Datasheet view, double-click the Add New
Field header.
The Add New Field text will disappear from the header. Name the field by
typing the name directly into the header. Press the Tab key on your keyboard
to move to the next field.
Document1
41
To add a new field to a table in Design view, click in the cell where you want
the new field and type the field name. When you switch back to Datasheet
view, your new field appears as its own column, as seen below.
In Design view, you have several field property options you can set to
ensure data can only be entered in certain formats. Setting these options is
a good idea if you want to make sure the data you have in your database is
good, strong data.
Moving fields
If you want to rearrange the order in which your fields appear in a table,
Access 2007 lets you easily move them around. To move a field in Datasheet
view, drag and drop the field to the location you want. To do this:
Click the field header for the field you want to move.
Document1
42
Move the mouse in the area of the header.
When the cross with arrows appears, hold down your left mouse
button.
With the left mouse button still held down, move the cursor to where
you want the field to appear.
Release the mouse button, and the field appears in its new location.
Deleting fields
To delete a field in Datasheet view, click the field header, then
select Delete from the Field & Column command group. This is found on
the Datasheet tab on the Ribbon.
WARNING: You should not delete any field in a table without first knowing
what impact the deletion may have on the rest of the database!
From the Data Type & Formatting command group on the Ribbon
From the Data Type column in Design view
Document1
43
The data type is more noticeable when the database is being populated with
records. It will cause data to be formatted for currency, text, number, and date
and time just like it does in Microsoft Excel.
Challenge!
Open Access 2007 and build your own database. Then do the following:
Document1
44
Add a new table.
Add fields to a table.
Set the data type for a field in a table.
Open and close the tables.
Move a field in a table.
Delete a field in a table.
Document1
45
Access 2007:
Building Table Relationships
INTRODUCTION
BUILDING TABLE RELATIONSHIPS
To establish a relationship between tables
To move a table that appears in the relationship map
UNDERSTANDING THE RELATIONSHIP MAP
Primary and foreign keys
RELATING TABLES
To relate tables with the drag-and-drop method
Understanding types of relationships
One-to-Many
Enforcing referential integrity
Editing existing relationships
CHALLENGE!
Introduction
By now, you've set up the tables you need for your database and have created
fields for the different tables. Relationships provide Access 2007 with the
means to bring this information together for you when you need it.
Document1
46
You should now see a relationship map that contains all of the tables
that were selected.
Document1
47
Document1
48
A primary key is the first field in each table of the database. You may recall
that this field auto-numbers by default, so every record in the table has its own
unique number to identify it. Access uses this number to quickly pull
information together when you run queries or reports, which are covered
later.
In the example above, the primary key for the Customers table is Customer ID,
the primary key for the Orders table is Order ID, and the primary key for the
Books table is Book ID.
A foreign key is a field that is the primary field in its own table but that shows
up in another table. If you look closely at the Orders table, the fields Customer
ID and Book ID appear there, as well as in their own respective tables. These
fields are the primary key in their own tables, but in the Orders table, they are
considered foreign keys.
Relating tables
There are a few ways to establish relationships between tables:
Both methods give you the same end result, but the drag-and-drop method is
much easier and saves you several steps.
Document1
49
Select a field name from one table by holding down the left mouse
button.
Drag the field name from one table to the other table in the desired
relationship.
Drop the first field name onto the field name you want to relate by
releasing the left mouse button.
In the example above, we selected the Book ID field from
the Books table and dragged and dropped it on the Book ID field in
the Orders table.
The Edit Relationships dialog box appears.
Document1
50
One-to-One
One-to-Many
Many-to-Many
The relationship type you will come across most frequentlyand the one
created in our bookstore scenariois the One-to-Many relationship.
One-to-Many
The One-to-Many relationship means data for that field will show up a single
time in one table but many times in the related table.
For example, let's look at one of the book titles in our bookstore. The Book ID
for the book should appear only once in the Books table because this table lists
every title stocked in the store. But it will probably appear many times in the
Orders table because we hope it gets ordered by many people many times.
Document1
51
The symbols for the One-to-Many relationship look like this:
You should click Enforce Referential Integrity to make sure you never have an
order for a book that doesn't appear in the Books table. Selecting this option
tells Access to check for these things when someone is working with your data
records.
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Document1
52
Open the database, and establish a relationship between the Books
table and the Orders table using the drag-and-drop method.
Establish a relationship between the Customers table and the Orders
table using the Edit Relationships command on the Ribbon.
Edit an established relationship by double-clicking the link.
Explore the options and settings in the Edit Relationships dialog box.
Move the tables around in the relationship map.
Document1
53
Access 2007:
Entering and Editing Data in Tables
INTRODUCTION
ADDING AND EDITING DATA IN TABLES
Adding records to tables
To add records in the new record row
To add records with the New Record navigation button
To add records with the New Record command
EDITING RECORDS IN TABLES
To edit a record directly
To edit a record using Find and Replace
To copy and paste a pecord
To delete a record
DATA VALIDATION
Data types and validation rules
To set data validation rules
Validation text
Using field properties to ensure data integrity
CHALLENGE!
Introduction
Document1
54
records from a table, as well as the importance of setting validation rules and
other field properties to ensure data is valid.
Document1
55
Document1
56
Click the cell containing the information that must be edited. A pencil
icon appears to indicate edit mode.
Document1
57
Tell Access what to find by typing it into the Find What: area.
Type the replace term in the Replace With: area.
Tell Access where to look with the Look In: drop-down list. The first
choice in the drop-down list is the field you were last in within the table.
Tell Access what to Match: Any part of the field, the whole field, or just
the start of the field.
Tell Access how to Search: Up finds records above the cursor, Down
finds records below the cursor, and All searches all records.
Click one of the action options:
o Find Next will find the next instance of the word in the table.
o Replace will put the new word into the table, overwriting what
is currently there.
o Cancel stops the editing process.
CAUTION: DO NOT use Replace All because it will overwrite every instance of the
Find term in the table, which can have a serious impact on your data.
To delete a record:
Document1
58
Select the record you want to delete, then right-click and select Delete
Record.
A dialog box appears, telling you the action cannot be undone and
asking if you are sure you want to delete the record.
There may be other records that rely on the record you are trying to delete. DO
NOT delete a record without knowing how it will impact the rest of your database.
When you delete a record, the record number is permanently deleted from the
database table. If you delete the last record from a table and then add a new record,
your new record numbers will appear to be out of sequence.
Data validation
Document1
59
Data validation is an important database concept. It is the process by which
Access tests the data that is being entered into the database to make sure it is
in an acceptableor validformat.
Let's say one of your database users has entered an order date of January 4,
2008, in the month/date/year format as 01/04/2008. Another user has
entered an order placed on that same date in the day/month/year format as
04/01/2008. If the database is tracking all sales for the month of January 2008,
it may not show both orders as placed in January, even though both were
placed on the same date.
Access 2007 allows you to set field properties and data validation rules to
force the person entering data to follow a specific format.
Data validation is accomplished by setting data validation rules and other field
properties for various fields.
Document1
60
In the Field Properties section at the bottom half of the window, set
your validation rule using the Expression Builder. The Expression
Builder offers common syntax to set up a data validation rule.
Document1
61
Validation rules work most easily with numerical fields. Rules for text fields
require you to enclose each acceptable value inside its own quotation
marks, separating them with Or, as seen above.
Validation text
Validation text is a specialized error message you can set to have Access tell
the user entering data the specific way you want that person to enter it.
To set the validation text, enter the error message exactly as you want it to
appear to users in the row directly beneath the Validation Rule row in
the Field Properties section of Design view. For the validation rule we set for
Category, you'd set the validation text like this:
The image below shows the resulting error message users would see when the
Category validation rule has been broken.
Document1
62
Another way to ensure data integrity is by setting field properties such as Field
Size, Format, and Required.
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Open the database, and add records using the New Record navigation
button.
Add a record using the New Record command in the Ribbon.
Set a validation rule and validation text for a field in one of your tables,
then break the rule when entering data to read the resulting message.
Document1
63
Access 2007:
Creating and Using Forms
INTRODUCTION
CREATING AND USING FORMS
Why use forms?
CREATING A FORM
To create a form using the Form command
USING FORMS TO ENTER DATA
To add a record using a form
To edit records using a form
CREATING A DROP-DOWN LIST
To create a drop-down list using a Combo Box control
CHALLENGE!
Introduction
Document1
64
In previous lessons, you saw that you can populate a database by entering
records into the tables themselves. If the database has hundreds of records
and many fields to populate for any given record, a table can be overwhelming
to a user entering data. An Access form lets you enter data one record at a
time, without having to see the entire table.
Document1
65
An Access 2007 form also lets you know exactly what information to enter and
can even tell you what that information should look like. Adding certain
control components to a formlike a drop-down menucan
dramatically increase the integrity of the data that is held in a database.
A database owner wants to control the levels of access other database users
have to the data; the fewer the amount of people who are interacting with the
data, the lower the chances are of the data becoming compromised. Forms are
one more way a database owner can limit the actions of other users. Form
properties can be set so users can only enter records or just view records.
Creating a form
Access 2007 has several automatic tools for creating forms. These tools are
located in the Forms group on the Create tab in the Ribbon, as seen below:
Document1
66
The Form Wizard is hidden under the More Forms command. It walks
you through the process of creating more customized forms.
The newly created form has the same name as the source table by default.
You can give the form a new name by saving the form. You will be
prompted to give the form a name.
Document1
67
Document1
68
Drag and drop the combo box sizing tool to create the combo box
where you want it to be on the form.
Document1
69
Choose the desired option from the wizard, and click Next.
Because the middle option was selected in the example above, the
wizard progresses to the next step, which asks for the values to be
typed into a small table.
Document1
70
Next, the wizard asks what to do with the entered values. Access can
either remember the values for later use, or it can populate a field with
the entered values. Use the drop-down list to select which field Access
should use to store the values.
Document1
71
this or another combo box. If you want, give the combo box a name,
then click Finish.
Whatever name is entered will appear as a label on the form. This label can
be deleted if you want.
Switch to Form view to see how the combo box works. The Category drop-
down list appears on the Books form, as seen in the image below.
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Scroll through the customer records using the Customers form.
Document1
72
Category: Travel
Price: $34.99
o Title: Cars and Trucks
Author: Jonathon Bradley
Category: Kids
Price: $14.99
Using the Combo Box command, create a drop-down list on the Books
form for the following categories:
o Fiction
o Nonfiction
o Kids
o History
o Technology
o Home & Garden
o Travel
o Food
Add another record to the database using the Books form with the
drop-down category selector.
Use the Find and Replace command to change the price of all books
that are $14.99 to $16.99.
Access 2007:
Making Forms More Usable with Controls
INTRODUCTION
MAKING FORMS MORE USABLE
Document1
73
Making forms more useable
SETTING FORM PROPERTIES
To set form properties
HIDING FIELDS ON A FORM
To hide a field on a form
CREATING COMBO BOXES
SETTING FIELD PROPERTIES
To set field properties from a form in Design view
To set a field to auto-fill with the current date
CREATING COMMAND BUTTONS
To add a command button to a form
CHALLENGE!
Introduction
Document1
74
You already know that forms can help you increase the integrity of your data
by limiting what you see and how you can enter data. You saw that using a
drop-down list can make data entry easy. Now it's time to think about the
design of your forms from a form user's perspective.
Let's look at the Orders form in our bookstore scenario. The basic form, which
was created with the Form command, looks like this:
This form is where we would want our userthe store employeeto pair a
customer with a book to complete an order. Let's look at the form from the
user's point of view:
The employee would be adding new orders, not editing existing ones, so
we'll set form properties to limit this action.
The user will also never need to enter the Order ID number because this
is the number the database assigns each order record to differentiate it
from other orders. We'll hide this field.
The Customer ID field and the Book ID field are not too useful as they
are because the employee would have to know each customer's ID
number and every Book ID number to be able to enter the data in the
format we need. We'll make these fields more useable by creating
combo boxes that help users select the correct customer and book.
Our user will not need to enter the Order Date because we want the
database to auto-populate this field in the database using today's date.
We'll set field properties to make this happen.
Document1
75
Document1
76
When the property sheet opens:
o Make sure Form is selected in the Selection type drop-down list.
o Set the desired form properties.
Tip: Use the tabs to find the specific property you want to set. Use the help
available to you in the bottom-left corner of the Access window to know
what each property setting does.
Document1
77
Document1
78
Document1
79
Document1
80
Because we want the Order Date to auto-fill, we must set the default value to
always enter the current date.
Document1
81
Document1
82
Document1
83
Report Operation command buttons, which offer users a quick way to
do things such as preview or mail a report
Document1
84
o Click Finish.
The command button should be operational and appear on the form in Form
view.
Challenge!
Document1
85
If you haven't already done so, save the sample Ready2Read database to your
computer.
Open the Orders Form, and change the form properties so it limits users
to adding records only.
Hide the Order ID and Order Date fields.
Set the Order Date field property to have a Default Value of the current
date.
Create drop-down lists for the Customer ID and Book ID fields, making
sure they contain helpful information for users and correctly populate
the database with ID numbers.
Add a command button to the form.
Document1
86
Access 2007:
Making Forms Attractive
INTRODUCTION
MAKING FORMS MORE ATTRACTIVE
Making forms more attractive
To switch to Layout view
ADDING A LOGO
To replace the icon with a logo
APPLYING A STYLE WITH AUTOFORMAT
To apply an AutoFormat
WORKING WITH TITLES
To change the form title
CHANGING TEXT ON THE FORM
To modify text
WORKING WITH OBJECTS ON A FORM
To move objects on a form
To resize objects on a form
To apply a border to objects on a form
CHALLENGE!
Introduction
In Layout view, you see the form as it will appear to the user in Form view, so
it's useful for setting the size of controls and other objects on the form, as well
as for changing the font, colors, and borders on the form.
Right-click the Form tab or the form name in the object list, then
select Layout View from the list.
Select Layout aView in the Views group on the Ribbon.
Click the Layout view icon in the bottom-right corner of the Access
2007 window.
Adding a logo
Access 2007 automatically puts a form icon, like the one below, in the header
area of every form you create.
Document1
88
One way to customize the look of your forms is to remove the icon and replace
it with a logo. This is easy to do using the Logo command.
Use the Insert Picture dialog box to locate the picture file you want to
use as the logo, then click OK. The new logo should appear.
You can move and resize the logo as well. Moving and resizing objects on a
form is covered later in this lesson.
Document1
89
Another simple way to dramatically change the way your form looks is to apply
a style with the AutoFormat command. You could modify the color for each
part of the form on your own, but Access has already combined colors in
several attractive styles. These styles are available under the AutoFormat
command.
To apply an AutoFormat:
Click the AutoFormat command on the Ribbon.
Select the desired format. The change will appear when the mouse
button is released.
Document1
90
When the title highlight appears, type the new title, then hit the Enter
key on your keyboard.
Note: The title does not affect the name of the form, and vice versa.
Document1
91
To modify text:
Highlight the text.
Apply the desired format by doing one or more of the following:
o Select the desired font style from the font face drop-down list.
o Set the size of the text using the font size selection list.
o Choose a color for the text using the font color selector.
Additional text formatting options are available in the Font group. The
above list includes the most common text modifications.
Document1
92
Highlight the object by clicking it.
Select a width using the Line Width command.
Select a style using the Line Style command.
Select a color using the Line Color command.
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Open the Orders Form in Layout view and change the form by:
Document1
93
Access 2007:
Sorting Records
INTRODUCTION
SORTING RECORDS
Sorting records
SORTING ON TEXT VALUES
To sort based on a text value
SORTING ON NUMERICAL VALUES
To sort based on a numerical value
To clear a sort
CHALLENGE!
Introduction
Sorting records
Watch the video! (3:34min)
Document1
94
Download the example to work along with the video.
Sorting records
Sorting is probably the simplest way to look at data because it keeps similar
things together. In our bookstore database, for example, we could sort our
data a few ways:
Access 2007 allows you to sort the records in your database tables based on a
field or value that is either textlike an author's last nameor numerical
like a customer's zip code or a book's price. Depending on the type of value,
Access offers different sorting options.
Document1
95
When the menu appears, select either the Sort A to Z or the Sort Z to
A option.
o With A to Z, the records will be sorted based on the chosen field's
value with the value closest to A at the top of the table, as seen
below.
o With Z to A, the records will be sorted the using the chosen field's
value with the value closest to Z at the top of the table.
Document1
96
Document1
97
o With Highest to Lowest, records will be sorted the using the chosen
field's value, with the value farthest from 1 at the top of the table, as
seen below.
The sort commands in the Sort & Filter group on the Ribbon
can also be use to begin a sort.
To clear a sort:
o Click the Clear Sort command in the Sort & Filter group on the
Ribbon.
Document1
98
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Open the Customers table and the Books table.
Document1
99
Access 2007:
Filtering Records
INTRODUCTION
FILTERING RECORDS
Filtering records
FILTERING BY FIELD
To use the Filter by Field feature
To toggle between filtered and unfiltered results
FILTERING BY SELECTION
To use the Filter by Selection feature
SORTING OR FILTERING THE FILTERED RESULTS
USING ADVANCED FILTERS
To apply an Advanced Filter
To save the Advanced Filter
CHALLENGE!
Introduction
Document1
100
Filtering records
Watch the video! (7:10min)
Download the example to work along with the video.
Filtering records
When you tell Access 2007 to filter your records, you are asking it to:
Display the results for you in the table by hiding records that do not
meet the criteria
You can filter data using what Microsoft calls the Filter by Field and Filter by
Selection methods. Additionally, Access 2007 can perform an Advanced Filter,
which is essentially a small query that is run on only one table. These options
are described in the table below.
Method Description
Lists all of the values that have been entered in a
specified field so you can choose which value or
Filter by Field values you want Access to find
Offers the ability to search records based on the
value that is currently selected in a table; you can
ask it to find records that:
Equal the value
Filtering by field
Document1
101
When you Filter by Field, Access 2007 finds all of the values that have been
entered in the specified field. Access lists all of these values for you so you can
choose which value or values you want Access to find for you within that field.
Once you choose which value to filter by, Access returns the results to you as a
subset of records in the table.
When the dialog box appears, select the value you want to use as the
filter value:
o Checking Select All will return every record in the table. However,
clicking this option when all values are checked will clear the
selections.
o Checking Blank will find only records in which the field is empty.
Document1
102
Click OK.
The results will appear in the table. In the example above, the results are
showing all records for customers living in North Carolina (NC). Notice that all
other records are hidden from view but that the table name is still Customers.
Use the label that appears in the navigation bar, as seen above
Use the Toggle Filter button on the Ribbon
Document1
103
Filtering by selection
When you Filter by Selection, Access 2007 returns the results to you as a
subset of records in the table. It assumes that your current selection is what
you want to use as your filter value, or criteria.
Document1
104
In the table showing your filtered results, select the field or value you
want to use as the basis for a deeper sort or filter.
Apply the additional filter or sort.
Document1
105
o From the menu that opens, select the Advanced
Filter/Sort option.
o The design screen will open so you can set up your filter criteria
and/or sorting order for the various fields in the table.
o To sort or filter another field, drag the field name from the
table at the top of the screen to the design portion of the
screen in the bottom half of the window. Then:
o To sort the new field:
Document1
106
Important: Access will perform the sorts left to right, according to the way
they are displayed on the Advanced Filter design screen. Once all of the
sorts are complete, Access will perform filter functions. Similar to sorts,
Access filters from left to right based on the order displayed on the
Advanced Filter design screen.
To view the results, click the Toggle Filter button on the Ribbon.
Your filtered results will appear in a new table. You can save the advanced
filter so you can run it again later if you want.
If the Save as Query dialog box comes up, you must give the advanced
filter a name.
This dialog box will only appear the first time you save.
Access 2007 saves Advanced Filters as queries because they are simple
queries run on only one table.
Document1
107
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Use the Filter by Field method to filter the Customers table to find all
customers from NC.
Use the Filter by Selection method to filter the Customers table,
looking for all NC customers NOT in Raleigh.
Hint: Use the Does Not Equal option.
Practice toggling between the filtered results and the unfiltered tables.
Apply an Advanced Filter on the Books table to find all of the Kids
books, sorted by price with the highest price first.
Save your Advanced Filter with whatever name you choose.
Document1
108
Access 2007:
Using Queries to Make Data Meaningful -
Part 1
INTRODUCTION
USING QUERIES: PART 1
Using queries
PLANNING A QUERY
Planning: Which customers ordered technology books?
USING THE QUERY DESIGN COMMAND
To build a query using the Query Design command
HIDING FIELDS OR OTHER INFORMATION IN THE RESULTS
To hide part of the query result
SAVING THE QUERY
To save a query
CHALLENGE!
Introduction
Document1
109
run a query, as well as how to modify the query to hide fields or other
information in your query results. Finally, you'll learn how to save the query
for later use.
Using queries
Queries retrieve information from one or more tables based on a set of search
conditions you set up and then combine that information in a way that's easy
for you to analyze. If you've used an Advanced Filter in Access 2007, then
you've already run a basic query on only one table. If you want to pull data
from more than one table, though, you'll need to use either the Query
Design command or the Query Wizard.
Before using the Access 2007 query tools, it's important to plan out the query
using a logical process. Otherwise, you may not get the results you expect.
Planning a query
There are three questions you need to answer when planning a query:
What do you want the results to look like? Identify every bit of
informationor fieldyou want included in the results.
Where is the information stored in the database? List which tables
and/or querieshold the information you want to see.
What conditions do you want the data to meet? This helps determine
how to set the criteria so Access can search the records properly.
Document1
110
Let's think about this process for our bookstore database scenario. We have a
new technology series coming out soon, and we want to send coupons to
customers who have ordered technology books from us in the past. A query
can help us answer the question, Which customers have ordered technology
books from us already? Let's use the three-question process to plan this
query.
In which tables is the information stored? For this query, we'll need:
o The Customers table to get customers' names and addresses
Document1
111
Use the Show Table dialog box to select which tables and/or queries to
include in the query. Our plan called for all three tables.
Document1
112
Drag and drop the fields you want to see in your results to the bottom
portion of the query design screen.
Document1
113
Enter the condition in the Criteria row for the condition field. For our
query, we typed Technology in the cell labeled Criteria for
the Category field. As seen above, Access 2007 puts quotation marks
around the term to show that it is looking for exactly that term within
the designated field.
Once the condition is set, click Run! in the Results group on the Ribbon.
Document1
114
When you run your results, the field you chose will be hidden, as seen
below.
Document1
115
To save a query:
Right-click the Query tab.
When the Save As dialog box opens, give your query a meaningful
name.
Click OK.
Document1
116
The query will now be listed in the object list on the left side of the
Access window.
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Plan a query to find out which customers order a certain category of
books.
Use the Query Design command to set up the query.
Document1
117
Access 2007:
Using Queries to Make Data Meaningful -
Part 2
INTRODUCTION
USING QUERIES: PART 2
USING TOTALS IN A QUERY
USING COUNT AND GROUP BY FUNCTIONS IN A QUERY
To use the Count and Group By options in a query
SORTING AND FILTERING QUERY RESULTS
To sort via the query design
To filter via the query design
CHALLENGE!
Introduction
Document1
118
One of the most useful totals functions to use in queries is the Count function.
Let's use our bookstore database as an example. If we run a query to see the
information for every book that has been ordered, we'd get a list that looks
like this:
Document1
119
Notice that we get a record back for every order of each book that has been
ordered.
In our bookstore example query, we want to see these titles grouped together
so we see each ordered title only one time. To do this, we use
the Count and Group By options.
Document1
120
The Total row will instantly appear in the bottom portion of the query
design screen.
Click in the Totals row for the field you want to count. We want to
count the number of times the same Book ID appears in
the Orders table.
From the list of optional Totals functions, select Count.
Document1
121
Click Run! to see your results. Notice that each title, author, price, and
category is now listed only one time for each book, with an extra
column that indicates the number of times the Book ID appeared in the
Orders table.
Document1
122
Challenge!
Document1
123
If you haven't already done so, save the sample Ready2Read database to your
computer.
Create a query that uses the Count and Group By options.
Document1
124
Access 2007:
Using Reports to Make Data Meaningful to
Others
INTRODUCTION
USING REPORTS TO MAKE DATA MEANINGFUL TO OTHERS
CREATING A REPORT BASED ON A TABLE
To create a report based on a table using the Report command
CREATING A REPORT BASED ON A QUERY
To limit the number of records in a report
GROUPING ITEMS ON A REPORT
To add grouping to a report
FORMATTING A REPORT IN LAYOUT VIEW
To delete a column or other report element
To move a column or other report element
To resize a column or other report element
To add a logo to the report
To modify the title of a report
To modify text in report headings
To apply an AutoFormat style
To change the page layout
To change the page layout options
SAVING A REPORT
To save a report
CHALLENGE!
Introduction
Document1
125
Access 2007 offers tools that allow you to create and format a report.
The Report Wizard walks you through the steps of creating a report.
The Report command, however, is much easier to use, and all of the
formatting options are still available to you in Layout view once the report is
created. With these tools, you can create a report based on a table or query.
Document1
126
lists all of the details for each book in our store's inventory.
The Report command makes this incredibly easy because it automatically
includes every field in the source table in the report.
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.
Document1
127
The layout and formatting of the report can be manipulated in Layout view.
It's 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.
Document1
128
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.
Document1
129
This opens 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 want to group by from the drop-down list. We chose
to group our list by Category.
Document1
130
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.
Document1
131
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:
Document1
132
When the Insert Picture dialog box opens, find the picture file.
Click OK.
Document1
133
Document1
134
Select a format from the drop-down list. The change is applied instantly.
Document1
135
Switch to Print Preview using the Views command on the Ribbon.
Select the layout option you want to alter from the Page
Layout command group on the Ribbon.
All of the standard Microsoft page layout options are available, including:
Page Layout
Option Description
To set the margins for narrow, wide, or
Margins normal
To select either
Orientation a portrait or landscape orientation
Size To set paper size
Saving a report
When you have created and modified a report and try to close it, Access 2007
will prompt you to name and save the report. If you do not need this report
Document1
136
again, you do not need to save it. However, if you think you may want to
publish it again, it is best to save.
To save a report:
Right-click the Report tab.
Choose Save from the list that appears.
When the Save As dialog box opens, give the report a name.
Click OK.
Challenge!
If you haven't already done so, save the sample Ready2Read database to your
computer.
Create a report based on a table.
Document1
137
Document1