0% found this document useful (0 votes)
73 views

Advanced Access 2003

Here are the steps to add a parameter to prompt for a classification: 1. In the Criteria line for the Classification field, type: [Enter Classification:] 2. Run the query and a dialog box will prompt you to "Enter Classification:" 3. Type a classification, such as "Social Worker" and view the results 4. Return to Design View to make any other needed changes before saving and closing the query.

Uploaded by

avinash shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Advanced Access 2003

Here are the steps to add a parameter to prompt for a classification: 1. In the Criteria line for the Classification field, type: [Enter Classification:] 2. Run the query and a dialog box will prompt you to "Enter Classification:" 3. Type a classification, such as "Social Worker" and view the results 4. Return to Design View to make any other needed changes before saving and closing the query.

Uploaded by

avinash shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 58

ADVANCED ACCESS 2003

Table of Contents
Page

LESSON 1: INTRODUCTION..............................................................................................1

 Potential Access Outputs 1


 The Impact of Data Entry 2

LESSON 2: ADVANCED QUERIES..................................................................................4

 Parameter Queries 4
 Crosstab Queries 7
 Statistical Queries 12
 Calculated Fields 14
 Action Queries (Make Table, Update, Append,
Delete) 17

LESSON 3: ADVANCED REPORTS...............................................................................22

 Editing Reports in Design View 22


 Summary Options 25
 Writing Expressions 26
 Concatenation 30

LESSON 4: SWITCHBOARDS.........................................................................................33

 Creating a Switchboard 33
 Edit the Switchboard Form 37

LESSON 5: USING MACROS AND BUTTONS.............................................................41

 Creating a Macro 41
 Create a Command Button 44
 Display Options 48
LESSON 6: GIVE IT A TRY!............................................................................................50

LESSON 7: DELETING OBJECTS..................................................................................52

NICE TO KNOW......................................................................................................................53

 Mouse Pointers 53
 Toolbar Buttons 54
 Keyboard Shortcuts 56

This workbook may be reproduced in whole or in part by an employee of the Department of Health and Human
Services. All other reproduction is prohibited unless written permission is obtained from the Training Institute.
LESSON 1: INTRODUCTION
OBJECTIVES: Discuss Access output capabilities.
Recognize the impact of data entry on output.

 Potential Access Outputs


OVERVIEW

Tables are the basis for all objects in an Access database. Data can be entered
either directly into a table, or into a form, which passes data on to the table.
Data can be described as the raw facts and figures that are input, but
information is more likely what you want to get out of your database.
Information takes data and makes it meaningful. For example, data could be
the cities where classes are held. Information based on those cities could
include how many classes are held in a given city, or how many different
cities offer classes.

When you are looking for information from your tables, a variety of tools are
available to help you find the specific information you need. You may simply
need to scroll through the records in the table or form, use the Find tool, or
filter the data as necessary. However, Access provides you with more
streamlined methods for extracting information from your database.

Queries allow you to ask a question of your data. The answer to that question
appears as a group of records matching certain criteria, and displaying only
specific fields. These results are called a dynaset in Access.

Reports display the results of a query or show selected fields from a table,
whose records may be grouped and sorted as desired. While all objects
created in an Access database may be printed, reports are specifically
designed for printing.

Advanced Access 2003 Page 1


NOTES

 The Impact of Data Entry


OVERVIEW

There is a commonly used phrase related to databases that is, “Garbage in,
garbage out.” If the data being entered is inaccurate or inconsistent, the
information extracted will also be inaccurate or inconsistent. It is very
important to realize this fact as you make decisions based on data output.

Another important aspect of the relationship between data entry and output is
that you cannot take out what has not been put in. If the data has not been
collected and entered, there is no way to pull information based on that data
out of your database. Therefore, it is essential that you are very familiar with
the content of your database. You should know the fields that exist in each
table, how tables are related, how data is collected and entered, and who is
responsible for data entry. It is impossible to generate meaningful and
accurate queries and reports without this knowledge.

Following are the tables we will be using in this course.

Classes

Instructors

Page 2 Advanced Access 2003


NOTES

Students

Students, continued…

Advanced Access Page 3


NOTES

LESSON 2: ADVANCED QUERIES

OBJECTIVE: Utilize advanced queries to retrieve information from the


tables in a database.

Did You Know?  Parameter Queries


If you change OVERVIEW
data in a dynaset
(query results),
A Parameter Query allows you to ask a question with criteria that can be set
the source table
differently each time you run the query. For example, you may create a query
is also updated.
with the criteria to find only Region III records, while someone from Region
II needs the same information, but for their own region. If the query is
initially set up as a parameter query, when it is run, Access will display a
dialog box and ask you to type in the Region you wish to see.

STEPS
Helpful Hint:
1. Create a SELECT QUERY and include the fields you wish to have
You must
appear in your query results.
always use
square brackets
2. Set any standard criteria for the query, if applicable.
around the text
you want in
3. In the criteria line of the field(s) for which you wish to set parameters,
your parameter
type the question you want Access to ask in its dialog box. For
query.
example, in the criteria line for the City field, type:
However, you
cannot use text
[Enter City]
that exactly
matches a field
name in your
database.
Also, you can
use a colon (:)
at the end of
your message,
but not a
period (.), as it
4. To create a parameter query that allows you to type just the first
causes an error
letter or two of the entry, type the following:
to occur.
Like[Enter and your field name:]&*

For example, Like[Enter Classification:]&*

Page 4 Advanced Access 2003


NOTES
5. RUN the query by clicking on the VIEW button , and at the
dialog box, type the appropriate response.
Did You Know?

If you want to
be able to type
any portion of
the field entry,
type Like
*&[dialog box
prompt]&* in
6. Look through your results, and return to DESIGN VIEW, if
thenecessary,
Criteria line.
to make any further adjustments.

7. SAVE your query.

 Lesson Example

Your supervisor would like to know how many students are taking classes
from different locations. She would also like to see how many Social
Workers are taking classes in Portland, as well as other locations and
classifications. Instead of creating 35 queries to look up each location and
each classification, you decide that a parameter query would answer the
questions.

STEPS

1. Open Access by clicking on START, PROGRAMS, MICROSOFT


ACCESS.

2. Open the Advanced Access file (your instructor will give you the
location).

