Introduction to Microsoft Access 2010®

OBJECTIVES

Introduce the new
MS Access 2010 interface.

Define common database
features and terminology

Identify features of
MS Access 2010

Develop MS Access
2010 tables

Create MS Access
2010 forms

Create MS Access
2010 queries

Create MS Access
2010 reports
Tips:
T
he new Ribbon always
displays five tabs. There are
close to 1,000 commands on
the ribbon.
L
ayout View is new to forms
and reports. With the click
of a button a form or report
can be created. Changes can
be made in layout view while
you browse the form or report.
Fall 2011
Introduction to
Microsoft Access 2010®
Introduction
Microsoft Access 2010 is a relational database management system.
This workshop will examine the newly revamped Access 2010 interface.
In addition, participants will learn how to create and work with
tables, including data types, field properties, validation of data, lookup tables, data entry and more. Participants will also create and work
with forms, queries and reports. Users will become familiar with
associated terminology and the new terminology of Access 2010.
Participants will learn the basics of designing and creating an efficient
and productive database. Prerequisite: Windows or Macintosh proficiency.
Getting Help
The ITS Help Desk, located in 108 Allen Hall, is a service provided
to all Mississippi State University faculty, staff, and students. The
ITS consultants are available to help with various computer-related
problems, as well as provide answers to computer and technologyrelated questions. Visit the Web site at www.its.msstate.edu for
handouts and resolutions to common computer problems. If you
cannot find an answer to your question on the Web or you do not
have access to the Internet, please call at 325-0631 (8:00 a.m. to 5:00
p.m. Monday through Friday). You may also contact the ITS Help
Desk by email at [email protected].
Instructor
Quan Thien Chung
[email protected]
Table of Contents
The Getting Started with Microsoft Office Access Window
File Tab
Microsoft Access 2010 Interface................................................................................... 3
Database Objects........................................................................................................... 8
Creating a Database....................................................................................................... 9
Creating Tables - Design View and Datasheet View.................................................... 10
Importing a Table............................................................................................. 14
Master Table with Field Names, Data Types, Descriptions and
Field Properties...................................................... 14
Descriptions, Captions and Lookup Tables...................................................... 15
Look-up Wizard............................................................................................... 16
Input Mask....................................................................................................... 18
Validation Rule and Validation Text................................................................. 19
Using the Totals Icon with Tables.................................................................... 20
Creating A Form with the Wizard................................................................................. 21
Creating a Form in Layout View....................................................................... 24
Label or Title on a Form and Formatting Tools................................................ 25
Creating Queries........................................................................................................... 27
Select Queries and Parameter Queries.............................................................. 28
Comparison Operators in Queries..................................................................... 29
Compound Criteria Or and AND in Queries..................................................... 30
Computed Fields in Queries.............................................................................. 30
Summary Queries.............................................................................................. 31
Creating Reports........................................................................................................... 32
Report in Print Preview..................................................................................... 34
Report in Layout View...................................................................................... 35
PowerPoint Slides......................................................................................................... 36
2
Quick Access Toolbar
Create a Blank Database
Recently Opened
Databases
Prebuilt Templates
Browse folder to find
existing database
3
Help
Ribbon
Home Tab
The Home tab provides common commands that are used in most non-design views.
Views
The View icon is used to switch to another view of an open object.
Clipboard
Commands used for managing data to and from the clipboard.
Sort & Filter
Commands for sorting and filtering data.
Records
Commands for working with records, like deleting records, totaling columns and check
spelling.
Find
Commands for searching for data and/or searching and replacing.
Text Formatting
For formatting text in a rich text field. (Text has different colors, fonts, alignment, etc.)
Create Tab
The Create tab gives you access for creating database objects.
Tables
Commands are used to create new tables. (or link to SharePoint services)
Queries
Commands are used to create queries.
Forms
Commands are used to create new forms from scratch, from wizards or using the Form
command where with one click on the Ribbon, a form is created in the new Layout View.
Reports
Commands are used to create new reports from scratch, from wizards or using the Report
command where with one click on the Ribbon, a report is created in the new Layout View.
Macros & Code
Commands are used to create macros or modules.
Tabbed Documents
Document Window
Navigation Pane
(Replaces Database
window from previous
MS Access versions.)
Status Bar
View Controls
File Tab
The File tab contains commands that apply to the entire database.
The File tab replaces the Microsoft Office
Button and contains the new Backstage
view.
Many of the commands found in the File
menu of previous Microsoft Access versions
are now found here.
4
5
External Data
Commands for importing and exporting data.
Import & Link
Import or link to data from other sources.
Export
Export data to other file types.
Collect Data
Import contact records directly from MS Office Outlook 2010. Export from MS Access
to MS Office outlook as well.
Share information over the Internet with SharePoint Services.
Web Linked Lists
Database Tools
Shutter
Bar
Navigation pane drop-down Example of Navigation pane
list
arranged by Object Type
Example of Nav pane arranged by
Tables and Related Views
The Database Tools tab for working in MS Access 2010.
Tools
Tools for compacting and repairing for optimal performance and to limit corruption in
database.
Macro
Commands that work with Macros and Visual Basic.
Relationships
View, create, and edit table relationships and object dependencies.
Analyze
Run reports with the Database Documentor or one of the analyze wizards, Analyze
Performance or Analyze Table.
Move Data
Used for moving data to a SQL Server or a separate Access database.
New Group
User created group to contain user specified commands.
Tips:
Collapsing the entire Ribbon - Double click on any of the tabs or CTrL+F1.
Uncollapsing the Ribbon - Click on a tab or CTrl+F1.
6
The Navigation pane is docked on the left side of the page. Open database objects appear to the right
of the pane in the Document Window. The Navigation pane gives you easy access to any of your
objects. The Navigation pane drop-down list has Navigate To Category and Filter By Group. The
Navigate to Category determines the way objects are arranged in the Navigation pane. The Filter By
Group, determines which objects are hidden from view.
Example of Navigation pane
viewed by Details
Tip:
Tables and Related Views - After a
change is made to a table, test each of the
related objects to see if it still works.
7
Security Warning and Trusted Locations
Tables organize data into rows called records and columns called fields. Records and fields
combined make up the table. Each table is a collection of data about a specific topic.
Data Types
Text - 0-255 ch - Default
Memo - 0-64,000 ch
Number - Numeric values
Date/Time - Date and time data
Currency - Monetary data
Autonumber - Automatic Number increments
Yes/No - Logical Values , also True/False, On/Off
OLE object - Pictures, graph, sound, video
Hyperlink - Link to an Internet source
Lookup wizard - Displays data from another table.
Attachment - Separate file(s), installed in their native
format in a single field.
Field Properties
Field Size - Text - limits size of field to specified ch.
Numeric - Allows specification of numeric type
Format - format data
Input Mask - Sets data entry into a predefined format
Decimal Places - Sets number of decimal places
Caption - Replaces field name on form and report if used.
Default Value - Fills in automatically on data & form
entry if placed here.
Validation Rule - Data is validated based on rules placed
here.
Validation Text - Message displayed if Validation Rule
broken.
Required - Specify if data must be entered.
Indexed - Speeds up data access. Can limit data to unique
values if set to [Yes - No Duplicates].
The form is where you normally enter, display and edit your data. It provides greater
flexibility than a table. As you enter data into a form you are simultaneously adding it to the
table.
A query is either a question about the data stored in your tables or a request to perform an
action on the data.
Reports give you control in presenting your data. They are exceptionally good for sorting
and grouping data and for providing subtotal and summary calculations.
8
MS Access 2010 will often pop open a Message Bar with the message: Security Warning
Certain content in the database has been disabled. This may unnecessarily prevent you from
continuing. This message may be caused by macros, action queries or various other code. To
continue working you can click on the Options button on the Message Bar and select Enable This
content.
A preferable solution is to place your trusted databases into a folder that you tell Access to trust. To
do this, firs select the File tab and then from within the Access Option window select Info in the
left pane. Click the button, Trust Center Settings... Select Trusted Locations in the Trust Center
window. Click on the Add new location... button. Browse to the folder where you will be placing
your Access databases. Select Subfolders of this location are also trusted. Click OK several
times to close out the Access Options. You will need to close and reopen the database. You will no
longer receive Message Bar Security Warnings for databases you place within this folder.
Opening a Database
1. To start Microsoft Access 2010 double-click the Microsoft Access 2010 icon in the Novell-delivered
Applications window.
2. First we will create the file to hold the
tables, forms, queries and reports we
will be using for this project. Select the
Blank Database icon under the New
Blank Database header in the center
pane of the page.
3. In the right pane of the database, under
Blank Database, in the FileName:
textbox type in MSU101. Click on the
Browse icon.
9
4. Browse to the Temp folder on the Desktop.
Click OK. When you are returned to the
Getting Started with Microsoft Office
Access page, click the Create button.
Note:
In Microsoft Access 2010, databases have the
file ending accdb. The new file type is used to
make the database more compact, for easier
recovery of corrupted data and for some of the
new features like attachments and fields with
multiple values.
For better viewing, click the maximize
button to expand the screen.
Tables
A collection of data about a specific topic. Tables organize data into rows called records and
columns called fields. Records and fields combined make up the table. First we will create
our tables. Tables are the foundation of a database.
We will be creating the following tables:
tblStates
Contains the list of states
tblCities
Contains the list of cities
We will import the table tblStudents.
tblStudents
Contains the names and information on the students
1. The Navigation pane opens to
All Tables. Select the
drop-down arrow in the
Navigation pane and select
Object Type.
2. In the Document window
Table1 in datsheet view
is displayed. Click on the
View icon to switch from
Datasheet View to Design
View. Design View shows
the structure of your table.
3. We are prompted to name our table. In the Save As dialog
box, type in tblStates. Click OK.
4. Notice that a new tab has appeared specific to Design View for tables. Replace the default field name ID
with the field name fldStateId. In the adjacent cell in the Data Type column, select the drop-down arrow
next to AutoNumber and replace AutoNumber with Text. The first field has automatically been assigned
a primary key. A Primary Key is a field that is unique for each record. Each table should have a primary
key. fldStateId is the Primary Key in this table.
Using Naming Conventions
A naming convention is the set of rules that you adhere to when assigning names to your database
objects. We will use prefixes for table (tbl), query (qry), form (frm), report (rpt) and field (fld) objects.
Following a naming convention ensures consistency within a database, reduces errors by clarifying the
functionality of each object, and makes your programming code much easier to read for other developers.
To ensure that our data is accurate and data is not repeated we will use tblCities and tblStates as
Lookup tables. Lookup tables allow easy corrections, additions and/or removal from the lookup table.
Both states and cities in the master table, tblStudents, will be selected from drop-down menus that use
the lookup tables.
10
11
Design View
5.
Each Field Name has associated Field
Properties. In the Field Properties
section for fldStateId, on the lower portion
of Design View, set the Field Size to 2.
6.
Select the View icon on the ribbon to change
to Datasheet View and enter data into
tblStates. When a dialog box opens with
the command,You must first save the table,
click on the Yes button.
1.
Create tblCities. On the ribbon in Microsoft
Access 2010 click on the Create tab. Click on
the icon, Table Design. A new table is opened
and currently named Table1.
2.
Enter the two Field Names and Data Types
listed below:
fldCityId AutoNumber
fldCity Text
Assign fldCityId a Primary Key by selecting
the row of fldCityId and then clicking on the
Primary Key icon.
Datasheet View
Datasheet View is where the data resides in each table. We will enter data into
each of our tables immediately after creating each table.
The purpose of the AutoNumber Data Type is mainly to be used as
a Primary Key field. Each record will have a unique value. A table
cannot have more than one AutoNumber field.
Datasheet View has a new feature in MS Access 2010, the Field Templates panel.
A field can be dragged from the Field Templates panel to your datasheet for a
pre-defined field.
7.
Enter the following data into tblStates
using the tab key to move from record to
record:
8. Close the table by clicking on the small
x to the right of the table name
tblStates. In Microsoft Access, data
is saved immediately after typing it in.
12
3.
Click on the View icon to change to datasheet
view. When you are asked to save the table, click
on Yes, and name the table tblCities. Click OK.
The table name will also appear in the Navigation
pane under the Tables group in the Object Type
category.
Datasheet View
Datasheet View
4. Enter the data to the right. Microsoft Access
won’t let you type into an AutoNumber field.
Select the tab key to move to the fldCity field.
After entering the data close the table.
13
Importing the Main Table
Below is our master table, tblStudents, in Design View. It will be imported from the Microsoft Access
database MSU104. In addition to importing data from other databases, tables can be imported from
Microsoft Excel files.
2. In the File Open dialog box, navigate to the Temp folder on the
Desktop. Select the database MSU104. Click Open. When returned
to the Get External Data -Access Database window click OK.
3. In the Import Objects window
select tblStudents. Click OK.
In the final window of the Get
External Data wizard select
Close.
4. Double click on tblStudents in the Navigation pane. tblStudents will open in datasheet view as a tabbed
document in a single window. Open tblStates and tblCities and tab between the tables.
Definitions:
Description in Design View of Tables
The text entered in the Description section of Design View in a table is used as a screen tip in both datasheet view
and on forms when entering data.
Caption in Field Properties
Whereas in Field Names it is preferable not to have spaces, it is desirable to place spaces in Captions. A Caption is
a label for a Field name. Captions appear in Datasheet view, in Reports and on Forms.
1. Select the External Data tab on the Microsoft Access ribbon. Click on the Access icon in the
Import category. In the Get External Data - Access Database window, click on the Browse button.
14
Note:
Reasons for using Lookup tables:
1. A Lookup table enables changing data in one place in one table, rather than searching through the entire
database and having to make multiple changes throughout the database.
2.
Lookup tables help maintain consistency of data. This means searches used in queries and reports will be
simplified and data is validated by limiting the choice of spelling.
3.
When you link a field in a table to a Lookup table, the Primary Key in the Lookup table is the field that is
being inserted into the table. Since Primary Keys should be kept small, you will be saving space. When
needed, additional fields from records in the Lookup table can be included in queries and reports.
15
Specifying Data Types and Field Properties
6.
Select fldStateId in the first sort
field. Click Next.
8.
Leave the field name as fldStuState
and click Finish.
9.
Save the table at the prompt by clicking
Yes. Only the key field from the Lookup
table is inserted into the master table. In
tblStates this will be the two letter
abbreviated state name.
So far we have specified field data types as Text, Number and AutoNumber. Except for Field Size and
Captions the Field Properties have been left at their default state. In the next exercises we will use the
Lookup data type and specify Input Mask and Validation field properties.
7.
Resize the field size of fldStateId by double
clicking on the right side of the cell of
fldStateId. Click Next.
Lookup Wizard for fldStuState
1. Select the Home tab and click on the View icon to
change to Design View of tblStudents.
2. To specify a Lookup column, change the Data
Type for fldStuState to Lookup Wizard.
3. Click the radio
button for I want the lookup
column to look up the
values in a table or query.
Click Next.
4. Select Table:tblStates. Click Next.
5.
Click > to move fldStateId under Available
Fields to Selected Fields. Click Next.
10. Use the same technique to create the lookup field for fldStuCity.
a) Change the Data Type for fldStuCity to LookupWizard.
b) Select I want the lookup column to look up the values in a table or query. Click Next.
c) Select tblCities to provide the values for the lookup column. Click Next.
d) Select all fields from tblCities in the Lookup Wizard. Click Next. Sort on fldCity.
Click Next.
e) Leave Hide Key column checked. The value in the key column is the
value that is being inserted into tblStudents. Click Next. Click Finish.
f) Click Yes to save the table.
g) Insert cities into datasheet view.
After we create the Lookup columns there will be a relationship between tblStudents and each of the
Lookup tables, tblStates and tblCities.
16
17
Now we will change the field properties to create an input mask and create a data validation rule:
Validation Rule and Validation Text
Input Mask
If the Validation Rule is not
followed when entering data, a
pop-up box will open with the
Validation Text in it. The data
entry person will be prevented
from continuing.
Input masks are used to control data entry. At a glance people entering information see the correct
format to use. Masks are useful in preventing errors. There may be several ways to input data, using a
mask will prevent confusion on which to use. MS Access has some predefined masks. Special
characters are used to set the appearance of the mask.
1. Click anywhere in the
fldStuPhone row to select
this field.
2. Click in the Input Mask row
of the Field Properties.
3. Click the Build button, the
button with the 3 ellipsis in
the Input Mask row to open
the Input Mask Wizard.
1. Click anywhere in the fldStuYear row,
the row representing the students college
year.
2. Click in the Validation Rule row and type:
FR or SO or JR or SR.
3. Click in the Validation Text row and type:
Please enter FR or SO or JR or SR.
4. Close the table. When asked Do you want
to save changes to the design of table
tblStudents? Click Yes.
5. A dialog box displays asking if the existing data should be tested. Select No. This box is displaying
because we already have data entered in the fldStuYear field. The imported data is accurate for the new
rule, so it is not necessary to test.
Enter data into the main table - tblStudents
4.Select Phone Number.
6.Open tblStudents in Datasheet view.
5.Click Next and click Next again.
7. Enter the following record into tblStudent:
6.Select Without the symbols... This will save
space in the database.
7.Click Next.
Try It:
a) Notice the mask and placeholders for the phone number field.
b) Type the wrong year to test the college year Validation Rule and Validation Text.
c) Use the pull-down arrows for the fields State and City to select data for those columns.
8.Click Finish to complete the Wizard and
create the phone mask.
18
19
1. While still in datasheet view of table tblStudents,
select the Totals icon on the Home tab in the
Records category. Totals, in Datasheet View is a
new feature in MS Access 2010. (Ribbon not shown
in full.)
2. A new record will appear with the word Total in the first column. Select the cell and then drop-down
arrow of the cell on the Total row in the Credits column. Choose Average from the drop-down list.
Creating a Form with the Wizard
We have now finished creating tables for our MSU101 Class database. We have entered data
using the Datasheet view. Microsoft Access was designed to use forms to enter data. Forms can
be designed to make data entry easy for an inexperienced user and can even be made to
resemble a paper form you may already be using.
1. We will demonstrate two ways to create
forms. First we will use the Form
Wizard. Click on the Create tab.
Select the drop down arrow next to the
More Forms icon. Select Form
Wizard.
2. Select tblStudents from the Tables/
Queries pull-down menu. Click >> to
select all of the fields and click Next.
3. The average of all the credits for all the students will appear.
3. Select Columnar to have the form
appear in a column. Clicking on the
other choices will show you how they
will appear. Click Next.
4. Close the table.
20
21
4.
Select Access 2010, or another style if you prefer.
The style is the background for the form. (This can
easily be changed later from the ribbon. Select the
Form Layout Tools | Format tab and select one of
the AutoFormat styles in Layout View of the form.)
Click Next, for now.
7.
Enter the two new records shown below into your form. When data is entered into a form it is
also being entered into its corresponding table. When data is entered into a table, it will display in a
form if a matching form has been created. Use the New Record button to enter each new record into
the form frmStudents.
8.
Close the form frmStudents.
5.Type frmStudents
as the title of your
form. Click Finish.
6. Access is now displaying the form that
you created. It appears in Form View.
Use the navigation buttons to view the
records.
22
23
Creating a Form in the New Layout View
1.
In Microsoft Access 2010 a new form
can be created with two clicks of the
mouse. Select the table tblStudents
in the Navigation pane. Select the
Form icon in the Create tab in the
Forms group.
With control layouts, forms/reports appear in a
uniform manner. The form/report looks like a table
with each cell containing a control. Control layouts
can be tabular (headings at the top), or stacked
(headings to the left).
2.
3.
Placing a Label or Title on a Form (The following method could also be used on a Report)
1. Double click on frmStudents in the Navigation pane to open it.
2. With the Home tab selected,
click on the drop-down arrow
beneath the View icon. Select
Design View from the dropdown list.
The new form will be created
in Layout View. The
professional looking form
includes a header with a logo
and title. (This view is not for
entering data.)
Making Changes in Layout View (In real time with real data.)
a.) Right click on the tab tblStudents in the Document
window. Select Save. Rename the form
Quick Form. Click OK.
3. Place the pointer above the Detail section. The pointer will change to a resizing tool. Click
and drag the Detail section down about one inch. Place the pointer on the right side of the
form and drag it out about two inches.
b.) Click on the title of the form and change the title to
Student Information.
c.) Click in one of the cells in the second column and
shorten all of the field lengths by dragging the right
edge of the cell to the left. All the cells will shorten.
4. A label has automatically been placed on the form. We will show you how to place a label from scratch.
Select the current label and Delete it.
d.) Select the title of the field for Phone, fldStuPhone,
and drag it above field City, fldStuCity. A horizontal bar
appears showing where the field will be moved to and aligns the field when moved.
4.
24
Close the form and save your changes.
25
5. The tools for working in Design View of the form are located on the ribbon under
the Form Design Tools | Design tab. This tab appears when you are in Design
View of a form. Click the Label tool and release the mouse button.
There are six types of queries in Microsoft Access. The select query, where you select the data
to be displayed, is the most frequently used. All the types of queries in the following lesson are
select queries. Other types of queries will be taught in Intermediate Access. The other types of
queries are crosstab, update, append, delete and make table queries.
Setting Up Queries
While tables contain the raw data and forms allow you to enter data, you use queries to
analyze the data in a database.
6. Place the cursor (a crosshair with an A) in the Form Header area. Click and
drag with the mouse to draw a rectangle. Type Student Information in the white
box.
1. Close all forms and tables. Select the Create tab on the MS Access ribbon. Select the Query Design icon.
2. Select tblStudents in the Show Table window. Click on the Add button to add tblStudents to the Query
window. Click on the Close button in the Show Table window.
7. Click on the grid and then the label box to show the resizing handles on the label. Drag the resizing
handles to resize the box. Use the text formatting tools on the toolbar in the Font section to enhance the
text. Switch between Form View and Design View to see your changes. Close and save the form when
you have completed the label.
26
3.
Use the mouse to resize the field list to
show all of the field names.
27
Select Query - A select query retrieves information from one or multiple tables.
1. Double-click the field names:
fldStuFirst
fldStuLast
fldStuYear
fldStuCredits
to add them to the Query Design Grid.
2. Run the query by clicking the Run icon
(the red exclamation point) on the Query
Tools | Design tab on the ribbon.
3. Switch back to the Query Design Grid. In the
Criteria row in the column fldStuYear, type FR
and run the query. This will show the records of
all of the freshmen. Return to the Query Design
Grid. Change the fldStuYear Criteria row to
each of the possible options, SO, JR and SR
and run each query. After running the query for
Senior, return to Design View. Right click on
the Query1 tab and click Save. In the Save As
box type in qrySenior. Close qrySenior when
finished.
Parameter Query - A parameter query displays its own dialog box that prompts you
for information before running the query.
1. In the Navigation pane, right click on
qrySenior and select Design View.
Comparison Operators
To display selected records in a datasheet, enter a condition into the Criteria row of a
query. Comparison operators are one type of conditional statement. In our first select
query we entered a value. On this page we enter comparison operators. Wild card
characters can also be used in selection criteria. For example: like “St*ville” or like
“A?S”. The data type used in the comparison must match the data type of the field.
1. Return to query Design View. First we will clear the grid. Click on the Home tab. Click on the drop-down
arrow next to the Advanced button. Select Clear Grid.
2.Place fldStuFirst, fldStuLast and fldStuCredits on the grid.
3.Type >9 in the fldStuCredits Criteria row.
4. Run the query. (Click the Query Tools | Design tab
to locate the Run icon.)
5. Return to the grid and try some of the other comparison operators:
<
less than
>=
greater than or equal to
<=
less than or equal to
NOT= not equal to
2. Remove the criteria from fldStuYear.
3.Type [Enter Year] in the fldStuYear
Criteria row.
4. Run the query.
5.Enter FR and click OK.
6. Test each of the remaining options:
SO, JR and SR.
28
29
Compound Criteria, Or and AND
Compound criteria as OR and AND permit you to perform complex searches involving more than one
criteria and employs conditional logic.
Logical AND query - Place criteria on the Criteria row but in two separate fields. When using the
logical AND, both fields must meet the criteria entered.
Logical OR query - Place criteria for one field on the criteria row. Also, place criteria for a second field
on the following “or” row. The OR query results select data where only one of the fields need to meet
the entered criteria.
Mathematical Functions or Summary Queries
With summary queries you can summarize data into groups. For example, for
each college year you can calculate the average, minimum or maximum number
of credits taken. Some of the other mathematical functions that are provided are
standard deviation, variance and count.
1. Return to query Design View.
Computed Fields
Computed or calculated fields permit you to create values for display on a row by row basis without
storing the values permanently in the database.
1. Return to query Design View and remove existing criteria.
2. Clear the grid (Home tab > Advanced > Clear Grid).
3.Add fldStuCredits to the design grid.
4. Click on the Totals icon on the ribbon on the
Query Tools | Design tab in the Show/Hide group.
2. Right-click the Field row of the 4th column (blank)
following fldStuCredits and click Zoom.
3.Type Cost:[fldStuCredits]*50
Click OK. Run the query.
4. To make the new field Cost, a currency
format, return to query Design View.
Right click on the new computed field
Cost, and choose Properties. Choose
Currency next to Format under the
General tab.
5.
30
5. Click in the GroupBy cell on the Total: row in the
fldStuCredits column and select Avg. from the
drop-down menu. Run the query. This gives you
the average number of credits for all the students.
6. Return to Design View. Add fldStuYear to the grid and run the query. This causes Access to run a summary of
averages by student year, Freshman, Sophomore, Junior
and Senior.
Run the query. The column will now be
displayed as currency in Datasheet View.
31
Reports
Reports can be based on tables, queries or forms. Using the Report Wizard
or new Report Layout View makes running Reports a snap.
7.Select fldStuYear for Grouping level.
Click > to move fldStuYear over.
Click Next.
Reports are also useful for displaying the results of calculations, totals and
grouped data.
1.
Close all forms and queries.
2. Select the Create tab.
3.Select Report Wizard in the Reports group.
8.Select fldStuLast as the first sort field and
fldStuFirst as the second sort field. Click Next.
9. Select Layout - Stepped and Orientation Portrait. Click Next.
4.Select tblStudents from the
Tables/Queries pull-down menu.
5.Under Available Fields select
fldStuYear
fldStuLast
fldStuFirst
fldStuCredits
6.Click Next.
32
10. Select a style and click Next.
11.Type (Your Name) - Student Information for the title
in the last page of the Wizard.
12.Click Finish. Your report in Print Preview View is created.
33
13. Print Preview is used to display reports as they
will look when printed, displaying a paginated
view of the report. In Print Preview you have
Zoom control. Zoom control is located on the
far right of the Status Bar. Also, on the Status
Bar are the View Controls where you can easily
switch to other views.
17. Click on the drop-down arrow of the View icon and select Layout View. Layout View
allows you to work with live data when making changes. It is no longer necessary to
switch between Form View and Design View to see your changes. In Layout View you
have a WYSIWYG editor – What You See Is What You Get.
18. Shorten the fields in Layout View.
14. Right click on the tab/title and select Report
View.
19. Layout View also has the new Group, Sort, and Total panel. Click on the Group & Sort icon in the Grouping & Totals group on the Report Layout Tools | Design tab. Click on the Add Existing Fields icon to open the
Field List located on the same tab in the Tools group.
15. Report View looks like the traditional Print
Preview, but with the capability of filtering.
Right click a value in one of the fields and
select a filter. After viewing the results, right
click a value and turn the filter off.
(Filtering is also available in Layout View.)
20. Drag fldStuCity to the report
from the Field List.
21. In the Group, Sort and Total panel change the grouping from
fldStuYear to fldStuCity. The grouping will be changed
instantly on the report.
16. Report View can also be used for copying and
pasting. Drag down on the left hand side of the
report. This selects the area to the right. Right
click and select Copy. (This would be followed
by pasting into another program.)
22. Close your report and any other open
objects. Close the MSU101 database.
34
35
36
37
38
39
A publication of ITS User Services,
a division of Information Technology Services,
Mississippi State University
Mississippi State University does not discriminate on the basis of race, color, religion,
national origin, sex, age, disability, or veteran status.