3. Click the OPEN button on the Security Window.

4. Click the QUERIES object on the OBJECTS bar.

5. Open the Student Info query in DESIGN VIEW.

6. Type [Enter City] in the CRITERIA line of the City field.

7. Run the query.

8. In the dialog box, type Augusta.

Advanced Access Page 5


NOTES

9. Return to DESIGN VIEW.

10. Run the query again, this time typing Portland in the dialog box.

11. Return to DESIGN VIEW.

EXERCISE:

1) In Design View of the Student Info query, add another


parameter that prompts for a Classification that allows you to
type a few characters by typing the following into the
Classification criteria row.

Like [Enter Classification]&*

2) Run the query and find the Classification Social Worker in


Portland. Try typing only Soc at the Classification prompt.

3) Save and close the Student Info query.

4) On Your Own: Add a parameter to prompt for Location in


your Class List query. Test it for Augusta, then try it again for
Lewiston.

5) Close the query without saving your changes.

Page 6 Advanced Access 2003


NOTES
 Crosstab Queries
OVERVIEW

A crosstab query displays summarized values (sums, counts, and averages)


from one field in a table and groups them by one set of facts listed down the
left side of the datasheet (row headings) and another set of facts listed across
the top of the datasheet (column headings). For instance, if you were trying
to find out how many cases each case manager had in each city, you could use
a crosstab query.

STEPS

1. Click the NEW button .

2. Select the CROSSTAB QUERY WIZARD. Click OK.

Did You Know?

You can only


use one table in
a CROSSTAB
QUERY. If you
need to use
more than one
table, create a
query with the
pertinent fields
and base the
CROSSTAB
QUERY on the
new query.

Advanced Access Page 7


NOTES

3. Identify the table you want to use for the query. Click NEXT.

4. Select the field(s) that you want to use for row headings. You can
identify up to three fields. Click NEXT.

Page 8 Advanced Access 2003


NOTES
5. Identify the field that you want to use for the column heading. You
may only choose one. Click NEXT.

Did You Know?

Text fields in a
CROSSTAB
QUERY will not
have as many
calculation
options as
numeric fields.

6. Identify the field that you want to be calculated, and how you want it
calculated. Click NEXT.

Advanced Access Page 9


NOTES

7. Name the query. Click FINISH.

Did You Know?

Crosstab queries
are depicted
with an
icon in the
Queries object
window.

8. View the Query.

 Lesson Example

You are curious about how many students take classes in each city by
classifications.

STEPS

1. Create a new query by clicking the NEW button.

2. Select the CROSSTAB QUERY WIZARD. Click OK.

3. Click on the Students table. Click NEXT.

4. Double-click on the City field to use as the row heading. Click


NEXT.

Page 10 Advanced Access 2003


NOTES
5. Click on the Classification field to use as the column heading.
Click NEXT.

6. Click on the StudentID field and COUNT under FUNCTION.


Click NEXT.

7. Save the query as Students_Crosstab. Click FINISH.

8. View and close the query.

EXERCISE: Did You Know?

1) Create a query in design view that has the Students, Join and You can go into
Classes table with the following fields: DESIGN VIEW
Classes: Title for a
ClassID CROSSTAB
Students: Classification QUERY and
change row and
2) Run the query. column
headings.
3) Name the query Classification Class Breakdown and close it.

4) Use the Classification Class Breakdown query to create a crosstab


query to count the number of students from each classification to
take each class.

5) The row heading will be Title, the column heading will be


Classification, and count the ClassID field.

6) Save the query as Classification Class Breakdown_Crosstab


and close it.

7) On Your Own: Create a crosstab query to look at how many


classes are being offered in each city. Use the Classes table and
use the Title field as the row heading, and Location as the column
heading. Count the ClassID field. Save the query as
Classes_Crosstab and close it.

Advanced Access Page 11


NOTES

 Statistical Queries
OVERVIEW

To display the results of a calculation in a field, you can use a predefined


calculation that Microsoft Access provides or custom calculations you define.
Use the predefined calculations, called "totals", if you want to compute the
following amounts for groups of records or for all the records combined: sum,
average, count, minimum, maximum, standard deviation, or variance. You
choose one “totals” calculation for each field you want to calculate.

STEPS

1. Create a new query and add the appropriate fields, or use an existing
query.

2. In DESIGN VIEW, click the TOTALS button . This will give


you a new line (called TOTAL) in the QBE grid at the bottom of the
query window.

3. In the field that you want to perform the calculation, click in the
TOTAL line, and select from several calculations that are listed.
TOTAL will default to GROUP BY, which defines the groups where
you want to perform the calculations. For example, to show material
costs by class title, select GROUP BY for the Title field.

4. Run the query.

Page 12 Advanced Access 2003


NOTES
 Lesson Example

You want to create a query to calculate how many students are enrolled in
each class, and how much money students are paying in material fees per
class.

STEPS

1. Create a new query in DESIGN VIEW using:

CLASSES table – ClassID, Title, and MaterialCost


JOIN table – StudentID

2. Click the TOTALS button. This will give you a new line called
TOTAL in the QBE grid at the bottom of the query window.

3. Assign these calculations by clicking in the TOTAL line, and


select the calculation listed:

ClassID – GROUP BY
Title – GROUP BY
MaterialCost – SUM
StudentID - COUNT

4. Run the query. Save as Total Material Costs and close it.

EXERCISE:

1) Create a query in Design View using the Title and LabFee fields
from the Classes table. Sum the lab fees for any classes that
have them. Save as Classes With Lab Fees. (Hint: Use the
Sum statistical function and type >0 in the Criteria field for
LabFee).

2) On Your Own: You want to determine the average amount


being paid in material fees. Reopen Total Material Costs, and
add another field to average the material costs. To do this, in
the next column after StudentID, insert another MaterialCost
field. In the Total row, select Average. Save as Average
Material Costs.

Advanced Access Page 13


NOTES

 Calculated Fields
OVERVIEW

In addition to the statistical queries that calculate groups of records, there are
other types of calculations you can perform in a query that modify individual
fields. For example, you can multiply the values in two fields, or calculate
the date three months from the current date. When you display the results of
a calculation in a field, the results aren't actually stored in the underlying
table.

STEPS

1. Create a new query and add the appropriate fields, or use an existing
query.

2. In DESIGN VIEW, type an expression (formula) in an empty cell in


the FIELD row. If the expression includes a field name, you must
place square brackets around the name. (Example: [Date]+15)

3. Press the ENTER key.

4. RUN the query.

Page 14 Advanced Access 2003


NOTES
5. To rename the new field (from EXPR1), in DESIGN VIEW, type
over the Expr# with the field name you prefer. You may name the
new calculated field when creating the expression simply by typing in
the name you want for the field, followed by a colon (:), then type the
expression.

Did You Know?

When working
with percentages
in calculations,
type 0.10
instead of 10%.

6. To format the field as currency, in DESIGN VIEW, click the


PROPERTIES button or right mouse click over the field you
want to format and select PROPERTIES. On the GENERAL tab,
change the FORMAT to CURRENCY.

Helpful Hint:

If you type an
expression and
get a parameter
box when you
run the query, it
means that one
of the field
names is
misspelled and
correct it in the
formula.

Advanced Access Page 15


NOTES

 Lesson Example

Your supervisor is considering reducing material fees. You decide to


create a query that will calculate how much students will save in each
class if material costs are cut by 10%.

STEPS

1. Create a new query in DESIGN VIEW with the Title and


MaterialCost fields from the Classes table.

2. Type [MaterialCost]*0.10 in the next empty cell in the FIELD


Did You Know? row.

You can use an 3. Press ENTER.


expression name
as a field if you 4. RUN the query.
want to use it in
another 5. Go back into DESIGN VIEW, and rename the new field 10%
calculation. Be Savings by typing over the Expr1.
sure to use the
brackets [ ] 6. Click the PROPERTIES button.
when referring
to it. 7. On the GENERAL tab, change the format to CURRENCY.

8. Save the new query as 10% Savings.

EXERCISE:

1) Determine how much we receive in student fees for each class


if the class is fully enrolled. From the Classes table, use the
Title, Date, MaxCapacity, MaterialCost, and LabFee fields.

2) In the next available field type Total:


[MaxCapacity]*([MaterialCost]+[LabFee]).

3) Save the query as Total Student Fees.

4) On Your Own: Determine how much students would save if lab


fees were cut 5%. Reformat the calculated field to be in
currency format. Save as 5% Savings (Hint: Use the 10%
Savings query as a guide).

Page 16 Advanced Access 2003


NOTES
 Action Queries (Make Table, Update, Append,
Delete)
OVERVIEW Helpful Hint:

Normally, the majority of the queries you will create are Select queries. You It is a good
specify criteria and run the query, it tallies the data and displays the results in idea to save all
datasheet view. Occasionally, you may need the query to do more, such as queries as
make a new table, or add data from one table into another; those tasks require select queries,
an action query to be built. An action query is a query that makes changes to not as action
many records in just one operation. There are four types of action queries: queries. This
make-table, update, append, and delete. prevents other
users from
o Make-Table Query: Creates a new table from all or part of the data accidentally
in one or more tables. Make-table queries are helpful for: running an
action query
 Creating a table to export to other Microsoft Access by opening it.
databases. For example, you might want to create a table that
contains several fields from your Employees table, and then export
that table to a database used by your personnel department.

 Making a backup copy of a table. If you update records in


the original table, the table created in the MAKE-TABLE process
will not be updated. Also, relationships and other properties (such
as input masks) do not carry over either.
 Creating a history table that contains old records. For
example, you could create a table that stores all your old orders
before deleting them from your current Orders table. Helpful Hint:

o Update Query: Makes global changes to a group of records in When using an


one or more tables. For example, you can raise prices by 10 percent APPEND query
for all training products, or you can raise salaries by 5 percent for the make sure that
people within a certain job category. With an UPDATE query, you the destination
can change data in existing tables. table has all the
fields that are in
o Append Query: Adds a group of records from one or more the table to be
tables to the end of one or more tables. For example, suppose that you appended, of not,
add the fields to
acquire some new customers and a database containing a table of
information on those customers. To avoid typing all this information the destination
table and then
in, you'd like to append it to your “Customers” table. APPEND
queries are also helpful for: process the
APPEND query.
 Appending fields based on criteria. For example, you might
want to append only the names and addresses of customers with
outstanding orders.

Advanced Access Page 17


NOTES

 Appending records when some of the fields in one table


don't exist in the other table. For example, you have a Customers
table that has 11 fields. Suppose that you want to append records
from another table that has fields that match 9 of the 11 fields in
the Customers table. An APPEND query will append the data in
the matching fields and ignore the others.

o Delete Query: Deletes a group of records from one or more


tables. For example, you could use a DELETE query to remove
products that are discontinued or for which there are no orders. With
delete queries, you always delete entire records, not just selected fields
within records.

STEPS

1. Create a query using the necessary fields from the appropriate table.

2. RUN the query and note how many records there are. Save the query.

3. Return to DESIGN VIEW of the query.

4. Click on the QUERY TYPE button . Select the appropriate


action query from the listing. Notice that the query type (in the query
title bar) changes from a SELECT QUERY to the action query you
selected.

Page 18 Advanced Access 2003


NOTES
5. The steps differ based on which type of action query you are creating.

o To create a MAKE-TABLE query, Name the new table and


determine where you want the new table located. Click OK.

o To create an UPDATE query, type an expression in the UPDATE


TO row for the field that you want updated.

o To create an APPEND query, identify which table you want to Did You Know?
append into, and click OK.
The
DATASHEET
VIEW button
will allow
you to see what
data will be
affected by the
action query
without actually
carrying out the
action. To run
the query, you
o To create a DELETE query, indicate any criteria that will identify
must click the
the records to be deleted in the CRITERIA row. WHERE appears
RUN button.
under all fields, FROM will appear if an entire table is sent to the
QBE grid.

Advanced Access Page 19


NOTES

6. Click the RUN button . Access will perform the action query that
you requested. You may have to click YES if a message box appears
(depends on the action query selected).

7. Close the query.

 Lesson Example

You want to split the Students table, so that you can use the data for other
purposes, without recreating it. Create a table for Clerk Typist II’s using
the MAKE-TABLE feature.

STEPS

1. Create a query in DESIGN VIEW. Use all of the fields from the
Students table. Save the query as Make Clerk Typist II
Students.

2. In the CRITERIA row for the Classification field, type Clerk


Typist II as the criterion.

3. RUN the query and note the number of records.

4. Return to DESIGN VIEW of the query.

5. Click on the arrow next to the QUERY TYPE button. Select


MAKE-TABLE QUERY.

6. Name the new table Clerk Typist II Students and place it in this
database. Click OK.

7. Click the RUN button, then click YES. Access will create a new
table called Clerk Typist II Students and will tell you how many
records got pasted into it.

8. Save the query, close the query and notice the icon for a MAKE-
TABLE QUERY.

9. Click on the TABLES object in the OBJECTS bar and see that the
new table has been placed there.

Page 20 Advanced Access 2003


NOTES
EXERCISE:

1) The instructors are going to be attending some classes, so you


need to add them to the Students table. Create a new query in
Design View based on the Instructor table. Add all fields.
Save as Append Instructor.

2) Change Select Query to an Append Query. Append to the


Students table by selecting it from the drop-down list. Click OK.
Run the query. Click YES at the message box. Close the
query but don’t save changes.

3) View the Students table to see that 5 new records were added.
Notice that information is inserted only where the field names
were an exact match.

4) Material Costs will be 10% less than they are now. Create a
new query in Design View based on the Classes table to it. Use
the ClassID, Title, and MaterialCost fields. Save as Update
Material Costs.

5) Change Select Query to Update Query. Click in the


MaterialCost column. In the Update To row type
[MaterialCost]- [MaterialCost]*0.1. Run the query. Click YES
at the message box. Close the query but don’t save changes.

6) View the Classes table to see that the material costs have
decreased 10%.

7) On Your Own: Identify the correct action query to use.

To create a new table Delete

To make a global change Append

To add records from another table Update

To remove certain records from a table Make-Table

Advanced Access Page 21


NOTES

LESSON 3: ADVANCED REPORTS

OBJECTIVE: Customize and edit reports.

Did You Know?

All editing  Editing Reports in Design View


features you can
do in DESIGN OVERVIEW
VIEW of forms,
you can do in You can improve the layout and readability of your report if the wizard
DESIGN VIEW doesn’t give you what you were expecting by viewing the report in DESIGN
of reports. VIEW and customizing it.

STEPS

1. To move a text box and its label, click on the box once. Move your
mouse pointer so that it is between any of the handles (small black
boxes on the perimeter). When you see a little hand , click and drag
the field to the new location.

2. To move a text box or label, click on the box once. Move your
cursor to the upper left corner. When you see a pointing hand , click
and drag the field to the new location.

3. To resize a control (a.k.a. box), click on the box once. Move your
cursor so that it is over one of the handles. When you get the double
headed arrow mouse pointer , , or , click and drag to resize.

4. To add color to the background of a selected control, click the


FILL button on the toolbar to color the background, or use the
drop-down arrow to choose another color.

5. To add color to the text of a selected control, click the TEXT button
on the toolbar to color the text, or use the drop-down arrow to
choose another color.

6. To add color to a line, select the line and click the LINE button
on the toolbar to change the effect of the line, or use the drop-
down arrow to choose another color.

Page 22 Advanced Access 2003


NOTES
7. To insert a page break, click the PAGE BREAK button on the
toolbar and click in the report section where you would like the report
to start on a new page (for example, at the bottom of the DETAIL
section).

8. To expand the report area, get the double-headed arrow by


placing the mouse pointer just above the section bar, click and drag
down or up.

9. To change the autoformat select the report by clicking on the gray


box that connects the top and side ruler, so that it has a black
square in the center.
10. Click the AUTOFORMAT button on the Standard toolbar.

11. Select the new background that you want. Click OK.

12. Click the PRINT PREVIEW button on the toolbar to see the
report

Advanced Access Page 23


NOTES

 Lesson Example

Customize the Students report so that it is pleasing to you.

STEPS

1. Open the Students report in DESIGN VIEW.

2. Click the AUTOFORMAT button and select Formal.

3. Move the Students box in the Report Header so that it is


centered.

4. Click in the Detail section to select it, then click the arrow next to
the FILL/BACK COLOR button and select navy blue.

5. Select all the text boxes in the Detail section by holding down
Shift and clicking on each box.

6. Change each text box font color to white by clicking on the arrow
next to the FONT/FORE COLOR button and selecting white.

7. Save your changes.

8. Click the PRINT PREVIEW button to view the report and then
close.

EXERCISE:

1) In the Student Transcript report, apply a new AutoFormat.

2) On Your Own: Make any other manual changes you like to the
report. Save your changes.

Page 24 Advanced Access 2003


NOTES
 Summary Options
OVERVIEW Did You Know?
Summary options are calculations that are available to you while you are In order to see
using the Report Wizard. They provide standard calculations (sum, average, the SUMMARY
minimum and maximum) for fields in your report. OPTIONS
button during
STEPS the wizard, you
must have fields
1. Use the Report Wizard to make a report by double clicking CREATE with data types
REPORT BY USING THE WIZARD. of NUMBER,
CURRENCY, or
2. On the SORT ORDER AND SUMMARY INFORMATION screen of YES/NO and
the wizard, click the SUMMARY OPTIONS button. choose grouping
levels or have
multiple tables.

Advanced Access Page 25


NOTES

3. Click the check box below the calculation (SUM, AVG, MIN, MAX)
you would like to use for the field(s) you would like to compute in the
report.

4. Click whether you would like to display DETAIL AND SUMMARY


or SUMMARY ONLY.

5. Click OK and continue with the Report Wizard.

 Writing Expressions
OVERVIEW

Just like you can perform calculations in queries, you can perform them in a
report. The results of the calculations are not stored in any table.

STEPS

1. Select a report and click the DESIGN VIEW button on the


toolbar.

2. Click the TOOLBOX button on the Standard Toolbar.

3. Click the TEXT BOX button on the Toolbox Toolbar, and then
click on the new location.

Page 26 Advanced Access 2003


NOTES

4. To change the label name, click and drag over the Text # (the label)
and add a new label name, or you may want to get rid of it entirely by
deleting it.

5. To add an expression in the text box, click the text box, and type the
new expression (Example: =[Hours]*[Hourly Wage]).

6. To use the expression builder to help create the formula, click the
PROPERTIES button on the toolbar.

7. Click in the CONTROL SOURCE BOX and type the expression.

Type expression here

Build button

8. To get help with the expression, click the BUILD button to the
right.

Advanced Access Page 27


NOTES

6. To format a result box, select it and then click on the PROPERTIES


button , and click on the FORMAT tab. Select a choice from the
drop down list in the FORMAT row.

 Lesson Example

Create a report that will calculate each student’s material costs and lab
fees.

STEPS

1. Create a new report using the REPORT WIZARD:

Students table: StudentID, FirstName, and LastName

Classes table: Title, Date, Location, MaterialCost,


and LabFee

2. Make the following selections in the Report Wizard:


View data by Students.
No groupings.
Sort ascending by Date.
Sum MaterialCost and LabFee from SUMMARY OPTIONS.
Choose OUTLINE1 layout with PORTRAIT orientation.
Select CORPORATE style.
Name the report Student Costs.

3. Click the VIEW button on the toolbar.


4. Click the TOOLBOX button on the Standard Toolbar.

Page 28 Advanced Access 2003


NOTES

5. Place your mouse at the top of the PAGE FOOTER bar, with the
two-headed arrow, click and drag down to make the STUDENTID
FOOTER approximately ¼ inch larger.

6. Click the TEXT BOX tool, and then click in the StudentID footer
section and below the Sum of Material Cost text box.

7. Click and drag over the label and rename it Total Costs.

8. Click the unbound text box, and type the expression


=sum([MaterialCost]+[LabFee]).

9. Go to PRINT PREVIEW to see how the new field looks.

10. Go back to DESIGN VIEW and move controls if needed.

11. Click on the text box and click the BOLD button. You may need
to resize your text box to accommodate the data.

12. Change the color of the label to match the others.

13. Click on the Total Costs result box

14. Click on the PROPERTIES tool, and click on the FORMAT tab.

15. Select CURRENCY from the drop down list in the FORMAT row.

16. Save, view, and then close the Student Costs report.

EXERCISE:

1) Add a text box to the Detail section of the Student Transcript


report before Date.

2) Change the label to Last Date of Refund:.

3) Cut the label and paste it into the STUDENTID HEADER.

4) Move it to the left of Date and resize it by making the width


smaller and the height larger.

3) In the unbound textbox, create an expression that will calculate


the last date of refund as 15 days after the date that the class
started (Hint: =[Date]+15).

Advanced Access Page 29


NOTES

4) Resize, move, and reformat the label and text box as


necessary.

5) On Your Own: Calculate the Grand Total of Total Costs in the


Report Footer and format it to currency.

6) Save the report.

 Concatenation
OVERVIEW

You can use the concatenation feature to combine two fields into one,
seamlessly, so that gaping spaces are eliminated. One common area where
concatenation is used is to combine the First Name field with the Last Name
field to eliminate problems with huge spaces between those fields. (Example:
MARIA MATTISON)

STEPS

1. Select a report and then click the DESIGN VIEW button on the
toolbar.

Helpful Hint: 2. Click the TEXT BOX button , and then click on the new location.

You may type 3. Click and drag over the label and add a new label name, or you may
the expression want to get rid of it entirely by deleting it.
directly into the
text box if you 4. Click on the text box. Click the PROPERTIES button on the
prefer. toolbar.

5. Click on the DATA tab, and click in the CONTROL SOURCE field.

Type expression here

Build button

6. Click the BUILD button to the right of the field.

Page 30 Advanced Access 2003


NOTES

7. Scroll down in the listing of controls that are on your report (middle
panel). Double click FirstName (not FirstName_ Label), type a &“
”& (ampersand quote space quote ampersand), and double click
LastName, as shown below.

8. Click OK, then close the PROPERTIES box.

 Lesson Example

You want the students’ first and last names to appear at the top of each
page in the Student Transcript report. But, when you add the text boxes
there is a huge gap between the two fields.

STEPS

1. Open the Student Transcript report in Design View.

2. Click on the PAGE BREAK button and then click in the lower
right-hand corner of the STUDENTID FOOTER.

3. Click the TEXT BOX button, and then click below the Zip label in
the STUDENTID HEADER section.

4. Click and drag over the label and add the new label name
Student:.

Advanced Access Page 31


NOTES

5. Click in the unbound text box. Click the PROPERTIES button on


the toolbar.

6. Click on the DATA tab, click the CONTROL SOURCE field, and
then click the BUILD button to the right.

7. Scroll down the list of controls that are in your report (middle
panel). Double-click FirstName (not FirstName_ Label).

8. Type a &“ ”& (ampersand quote space quote ampersand).

9. Double click LastName.

10. Click OK, and close the PROPERTIES box.

11. View the report in PRINT PREVIEW.

EXERCISE:

1) Delete the FirstName and LastName textboxes and labels. Move


the Student: label and textbox to the upper right-hand corner of
the section.

2) Move the Address label and textbox directly below the Student:
label.

3) Add another text box below the address that concatenates the
City, State, and ZIP fields.

2) Delete the remaining extra fields in the StudentID header.

3) On Your Own: What other fields might you want to concatenate?

Page 32 Advanced Access 2003


NOTES

LESSON 4: SWITCHBOARDS

OBJECTIVE: Create a user interface for your database.

OVERVIEW

A switchboard is a form that may contain buttons that you can click to open
other forms and reports, exit Access, or even customize the switchboard to
meet specific needs. A switchboard gives the user direct access to the major
tasks performed in the database and can be used to deny access to certain
areas in the database.

 Creating a Switchboard
OVERVIEW

Access will automatically create a Switchboard that you can modify.

STEPS

1. Click TOOLS, DATABASE UTILITIES, SWITCHBOARD


MANAGER.

2. Click YES at the following window

Advanced Access Page 33


NOTES

3. Highlight the MAIN SWITCHBOARD. Click on the EDIT button.

4. On the EDIT SWITCHBOARD window, click the NEW button.

Page 34 Advanced Access 2003


NOTES
5. Type the name of your switchboard item where it says TEXT on the
EDIT SWITCHBOARD ITEM window. In the COMMAND drop
down list, select the command that you want to perform. The last Did You Know?
piece of information that is required is the name of the database
object that you want affected by the command. Click OK. If you type an
ampersand (&)
in front of any
letter in the
TEXT line,
when the
Switchboard is
open, you may
press the key for
6. To add more items to your switchboard, repeat Steps 4 and 5. that letter to
activate the
7. To edit or delete items on your switchboard, on the EDIT item. The letter
SWITCHBOARD page, identify the item and click the EDIT or will be
DELETE buttons (as seen in Step 4). identified with
an underscore.
8. To move items on your switchboard, on the EDIT
SWITCHBOARD page, identify the item and click the MOVE UP or
MOVE DOWN buttons.

9. To complete your switchboard, close all windows back to your


database screen.

10. To keep users from getting to the database window, go to TOOLS,


STARTUP, and remove the checkmark to DISPLAY DATABASE
WINDOW. Click OK.

Advanced Access Page 35


NOTES

 Lesson Example

You want to create a switchboard for your database. We’ll add the
Students form, as well as the Students report.

STEPS

1. Click TOOLS, DATABASE UTILITIES, SWITCHBOARD


MANAGER.

2. Click YES to create a Switchboard.

3. Click the NEW button.

4. Type Edit Student Information on the TEXT line. In the


COMMAND drop down list, select OPEN FORM IN EDIT
MODE. Select the Student form under FORM. Click OK.

5. Click NEW.

6. Type Register New Students on the TEXT line. In the


COMMAND drop down list, select OPEN FORM IN ADD
MODE. Select the Student form under FORM. Click OK.

7. Click NEW.

8. Type View Students Costs on the TEXT line. In the COMMAND


drop down list, select OPEN REPORT. Select the Student Costs
report. Click OK.

9. Close all windows back to your database screen.

10. View your switchboard by clicking the FORMS object and double
clicking the SWITCHBOARD form. Close the form.

Page 36 Advanced Access 2003


NOTES

EXERCISE:

1) Go back to the Switchboard Manager and add the following


item:
Open the Student Transcript report. Name the item View
Student Transcripts.

2) On Your Own: Go back to the Switchboard Manager and add


the following item:
Open the Classes form in add mode. Name the item Enter
New Classes.
3) Exit the Switchboard Manager and then view and close the
form.

 Edit the Switchboard Form


OVERVIEW

Once you have created your switchboard, you can customize it so that it looks
like your other forms and gives the database a professional look.

STEPS

1. Click on the FORMS button on the OBJECTS bar.

2. Open the SWITCHBOARD form in DESIGN VIEW. Edit this form


as you would any other form. Do not delete the eight controls where
switchboard items will be displayed, or you will have trouble using
your switchboard. Even though you may not need all of those
controls, Access will look for them, and display error messages when
it can’t find one.

Advanced Access Page 37


NOTES

3. Activate the TOOLBOX toolbar if it does not appear by clicking on


the TOOLBOX button .

4. To insert a picture on the form, click the UNBOUND OBJECT


FRAME button and then click on the switchboard where the
picture should appear. Select a picture from the MICROSOFT CLIP
GALLERY (or another location of your choice). Click OK. Select
your picture and click the INSERT CLIP button to insert it.

Helpful Hint:

Do not delete
the controls
where
switchboard
items will be
displayed, or
the
switchboard
will not work
properly.

Page 38 Advanced Access 2003


NOTES
5. To resize the picture, activate the PROPERTIES window for the
picture once it is inserted. On the FORMAT tab, change the SIZE
MODE to ZOOM.

6. Save your changes.

 Lesson Example

STEPS

1. Open the SWITCHBOARD form in DESIGN VIEW.

2. Select the background by holding down SHIFT and clicking on


the left side of the switchboard and the top of the switchboard.

3. Click the arrow next to the FILL/BACK COLOR button and


selecting light blue.

4. Activate the TOOLBOX toolbar if it does not appear by clicking


on the TOOLBOX button.

5. Click the UNBOUND OBJECT FRAME button, and click in the


area on the left side of the form.

6. Select MICROSOFT CLIP GALLERY, and click OK.

7. Choose a picture of your liking.

Advanced Access Page 39


NOTES

8. Go back to PROPERTIES and on the FORMAT tab, change the


SIZE MODE to ZOOM.

9. Resize and move as necessary.

10. Save your changes.

11. View your form to see the results.

EXERCISE:

1) Open the Switchboard in Design View.

2) Change the font for Advanced Access by selecting the


text box and clicking on the drop-down arrow next to the current
font and changing it to Arial, size 20..

3) On Your Own: Change the background color to a color


of your choice.

4) Save your changes and close the switchboard.

Page 40 Advanced Access 2003


NOTES

LESSON 5: USING MACROS AND


BUTTONS

OBJECTIVE: Utilize macros and buttons to enhance database


functionality.

 Creating a Macro
OVERVIEW

A macro is a set of one or more actions that perform 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.

When you create a macro, you record the actions that you want to carry out.
Unlike Word or Excel, Access doesn’t allow you to perform the steps to
record them, you need to type the action arguments in, for this reason you
may find that it is helpful to do the steps and write them down. That way,
when you create the macro, it will be easier to remember all of the steps.

STEPS

1. Click the MACROS button in the object window, and then click NEW.

2. In the first row, click the drop-down arrow to choose the action you
want.

Advanced Access Page 41


NOTES

3. Click in the ACTION ARGUMENTS box at the bottom (or press F6


to move to this pane).

4. Change the ACTION ARGUMENTS (such as the name of the table to


open), and then press F6 to move back or click in the upper pane.
Helpful Hint:
5. Add other actions you want to include, then close and save the macro.
You can only
have one
AutoExec 6. To use the macro, select it and then click the RUN button in
macro. the Database Window.

7. To create a macro that will automatically run when the Access file
is opened, name the macro Autoexec.

 Lesson Example

You want to create a macro that will open the RegisterStudents form
maximized, in a new record, so that it will make entering new students
and registering them for classes easier.

STEPS

1. Click on the MACRO button on the OBJECTS bar, and then click
NEW.

2. Click the drop-down arrow under ACTION to choose


OPENFORM. Click in the ACTION ARGUMENTS box at the
bottom (or press F6 to move to this pane).

3. The FORM NAME will be RegisterStudents, and the DATA


MODE will be ADD.

4. In the next ACTION row, click the drop down arrow and select
MAXIMIZE.

5. Close and save the macro as Register New Students.

6. Click the RUN button in the Database window.

7. Close the form and return to the objects window.

Page 42 Advanced Access 2003


NOTES
EXERCISE:

1) Create a macro that will open the switchboard, maximized. To


make the switchboard open automatically every time the
database is opened, name the macro Autoexec.

2) On Your Own: Create a macro named BacktoSwitchboard


that will close the RegisterStudents form and open the
switchboard maximized.

3) Use the Close action. In the properties pane, choose the


object type of form, and the object name RegisterStudents.

4) Add the second action OpenForm the Switchboard.


Remember to set the properties to open the correct form.

5) Add the third action to Maximize. No properties need to be


changed.

6) Try out the BacktoSwitchboard macro.

7) Close the database and reopen it.

8) Go back to the objects window.

Advanced Access Page 43


NOTES

 Create a Command Button


You can create 30 different types of command buttons by using the Command
Button Wizard. For example, you can create a command button that finds a
record, prints a record, opens another form, or applies a form filter. You use
a command button on a form to start an action or a set of actions. If you want
a button to perform multiple tasks, simply create a macro then build the
button from that.

Command Button Options:


Category Action Description of Action
Record Navigation Find next Use this once a FIND has
already been performed.
Find record This displays the Find and
Replace dialog box.
These four controls Goto first record Go to the first record.
match the record Goto last record Go to the last record.
navigation buttons. Goto next record Go to the next record.
Goto previous record Go to the previous record
Record Operations Add new record Adds a new, blank record.
Delete record Deletes the current record.
Duplicate record Duplicates the current
record.
Print record Prints the current record.
Save record Saves the current record-this
is not a necessary button
since all data entry is saved
as soon as you move off of
the field.
Undo record Un-does the last thing.
Form operations Apply form filter Applies an already existing
filter to the current form.
Close form Closes the current form
Edit form filter Brings you to Edit filter
view which is very similar
to query view.
Open form Opens a specified form
Print a form Prints all of the records in
the form.
Print current form Prints all of the records in
the form.
Refresh form data It updates only data that
already exists in your
datasheet or form. It doesn't
reorder records, display new
records, or remove deleted

Page 44 Advanced Access 2003


NOTES
records and records that no
longer meet specified
criteria.
Report Operation Mail report Creates a file that it then
attaches to a new, blank
email message.
Preview report Opens the report in Print
Preview.
Print report Prints the report without
displaying in Print Preview.
Send report to File Outputs the report to a file.
Application Quit application Exits Microsoft Access.
Run application Opens a Microsoft
Application.
Run MS Excel Opens Microsoft Excel.
Run MS Word Opens Microsoft Word.
Miscellaneous Auto dialer Opens Microsoft Phone
Dialer, which allows you to
make voice calls, video
calls, and conference video
calls from your personal
computer.
Print table Prints the selected table.
Run macro Runs the selected macro.
Run query Runs the selected query.

STEPS

1. Turn on the Toolbox toolbar by clicking the TOOLBOX button on


the STANDARD toolbar.

2. In Design View of the form, click on the COMMAND BUTTON


button on the TOOLBOX toolbar and then click where you want
the button to be placed.

Advanced Access Page 45


NOTES

3. Click on your choice from the CATEGORIES.

4. Select the appropriate ACTIONS.

5. Click NEXT.

6. The following screens vary depending on the categories and actions


chosen.

7. To have the button display text, type the text in the TEXT line.

Page 46 Advanced Access 2003


NOTES
8. To have an image, choose a default image or click BROWSE to locate
your own.

9. Click NEXT.

10. Type a name for the command button and click FINISH.

Advanced Access Page 47


NOTES

 Display Options
You may want to have a command button on your form that will print the
current record. If you do not want the button to print along with the form,
then you need to change the display properties.

STEPS

1. Click the command button.

2. Click PROPERTIES on the toolbar to open its property sheet.

3. On the FORMAT tab, set the DISPLAY WHEN property to your


choice.

 ALWAYS: displays the button on the screen and prints it out.


 PRINT ONLY: only displays the button on a printed form.
 SCREEN ONLY: only displays the button on the screen.

 Lesson Example

You want to create a button that will print out the current form.

STEPS

1. Open the RegisterStudents form in design view.

2. Turn on the Toolbox toolbar by clicking the TOOLBOX button


on the STANDARD toolbar.

3. Click on the COMMAND BUTTON button on the TOOLBOX


toolbar and then click in the detail section.

4. Click RECORD OPERATIONS from the CATEGORIES.

5. Select the PRINT RECORD.

6. Click NEXT.

7. Type Print Student Information in the TEXT line.

Page 48 Advanced Access 2003


NOTES

8. Click NEXT.

9. Type PrintRecord for the command button and click


FINISH.

10. Click PROPERTIES button on the toolbar to open its property


sheet.

11. On the FORMAT tab, set the DISPLAY WHEN property to


SCREEN ONLY.

EXERCISE:

1) Create a button that will use the BacktoSwitchboard macro


(Hint: Choose RUN MACRO from the MISCELLANEOUS
category and choose the BacktoSwitchboard macro).

2) Set the button properties to only display on the screen.

3) Save the form and return to Form View.

4) Test the buttons.

5) On Your Own: Create a button to preview the Student


Transcript report on the RegisterStudents form (Hint:
Choose PREVIEW REPORT from the REPORT OPERATIONS
category).

6) Set the button properties to only display on the screen, save the
form and return to Form View.

7) Test the button.

Advanced Access Page 49


NOTES

LESSON 6: GIVE IT A TRY!


OBJECTIVE: Practice new skills learned in class.

EXERCISE:

Refer to Lesson 2 for assistance

1) Using the Advanced Access database, create a query in design


view that shows the Location, MaterialCost, and Title from the
Classes table. Name it Material Cost per Location.

2) Create a crosstab query to find out how much each location will
generate in Material Costs. Use Location as the Row Heading;
Title as the column heading, and Sum MaterialCost.

3) Use the Material Cost per Location query. Save as Material Cost
per Location_Crosstab.

4) Create a query based on the Classes table that will show Title,
Material Cost and Lab Fee. Create a calculated field that will add
together material costs and lab fees. Save as Total Fees.

5) Create a Make-Table query that will create a new table based on


the Students table to show students from Augusta. Name the new
table Augusta Students and save it as an action query.

Refer to Lesson 3 for assistance

6) Create a report using the wizard based on all the fields in the Total
Student Fees query. Group it by Title, make it Landscape
orientation, and add an expression that will give totals for fees for
each class. In Design View, arrange fields so they fit better on the
page. Save it as Total Student Fees.

7) Update the Students report so that the students’ names are


concatenated. Delete the fields that are currently used to list the
student names.

Page 50 Advanced Access 2003


NOTES

Refer to Lesson 4 for assistance

8) Update the colors on the switchboard and add different clipart and
graphics to the buttons.

Refer to Lesson 5 for assistance

9) Create a new macro that will open up the Total Fees query and
view it in Design View. Name it Total Fee Update.

Advanced Access Page 51


NOTES

LESSON 7: DELETING OBJECTS


OBJECTIVES: Delete database objects.
Maintain organized file directories.

STEPS

1. To delete an Access database object, select the object and press


DELETE on the keyboard. Click YES to confirm the deletion.

2. To delete an entire database, close the database (if it is open), select


OPEN from the FILE menu, click on the database to be deleted,
press DELETE key on your keyboard, and click YES to confirm the
deletion.

 Lesson Example

Delete the Autoexec macro, the Student Costs report and the copy of the
Advanced Access database that we worked on today.

STEPS

1. Go to the MACROS window in the OBJECTS bar and select the


Autoexec macro and press DELETE on the keyboard. Click Yes
to confirm.

2. Go to the REPORTS window in the OBJECTS bar and select the


Student Costs report and press DELETE on the keyboard. Click
Yes to confirm.

3. Close the database by going to FILE, CLOSE.

4. Select OPEN from the FILE menu.

5. Click once on Advanced Access and press DELETE key on your


keyboard. Click YES to confirm the deletion.

6. Close all open windows and shut down the computer.

Page 52 Advanced Access 2003


NICE TO KNOW

 Mouse Pointers
Text Selector - appears while among text; click to place insertion point or
click and drag to select a section of text
Field Selector - appears on the left side of a field in Datasheet View; click to
select the contents of the field
Column Selector - appears when pointing at field names in Datasheet View;
click to select an entire row
Row Selector - appears in the gray box to left of a record in Datasheet View;
click to select the entire record
Column Resize - appears between field names in Datasheet view or on a
vertical border in Design View of a Form or Report; click and drag to increase
or decrease width
Row Resize - appears on a horizontal border in Design View of a Form or
Report; click and drag to increase or decrease height
Normal Select - allows you to click to choose an object; also allows you to
click and drag a rectangle to select a group of objects
Move - in Design View of a Form or Report, this pointer appears when you
point at the middle a selected control; click and drag to move the control
Move Separately - appears when pointing at the upper left corner of a selected
control; allows you to click and drag a label separately from a text box and
vice versa
Horizontal Resize - appears when you point at a resizing handle (small black
square) on the edge of a control; click and drag away from the object to
enlarge, toward the object to make smaller
Diagonal Resize - see above

Vertical Resize - see above

Add Label - appears when the Label tool is selected in the Toolbox; click to
insert a standard label, or click and drag to draw a specific size
Add Text Box - when the Text tool is selected in the Toolbox, this mouse
pointer will appear; click to insert a standard text box and label, or click and
drag to draw the size you desire

Advanced Access Page 53


 Toolbar Buttons

The View buttons change the perspective of the active object. This button
allows you to go to Design View of any object.
This View button sends you to Datasheet View of a Table or Report.

This View button sends you to Form View.

This View button sends you to Print Preview of a Report.

Save will save your most recent changes.


Print prints the active object. Be careful if your object contains many
records!
Print Preview shows you what your active object will look like on paper.

Spellcheck will check for spelling errors.


Cut removes text or an object and places it on the Clipboard, so it may be
placed elsewhere.
Copy places a copy of the selected text or object on the Clipboard, so it may
be copied to another location.
Paste takes the item from the Clipboard and places it at the location of your
insertion point or selection.
Format Painter allows you to copy the formatting of selected text to other
text in your database.
Undo will undo the last action taken.
Properties allows you to look at the specific attributes of an object in your
database.
Relationships opens the Relationships Window, in which you are able to
view the formal relationships that have been drawn between tables.
AutoForm allows you to create an instant form from a selected table. The
drop down arrow to the right lets you choose a different “AutoObject” to
create.
The Office Assistant provides you with interactive help regarding Access.

Delete will remove the selected object from your database.


Sort Ascending puts your records in alphabetical, chronological, or numeric
order based on the active field.
Sort Descending sorts records backwards.

Page 54
AutoFilter removes any record not including the selected entry.

Filter by Form allows you to filter records by more than one entry.
The Filter button becomes activated when AutoFilter is used. Pushing this
button will remove the current filter. When Filter by Form is used, this
button will turn on the filter once criteria are established, then turn it off
when you wish to see all records.
Find lets you search for an entry.
New Record sends you to a blank record for data entry. Some databases
require a different button to be used.
Delete Record will remove the active record.
Database Window will place the Database Window in front of any other
open windows. You may also use the F11 key.
The Primary Key button will establish the active field as the unique
identifier of the records in a table.

Page 55
 Keyboard Shortcuts

Keystroke
Effect
Combination
F1 Opens Access Help
F6 Moves from Design Grid of Table to Properties section
F9 Updates the active object
F11 Brings the Database Window to the front
Tab Moves you ahead one field
Shift + Tab Moves you backward one field
Enter Moves you ahead one field
Spacebar Toggles a checkmark on and off in a Yes/No field
Ctrl + Alt + down
Opens a drop-down list
arrow
Ctrl + Tab Moves you out of a subform to the next form field
Ctrl + Home Sends you to the beginning of the first record
Ctrl + End Sends you to the end of the last record
Ctrl + ‘ Copies the previous record's entry into the current field
Home Sends you to the beginning of the active record
End Sends you to the end of the active record
Arrow (Cursor) Keys Send you one field in the arrow's direction

Page 56

You might also like