You are on page 1of 254

Access 2003: Advanced

MICROSOFT ACCESS 2003


ADVANCED

WWP Training Limited Page 1


Access 2003: Advanced

STUDENT EDITION

PREFACE I - INTRODUCTION TO TABLE DESIGN ..................................... 9


Concepts of Normalisation..................................................................................10

LESSON 1 - DESIGNING ADVANCED QUERIES ..........................................13


Joining Tables in Queries....................................................................................14
Cross Products ....................................................................................................15
Creating Reverse Outer Joins ..............................................................................15
Creating a Parameter Query ................................................................................16
Creating a Concatenation in a Query ...................................................................17
Exercise..............................................................................................................19
Designing Advanced Queries ..........................................................................19

LESSON 2 - CREATING RELATIONSHIPS ....................................................21


Using Related Tables ..........................................................................................22
Creating a Relationship between Tables ..............................................................23
Setting Referential Integrity ................................................................................24
Viewing Subdatasheets .......................................................................................26
Deleting a Join Line............................................................................................27
Exercise..............................................................................................................29
Creating Relationships ....................................................................................29

LESSON 3 - USING ADVANCED FORM DESIGN ..........................................31


Using Forms in Design View ..............................................................................32
Creating a Combo Box .......................................................................................33
Creating a List Box .............................................................................................34
Creating an Option Group ...................................................................................36
Adding a Logic Control ......................................................................................38
Setting the Tab Order Automatically ...................................................................39
Setting the Tab Order Manually ..........................................................................40
Adding a Form Header and Footer ......................................................................40
Creating a Blank Form........................................................................................42
Exercise..............................................................................................................43
Using Advanced Form Design ........................................................................43

LESSON 4 - USING ADVANCED REPORT DESIGN .....................................45


Adding Report Sections in Design View .............................................................46
Creating a Calculated Control .............................................................................47

Page 2 WWP Training Limited


Access 2003: Advanced

Grouping Data in a Report ................................................................................. 48


Creating Group Headers and Footers.................................................................. 49
Creating a Running Summary ............................................................................ 51
Inserting a Date/Time Control ............................................................................ 52
Inserting a Page Break ....................................................................................... 52
Changing the Report Margins ............................................................................ 53
Creating a Report without Using a Wizard ......................................................... 54
Exercise............................................................................................................. 56
Using Advanced Report Design ..................................................................... 56

LESSON 5 - USING SUBFORMS/SUBREPORTS ........................................... 59


Working with Subforms/Subreports ................................................................... 60
Creating a Subform/Subreport............................................................................ 61
Editing the Layout of a Subform ........................................................................ 62
Displaying a Subform in Datasheet View ........................................................... 63
Displaying a Subform Total ............................................................................... 64
Exercise............................................................................................................. 67
Using Subforms/Subreports ........................................................................... 67

LESSON 6 - USING OTHER FORM TECHNIQUES ...................................... 69


Adding a Command Button ............................................................................... 70
Saving a Form as a Report ................................................................................. 71
Creating a PivotTable or PivotChart View ......................................................... 72
Exercise............................................................................................................. 75
Using Other Form Techniques ....................................................................... 75

LESSON 7 - USING CONTROL WIZARDS .................................................... 77


Form Control Wizards ....................................................................................... 78
Report Control Wizards ..................................................................................... 79
Record Navigation/Operation Control Wizards .................................................. 80
Examining and Changing VBA Code ................................................................. 81
Exercise............................................................................................................. 82
Control Wizards ............................................................................................ 82

LESSON 8 - USING ACTIVEX CONTROLS ................................................... 83


Working with ActiveX Controls ........................................................................ 84
Registering an ActiveX Control ......................................................................... 84
Adding an ActiveX Control ............................................................................... 85
Attaching an ActiveX Control ............................................................................ 86
Exercise............................................................................................................. 87

WWP Training Limited Page 3


Access 2003: Advanced

Using ActiveX Controls..................................................................................87

LESSON 9 - WORKING WITH INDEXES .......................................................89


Viewing Indexes .................................................................................................90
Creating a Single Field Index ..............................................................................91
Creating a Multiple Field Index ..........................................................................92
Deleting an Index ...............................................................................................93
Creating a Multiple Field Primary Key ...............................................................93
Exercise..............................................................................................................95
Working with Indexes.....................................................................................95

LESSON 10 - CREATING MACROS ................................................................99


Working with Macros ....................................................................................... 100
Opening the Macro Design Window ................................................................. 100
Creating a Macro .............................................................................................. 101
Assigning an Argument to an Action ................................................................ 104
Saving a Macro................................................................................................. 108
Using Single Step Mode for Testing ................................................................. 109
Running a Macro .............................................................................................. 110
Editing an Existing Macro ................................................................................ 110
Running a Macro using the Tools Menu ............................................................ 111
Creating a Macro using the Macro Builder ........................................................ 112
Exercise............................................................................................................ 113
Creating Macros ........................................................................................... 113

LESSON 11 - USING MACROS ....................................................................... 115


Using Properties ............................................................................................... 116
Assigning a Macro to a Control ........................................................................ 116
Creating a Command Button ............................................................................. 118
Adding a Condition to a Macro ......................................................................... 120
Creating a Group Macro ................................................................................... 122
Creating an Autoexec Macro ............................................................................ 123
Exercise............................................................................................................ 125
Using Macros ............................................................................................... 125

LESSON 12 - EVENTS...................................................................................... 127


Using Event Properties ..................................................................................... 128
Ensuring Data Entry ......................................................................................... 132
Automatically Filling Fields ............................................................................. 133
Exercise............................................................................................................ 135

Page 4 WWP Training Limited


Access 2003: Advanced

Event Properties ...........................................................................................135

LESSON 13 - USING SWITCHBOARDS ........................................................137


Opening and Using a Switchboard ....................................................................138
Creating a Switchboard Form............................................................................139
Adding a Command Button to a Switchboard....................................................140
Setting Startup Options .....................................................................................142
Exercise............................................................................................................144
Using Switchboards ......................................................................................144

LESSON 14 - CREATING CUSTOM TOOLBARS.........................................147


Creating a Custom Toolbar ...............................................................................148
Adding a Built-in Menu Item ............................................................................149
Creating a Custom Menu Item ..........................................................................150
Adding a Command to a Menu Item .................................................................151
Adding Custom Commands ..............................................................................152
Docking a Floating Toolbar ..............................................................................153
Linking a Toolbar to a Report ...........................................................................153
Adding a Separator Bar.....................................................................................154
Creating a Shortcut Menu .................................................................................155
Linking a Custom Shortcut Menu .....................................................................156
Adding Buttons to a Custom Toolbar ................................................................157
Changing a Button Image .................................................................................158
Deleting a Custom Toolbar ...............................................................................159
Exercise............................................................................................................160
Creating Custom Toolbars ............................................................................160

APPENDICES - ..................................................................................................... 1

APPENDIX I - ANALYZING TABLES .............................................................. 3


Analyzing a Table................................................................................................ 4
Using Relationships in Splits ............................................................................... 4
Using the Table Analyzer Wizard ........................................................................ 4
Using the Performance Analyzer .......................................................................... 6
Exercise............................................................................................................... 9
Analyzing Tables ............................................................................................. 9

APPENDIX II - USING ADVANCED DATABASE FEATURES .................... 11


Importing Data .................................................................................................. 12
Linking Data to an Access Table........................................................................ 13
Using the Linked Table Manager ....................................................................... 14

WWP Training Limited Page 5


Access 2003: Advanced

Exporting Data ...................................................................................................16


Converting Files .................................................................................................17
Printing a Relationship Document .......................................................................19
Compacting a Database ......................................................................................20
Using Name AutoCorrect ...................................................................................20
Backing Up a Database .......................................................................................22
Exercise..............................................................................................................23
Using Advanced Database Features ................................................................23

APPENDIX III - EXPORTING DATA TO EXCEL AND WORD....................25


Exporting Data to an Excel Workbook ................................................................26
Dragging and Dropping Data into Excel..............................................................27
Creating Excel Workbooks - Office Links...........................................................28
Creating Word Documents - Office Links ...........................................................28
Exercise..............................................................................................................30
Exporting Data to Excel and Word..................................................................30

APPENDIX IV - USING ADVANCED QUERY WIZARDS .............................31


Using the Crosstab Query Wizard .......................................................................32
Using the Find Duplicates Query Wizard ............................................................33
Using the Find Unmatched Query Wizard ...........................................................34
Exercise..............................................................................................................36
Using Advanced Query Wizards .....................................................................36

APPENDIX V - USING CHARTS ......................................................................39


Creating a Chart .................................................................................................40
Adding a Chart to a Form or Report ....................................................................42
Activating Microsoft Graph to Edit .....................................................................43
Changing the Chart Type ....................................................................................45
Changing the Chart Title.....................................................................................46
Formatting the Chart Title...................................................................................47
Adding Data Labels to a Chart ............................................................................47
Exercise..............................................................................................................49
Using Charts...................................................................................................49

APPENDIX VI - USING ACCESS AND THE INTERNET...............................51


Working with Hyperlinks ...................................................................................52
Creating a Hyperlink Field..................................................................................52
Inserting a Hyperlink Field .................................................................................53
Editing a Hyperlink Field....................................................................................55

Page 6 WWP Training Limited


Access 2003: Advanced

Deleting a Hyperlink Field ................................................................................. 55


Hiding/Displaying the Web Toolbar................................................................... 56
Creating a Data Access Page .............................................................................. 57
Grouping and Sorting Data Access Pages ........................................................... 59
Creating a PivotTable in a Data Access Page ..................................................... 60

APPENDIX VII - ACCESS SECURITY............................................................ 63


Encrypting a Database ....................................................................................... 64
Assigning a Database Password ......................................................................... 65
Removing a Database Password ......................................................................... 66
Exercise............................................................................................................. 67
Using Access and the Internet ........................................................................ 67

APPENDIX VIII - REPLICATING DATABASES ........................................... 73


Replicating a Database....................................................................................... 74
Synchronizing Database Replicas ...................................................................... 76
Resolving Replication Conflicts ......................................................................... 77
Exercise............................................................................................................. 78
Replicating Databases .................................................................................... 78

APPENDIX IX - INTRODUCTION TO VBA MODULES............................... 79


The Module Window ......................................................................................... 80
Sub Procedures .................................................................................................. 80
Adding Comments ............................................................................................. 81
Keywords .......................................................................................................... 81

INDEX .................................................................................................................. 82

WWP Training Limited Page 7


PREFACE I -
INTRODUCTION TO TABLE DESIGN

In this preface, you will learn how to:


 Normalise Data

WWP Training Limited Page 9


Lesson 1 – Advanced Queries Access 2000: Advanced

CONCEPTS OF NORMALISATION

 Discussion
The theory of database design includes standards called normal forms. The process of
arranging your data into the standards is called Normalisation or Normalising data. By
normalising your database, you eliminate redundant data and organise your tables so
that managing data and future changes to the structure of the database is easier.

By normalising your database you split larger tables into smaller tables which are more
manageable and easier to maintain. To work with the related data you must then
reconnect the tables via relationships between common fields.

Data normalisation is not specific to Access, but is part of the database design process.
There are five normal forms; each addresses specific problems and each assumes the
requirements of the preceding form have been satisfied.

First Normal Form

A Table is in the First Normal Form when each field contains the smallest meaningful
value and the table does not contain repeating groups of fields.

Tables that are not in the first normal form usually have fields containing data that can
be broken down into smaller meaningful parts e.g. placing a complete name into one
field instead of splitting it into first and last names. They also contain repeating groups
of fields which list the same category of data in multiple fields. This can be corrected by
creating separate tables for each of related values.

Second Normal Form

The Second Normal Form applies only to tables with a multiple field primary key. In
these tables any non key fields should relate to the entire primary key. In other words,
any non key fields should be a fact about the entire primary key.

Tables that are not in the second normal form usually have repeating values in a field
due to the fact that the field does not relate entirely to the primary key. If a fields value
depends only on part of the primary key it should be removed and placed in a separate
table.

Third Normal Form

The third normal form applies only to tables with a single field primary key. In these
tables each non key field should be a fact about the primary key. That is a non key field
should not be a fact about another non key field.

Tables that are not in the third normal form usually have repeating values in a field due
to the fact that the field does not relate to the primary key. If a fields value does not
describe the primary key it should be removed and placed in a separate table.

Page 10 WWP Training Limited


Access 2000: Advanced Lesson 1 – Advanced Queries

Fourth Normal Form

A Table is in the Fourth Normal Form when there are no independent one-to-many
relationships between what should be the primary key and non key fields.

Tables not in the fourth normal form usually contain blanks in non key fields and
duplicate values in the field you want to set as the primary key. The usual reason for
this is the table has been based on two different subjects. Separate the data into two new
tables each about one specific topic.

Fifth Normal Form

A Database is in the fifth normal form when the tables are broken down into the
smallest possible tables to eliminate redundant non key fields. Usually, tables that are
not in this form contain repeating values of data in the non key fields.

Putting a database in this form allows you to control database integrity. Because each
piece of non key data normally only appears once in the data base it is relatively easy to
update the data.

Junction Tables

A normalised database will sometimes not contain common fields which allow you to
create relationships between tables. To over come this create a table, sometimes called a
junction table, which contains the fields which can link the tables. For example if you
have a table which has a list of employee numbers and names and a table which
contains project numbers and descriptions. Create a Junction table which contains the
fields for employee number and project number and use this to assign employees to
projects.

When designing tables there are three basic rules that you can
 follow to ensure a good database design.
1. Make each table only about one specific subject.
2. Each non key field should be a fact about the entire
primary key.
3. Each field should contain the smallest meaningful data
value.

WWP Training Limited Page 11


LESSON 1 -
DESIGNING ADVANCED QUERIES

In this lesson, you will learn how to:


 Join Tables in Queries

 Work with Cross Products

 Create Reverse Outer Joins

 Create a Parameter query

 Create a Concatenation in a query


Lesson 1 - Designing Advanced Queries Access 2003: Advanced

JOINING TABLES IN QUERIES

 Discussion
Once a database has been normalised it will contain many smaller tables of related
information. To combine information from these separate tables relationships can be set
up so that when the tables are combined in a query to compile information from more
than one table the common fields are automatically joined and the appropriate
information is retrieved. If this is the case and the appropriate relationships have not
been set up then a join between two tables can be created from within the query.

To create a join in a query drag the appropriate field from the first field list with the
mouse and drop it on the appropriate field on the second field list. The join is created,
but is only effectual within the query it was created and does not affect the rest of the
database.

Once created the type of join can be changed. The default join type is called an inner or
equi join. This type of join will only include records in the recordset where the common
fields match.

This can be changed to a outer join where the all the records in one of the tables plus all
the matching fields from the other table are included in the recordset. This type of outer
join can be changed to include all the records from either the left hand or fight hand of
the two tables plus the remaining matching fields.

Once created the join type can be changed by double clicking on the join in the design
view of the query and selecting the appropriate type required from the resulting dialog
box. Outer joins are indicated in the query design view by placing an arrow on either
the left or right hand side of the join line.

To remove a join from a query select the join with the mouse and then press the delete
key.

When adding more than one table to a query the Control and
 Shift Keys can be used to make multiple selections of tables in
the show table window.

Access 2003 will automatically create joins between two


 fields on different tables when they are added to a query, if
they share the same name, one is a primary key and they have
the same (or compatible) data types.

Page 14 WWP Training Limited


Access 2003: Advanced Lesson 1 - Designing Advanced Queries

Procedures
1. Open the database.
2. Create a new query in Design view
3. Select the tables required and add then to the query
4. Create any required joins by dragging one common field from one
field list to another common field on the second field list.
5. Select the required fields for the query as usual
6. Run the query.

CROSS PRODUCTS

 Discussion
When a query of more than one table is created without any relationships or joins
Access has no way of matching common fields between these tables. When this
happens the recordset is said to be called a cross product.

A cross product recordset will match every single record on one table with every single
record on the second table. For example if you create a query with two tables and no
join. If there was 100 records on one table and 40 records on the other the cross product
record set would contain 4,000 records (100 * 40).

To correct a cross product query create an appropriate join between the two tables in the
query.

CREATING REVERSE OUTER JOINS

 Discussion
By using the is null criteria in combination with an outer join it is possible to get a
record set from a query that was previously not available.

For example in the previous example the query was created with an inner join and
displayed 82 results of customers and their orders. By changing the join type to an outer
join the recordset displayed 84 results including two companies who had yet to place an
order. By applying a criteria of is null to the Order Number Field only the two
customers who haven’t placed an order will be displayed in the recordset.

WWP Training Limited Page 15


Lesson 1 - Designing Advanced Queries Access 2003: Advanced

CREATING A PARAMETER QUERY

 Discussion
You can create a query to which you add different criteria each time you run it; such a
query is called a parameter query. A parameter query is designed to prompt the user for
input each time it is run; Access then runs the query based on the criterion (parameter)
entered. A parameter query allows you to quickly and easily change query criteria
without having to redesign the query.

Creating a parameter query

You can add multiple parameters to a query; when you run the
 query, a prompt will appear for each parameter in it.

Procedures
1. Open the desired query in Design view.
2. Select the Criteria row in the desired field.
3. Type an open bracket ([), the desired prompt, a colon, and the close
bracket (]).
4. Press [Enter].

Page 16 WWP Training Limited


Access 2003: Advanced Lesson 1 - Designing Advanced Queries

CREATING A CONCATENATION IN A QUERY

 Discussion
A concatenation query allows you to combine two or more text fields into one field. In
other words, concatenation enables you to append one text string to another. In addition,
you can insert characters between the text strings as needed. For example, you can
concatenate the City, State, and Postal Code fields and store the concatenated text
string in a fourth field, the Address field, adding commas and spaces between the text
strings as needed.

When typing a concatenation expression, the first part of the expression defines the
name of the new field and the second part of the expression defines the fields which are
to be concatenated. All field names must be surrounded by brackets. The concatenation
character (the ampersand - &) appears between field names, and you must enclose any
additional characters in double quotes. For example, the expression Names: [Last
Name]&", "&[First Name] concatenates the Last Name and First Name fields and
inserts the concatenated text string into a field called Names. The new field displays the
last name, a comma, a space, and the first name for each record in the table.

Creating a concatenation expression

You can also use concatenation to create text strings in forms


 and reports.

To use the Expression Builder to concatenate text, select any


 blank Field row and click the Build button on the Query
Design toolbar.

Procedures
1. Open the desired query in Design view.
2. Select any blank Field row in the design grid.
3. Type the desired concatenation expression.

WWP Training Limited Page 17


Lesson 1 - Designing Advanced Queries Access 2003: Advanced

4. Press [Enter].

Page 18 WWP Training Limited


Access 2003: Advanced Lesson 1 - Designing Advanced Queries

EXERCISE
DESIGNING ADVANCED QUERIES

 Task
Design advanced queries.

Create a query and set the join type. Create a parameter and a concatenation query.

1. Open Train Relationships.


2. Create a query in design view
3. Add the Trainer and Project tables
4. Add the Initials, Project ID and Start Date Fields
5. Run the query and observe the cross product result
6. Return to the design view.
7. Create a join between the Initials field in the Trainer field list and
the Trainer Initials field in the Project field list
8. Run the query and observe the results
9. Return to the design view.
10. Change the join type to include all the records from the Trainer table
11. Run the query and observe the results
12. Return to the design view.
13. Add a parameter query that allows you run view records relating to
the Initials.
14. Run the query and locate the records for the initials DF
15. Return to the design view.
16. Between the Initials field and the Project ID field add a new field
that concatenates the Trainer’s First Name and Last Name fields
17. Run the query and locate the records for the initials GE
18. Return to the design view and delete the parameter query
19. Add the is null criteria to the Project ID Field
20. Run the query and observe the results
21. Close the query saving it as Join
22. Close the database file.

WWP Training Limited Page 19


LESSON 2 -
CREATING RELATIONSHIPS

In this lesson, you will learn how to:


 Use related tables

 Create a relationship between tables

 Set referential integrity

 View subdatasheets

 Delete a join line


Lesson 2 - Creating Relationships Access 2003: Advanced

USING RELATED TABLES

 Discussion
Tables can be joined, or related, in order to access and coordinate information in all the
fields of the related tables. Joining tables is a useful way to avoid entering duplicate
information in various, related tables. In addition, it allows you to create reports, forms,
and queries from the related data tables and save them in the database file. Relating
tables allows you to create smaller, more efficient tables that can be referenced when
you need access to the data.

When you relate tables, the table from which you select a field to join is the primary
table, and the second table containing the field you want to associate is the related table.
The tables must have at least one common field that contains the same type of data.
This common field is called the join field. The join fields in both tables must have the
same or equivalent data types and, if they are Number fields, they must have the same
field size. In addition, the join field in the primary table must be the primary key in
order to avoid duplicate entries.

For example, the following table consists of customer names and address fields, along
with a unique identification number for each customer, which serves as the primary key
in the table. You can create this number or allow Access to create it for you.

ID # Names Address City State Zip

1 Smith 11692 J St. NW Washington DC 20013


2 Conrad 16 Allegheny Center Pittsburgh PA 16489
3 Kane 1012 Broadway Lexington KY 40567
4 Apple 516 Beacon Ave. Seattle WA 98051
5 Billow 9249 Cavalcade St. Houston TX 77002

You could then create a separate table consisting only of orders placed by customers.
This table would also contain the field for the unique customer identification number,
but not the customers’ names and addresses.

ID # Order
1 Office Work Center
2 All-In-One Corner Desk and Hutch
3 Open-Front Steel Bookcase
4 2-Drawer Letter File
5 Executive Leather Chair, Black

Page 22 WWP Training Limited


Access 2003: Advanced Lesson 2 - Creating Relationships

By relating the two tables through the common customer identification number field,
the customers’ name and address does not have to be entered for every order. All that
has to be entered is the customer identification number, along with the orders.

Access includes two basic types of relationships: one-to-many and one-to-one. A one-
to-many relationship occurs when one record from the primary table matches many
records from the related table (e.g., one customer record matches many order records).
A one-to-one relationship occurs when one record from the primary table matches one
record from the related table. Access determines the relationship type automatically
when you create the relationship.

CREATING A RELATIONSHIP BETWEEN TABLES

 Discussion
The Relationships window displays a graphic representation of database relationships
and allows you to create relationships between tables. You drag field lists in the
Relationships window to reposition them as needed. In addition, any field name that
represents a primary key is bolded in the corresponding field list.

You can add tables to the Relationships window for additional joins. For example, if the
Relationships window displays only two related tables and you need to access
information from a third table, you can easily add the required table to the Relationships
window and then create the join.

Adding a field list to the Relationships window

The Show Table dialog box opens automatically if no tables


 have been added to the Relationships window.

WWP Training Limited Page 23


Lesson 2 - Creating Relationships Access 2003: Advanced

You can also open the Relationships window by selecting the


 Tools menu and the Relationships command or by right-
clicking in the Database window and selecting the
Relationships command.

You can select multiple tables in the Show Table dialog box
 by holding the [Ctrl] key as you click each table. Selecting
Add adds all the selected tables to the Relationships window.

Procedures
1. Click the Relationships button on the Database toolbar.

2. Click the Show Table button on the Relationship toolbar, if


necessary.
3. Select the first table you want to relate.
4. Select Add.
5. Select the second table you want to relate.
6. Select Add.
7. Select Close.
8. Drag the desired field from the first field list to the matching field in
the second field list.
9. Select Create.
10. Close the Relationships window.
11. Select Yes.

SETTING REFERENTIAL INTEGRITY

 Discussion
When you create a relationship between two tables, you can set referential integrity.
Referential integrity is a built-in set of rules Access uses to make sure that the
relationship is valid. Referential integrity can also prevent accidental deletion or editing
of data. In order to use referential integrity, the following conditions must be true: the
related field in one table must be its primary key, the related fields in both tables must
have the same data type, and both tables must belong to the same database.

Page 24 WWP Training Limited


Access 2003: Advanced Lesson 2 - Creating Relationships

When you set referential integrity, you must observe the following three rules; First,
you cannot enter data in the join field in the "many" table that does not have a match in
the join field in the "one" table. Second, you cannot delete records from the "one" table
if there are matching records in the "many" table. Third, you cannot edit primary key
values if related records exist.

If you want to perform any of the changes listed above, however, and still maintain
referential integrity, you can select the Cascade Update Related Fields and Cascade
Delete Related Records options in the Edit Relationships dialog box. If either or both
of these options are selected, Access automatically makes the necessary changes to
related tables to maintain referential integrity. It is recommended that these two options
be selected only after careful consideration, since the changes cannot be undone.

When referential integrity is enforced, Access displays symbols above the join line to
indicate the type of relationship, one-to-one or one-to-many. The number 1 above a join
line indicates “one”, and the mathematical symbol for infinity (which resembles a
horizontal 8) indicates “many”.

Setting referential integrity

Double-clicking the middle segment of any join line opens the


 Edit Relationships window with the selected join displayed.
Double-clicking the beginning or ending segment of any join
line opens the Edit Relationships window, but with no join
selected. You can then use the Table/Query list to select the
desired join.

You can also open the Edit Relationships dialog box by


 selecting the Relationships menu and the Edit Relationship
command or by right-clicking the join line and then selecting
the Edit Relationship command.

WWP Training Limited Page 25


Lesson 2 - Creating Relationships Access 2003: Advanced

Procedures
1. Open the Relationships window.
2. Double-click the middle segment of the desired join line.
3. Select the Enforce Referential Integrity option.
4. Select the Cascade Update Related Fields option, if desired.
5. Select the Cascade Delete Related Records option, if desired.
6. Select OK.

VIEWING SUBDATASHEETS

 Discussion
Subdatasheets are datasheets nested in the primary table and display the data in joined
tables. When you join tables in a one-to-many relationship, Access creates
subdatasheets in the table containing the primary key.

When tables are joined, Access inserts a column containing plus signs to the left of the
first field in the primary table. Clicking the plus sign expands a subdatasheet with the
data in the related table displayed. If the table contains additional joins, you can expand
subdatasheets to display each related table. Access can display up to eight levels of
subdatasheets.

In addition to viewing data, you can edit data right in the subdatasheet; the edited data is
saved back to the table in which it is stored.

Displaying subdatasheets

Page 26 WWP Training Limited


Access 2003: Advanced Lesson 2 - Creating Relationships

Access can also create subdatasheets for one-to-one


 relationships.

If Access cannot determine which subdatasheet to display, the


 Insert Subdatasheet dialog box opens so that you can select the
table you want to view. In addition, you can select a different
subdatasheet from the Insert Subdatasheet dialog box at any
time by selecting the Insert menu and the Subdatasheet
command.

Procedures
1. Open the primary table in Datasheet view.
2. To display a subdatasheet, click the plus sign next to the record you
want to expand.
3. Display additional subdatasheets, if available.
4. Click the minus sign next to any subdatasheet you want to collapse.

DELETING A JOIN LINE

 Discussion
Deleting a join line removes the relationship between two tables. You may want to
delete a join line if you no longer need to relate the tables or you want to create a
different relationship.

You must select a join line before you can delete it.

You must click the middle segment of a join line in order to


 select it; clicking the beginning or ending segment does not
select the join line.

You can also delete a join line by right-clicking its middle


 segment and selecting the Delete command.

You can remove an unrelated field list from the Relationship


 window by selecting it and pressing the [Delete] key.

WWP Training Limited Page 27


Lesson 2 - Creating Relationships Access 2003: Advanced

Procedures
1. Open the Relationships window.
2. Click the middle segment of the join line you want to delete.
3. Press [Delete].
4. Select Yes.

Page 28 WWP Training Limited


Access 2003: Advanced Lesson 2 - Creating Relationships

EXERCISE
CREATING RELATIONSHIPS

 Task
Create relationships between tables and set referential integrity.

1. Open Train08x.
2. Open the Relationships window.
3. Add the Client and Project tables to the Relationships window.
4. Create a relationship between the Client ID field in the Client table
and the Client ID field in the Project table; set referential integrity
for the relationship.
5. Add the Trainer table to the Relationships window.
6. Create a relationship between the Trainer Initials field in the
Project table and the Initials field in the Trainer table; set
referential integrity for the relationship.
7. Close the Relationships window and save the changes.
8. Open the Client table in Datasheet view and view the subdatasheet
for the CONCORD client. Then, collapse the subdatasheet and close
the Client table.
9. Open the Relationships window. Delete the relationship line between
the Project and Trainer tables and remove the Trainer field list,
since it is no longer related to any tables. Then, close the
Relationships window and save the changes.
10. Close the database file.

WWP Training Limited Page 29


LESSON 3 -
USING ADVANCED FORM DESIGN

In this lesson, you will learn how to:


 Use forms in Design view

 Create a combo box

 Create a list box

 Create an option group

 Add a logic control

 Set the tab order automatically

 Set the tab order manually

 Add a form header and footer

 Create a blank form


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

USING FORMS IN DESIGN VIEW

 Discussion
You can create or customize a form in Design view. A form has three basic sections:
Detail, Form Header/Footer, and Page Header/Footer.

The Detail section contains the information from the table or query. You create controls
in the Detail section that allow you to display or enter information. Access provides a
variety of control types you can add to the form to simplify the data entry process. For
example, you can replace a text box with a list box or an option group so that you can
select a value rather than type it during data entry. In many cases, it is quicker and
easier to select a value from a list rather than to remember the value you want to use and
then type it. Having a list of choices also helps to ensure the consistency of the data
being entered.

The Form Header and Form Footer sections display at the top and bottom of a form
in Form view. They are stationary when you scroll the Detail section, making them
useful for displaying titles or instructions you want visible on the form at all times. If
you print the form, these sections appear at the top of the first page and at the bottom of
the last page. You can also place controls, including images, labels, and fields in the
form header or footer.

The Page Header and Page Footer sections display at the top and bottom of the form
in Design view. They do not appear in Form view. Rather, they display at the top and
bottom of every page when the form is printed. Page headers and footers can contain
images, lines, and text, or any other controls you want printed on every page.

When you enable the display of either the page or form header/footer section, both the
header and the footer appear. You can drag the header and footer sections to resize
them.

A form with form and page headers and footers in Design view

Page 32 WWP Training Limited


Access 2003: Advanced Lesson 3 - Using Advanced Form Design

CREATING A COMBO BOX

 Discussion
You can create a combo box on a form. A combo box provides you with a list of values
from which you can choose. Choosing from a list is much faster and more accurate than
remembering a value to be typed. However, you can also type a value directly into a
combo box if the appropriate value is not available from the list.

A combo box can be bound to a field, meaning that when you select or enter a value,
that value is entered into that field in the corresponding table. A combo box can also be
unbound, meaning that when you select or enter a value, it is held in memory to be used
in another control or calculation.

Access provides a Combo Box Wizard that guides you through the process of creating a
combo box. You can select the list of values from an existing table or query, or you can
create the values for the list yourself. If you choose to select the list from an existing
table or query, the wizard prompts you to enter the table or query and the field name. If
you choose to create the list of values yourself, the wizard displays a column for the
entries. Either way, once the values are entered into the wizard, you then specify
whether the values should be entered into a field in the table or held in memory for later
use. You complete the combo box by entering a label.

When you use the Combo Box tool, the mouse pointer changes into a copy of the tool
with a plus sign (+) above and to the left of it.

A combo box added to a form

WWP Training Limited Page 33


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

Procedures
1. Open the desired form in Design view.
2. Display the toolbox.

3. Click the Combo Box tool in the toolbox.


4. Click in the form in the location where you want the combo box to
appear.
5. Select the desired option for the source of the combo box values.
6. Select Next.
7. Select the desired view option.
8. Select the table or query containing the values for the combo box in
the Which table or query should provide the values for your
combo box? list box.
9. Select Next.
10. Select the field containing the values from the Available Fields list
box.
11. Select Next.
12. Select Next.
13. Select the desired storage option for the field.
14. Select the Store that value in this field list, if applicable.
15. Select the desired field name, if applicable.
16. Select Next.
17. Type a label for the combo box.
18. Select Finish.

CREATING A LIST BOX

 Discussion
You can create a list box on a form. A list box provides you with a list of values from
which you can choose. Choosing from a list is much faster and more accurate than
remembering a value to be typed. However, unlike a combo box, you can only choose
an item from the list; values not present on the list cannot be entered into the table.

A list box can be bound to a field, meaning that when you select or enter a value, the
value is entered into a field in the corresponding table. A list box can also be unbound,

Page 34 WWP Training Limited


Access 2003: Advanced Lesson 3 - Using Advanced Form Design

meaning that when you select or enter a value, it is held in memory to be used in
another control or calculation.

The List Box Wizard guides you through the process of creating a list box. You can
select the list of values from an existing table or query, or you can create the values for
the list yourself. If you choose to select the list from an existing table or query, the
wizard prompts you to enter the table or query and the field name. If you choose to
create the list of values yourself, the wizard displays a column for the entries. Either
way, once the values are entered into the wizard, you then specify whether the values
should be entered into a field in the table or held in memory for later use.

When you use the List Box tool, the mouse pointer changes into a copy of the tool with
a plus sign (+) above and to the left of it. The center of the plus sign (+) indicates the
position of the top left corner of the list box.

A list box added to a form

You can set the default value for a list box by opening the
 property sheet and typing the desired value in quotation marks
in the Default Value property box on the Data page.

Procedures
1. Open the desired form in Design view.
2. Display the toolbox.

3. Click the List Box tool in the toolbox.


4. Click in the form in the location where you want the combo box to
appear.

WWP Training Limited Page 35


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

5. Select the desired option for the source of the list box values.
6. Select Next.
7. Type the number of columns for the list box.
8. Press [Tab].
9. Type the first value for the list box.
10. Press [Tab].
11. Continue to type values as desired.
12. Select Next.
13. Select the desired storage option for the field.
14. Select the Store that value in this field list, if applicable.
15. Select the desired field name, if applicable.
16. Select Next.
17. Type a label for the list box.
18. Select Finish.

CREATING AN OPTION GROUP

 Discussion
You can create an option group on a form. An option group provides you with a limited
set of values from which you can choose. Choosing from a set of values is often much
faster and more accurate than remembering a value to be typed. With an option group,
you can only select one option from the set of alternatives. Therefore, option groups are
best utilized when there are five or less values from which to choose. Adding more than
five values to an option group can crowd a form and is less effective for quick data
entry.

An option group has a frame that encloses the set of values. These values appear beside
option buttons or check boxes, or on top of toggle buttons.

The Option Group Wizard guides you through the process of creating an option group.
An option group can be bound to a field in a table or query. However, only the frame is
bound to the field. Within the frame, Access assigns each option a numeric value,
starting with the number 1. When the option is selected, this numeric value is entered
into the corresponding field. Access assigns a number because the value of an option
group cannot be text. For example, if a product comes in three colors (white, black, and
green), you can use an option group in an order entry form to select the color being
ordered. By default, Access assigns the number 1 to the White option, the number 2 to
the Black option, and the number 3 to the Green option. You only see the White,
Black, and Green options on the form, but Access actually stores the assigned numbers
in the corresponding field in the table.

Page 36 WWP Training Limited


Access 2003: Advanced Lesson 3 - Using Advanced Form Design

When you use the Option Group tool, the mouse pointer changes into a copy of the
tool with a plus sign (+) above and to the left of it. The center of the plus sign (+)
indicates the position of the top left corner of the option group.

An option group added to a form

Procedures
1. Open the desired form in Design view.
2. Display the toolbox.

3. Click the Option Group tool in the toolbox.


4. Click in the location on the form where you want the option group to
begin.
5. Type the desired label for the first option.
6. Press [Tab].
7. Type other labels as desired.
8. Select Next.
9. Select the desired option for the default.
10. Select Next.
11. Type new values for the labels, if desired.
12. Select Next.
13. Select the desired storage option for the field.

WWP Training Limited Page 37


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

14. Select the Store the value in this field list, if applicable.
15. Select the desired field name, if applicable.
16. Select Next.
17. Select the desired option for the control type.
18. Select the desired style option.
19. Select Next.
20. Type the caption for the option group.
21. Select Finish.

ADDING A LOGIC CONTROL

 Discussion
Some tables contain fields that have a Yes/No field type. These fields can contain a Yes
(True) value, a No (False) value, or no value at all.

When working with a form that contains a Yes/No field, you can create a logic control
that is bound to the Yes/No field. Logic controls give a visual display of the value in a
Yes/No field, such as a check box where a check mark appears when the field value is
Yes and does not appear when the value is No. Another type of logic control is the
toggle button, which appears “sunken” for a value of Yes and “raised” for a value of
No. The logic control for a field with a null value (neither Yes nor No is chosen)
appears the same as the field with a No value.

Logic controls improve the visual effectiveness of a form and facilitate data entry. With
a logic control, the value of a Yes/No field is selected with a single click of the mouse
button rather than multiple keystrokes.

The way in which the different controls indicate a Yes or No value are described in the
following table:

Control Appearance
Toggle button Appears “sunken” with a Yes value and “raised” with
a No value.
Option button Contains a dot with a Yes value and appears empty
with a No value.
Check box Appears checked with a Yes value and unchecked
with a No value.

Page 38 WWP Training Limited


Access 2003: Advanced Lesson 3 - Using Advanced Form Design

Procedures
1. Open the desired form in Design view.
2. Display the toolbox.
3. Click the desired logic control tool in the toolbox.
4. Click in the form where you want the logic control to appear.

5. Click the Properties button on the Form Design toolbar.


6. Select the Data tab.
7. Select the Control Source list.
8. Select the Yes/No field you want bound to the logic control.
9. Click the Close button to close the property sheet.
10. Select the label box of the logic control.
11. Select the default text.
12. Type the desired logic control name.
13. Press [Enter].

SETTING THE TAB ORDER AUTOMATICALLY

 Discussion
The tab order determines the order in which form fields and controls are selected when
you press the [Tab] key during data entry. The default tab order is the order in which
the fields or controls were added to the form. If you have added, rearranged, or deleted
fields or controls, the tab order may not be suitable for data entry. You can choose to
have Access automatically rearrange the tab order to reflect the order of the fields on
the form. The fields are then accessed from left to right across each row.

You can also open the Tab Order dialog box by right-clicking
 in the Design window and then selecting the Tab Order
command.

WWP Training Limited Page 39


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

Procedures
1. Open the desired form in Design view.
2. Select the View menu.
3. Select the Tab Order command.
4. Select Auto Order.
5. Select OK.

SETTING THE TAB ORDER MANUALLY

 Discussion
The tab order determines the order in which form fields and controls are selected when
you press the [Tab] key during data entry. The default tab order is the order in which
the fields or controls were added to the form. If you have added, rearranged, or deleted
fields or controls, the tab order may not be suitable for data entry. You can adjust the
tab order manually to reflect whatever order is best for your data entry needs.

Procedures
1. Open the desired form in Design view.
2. Select the View menu.
3. Select the Tab Order command.
4. Select the record selector to the left of the field you want to move.
5. Drag the field to the new position.
6. Select OK.

ADDING A FORM HEADER AND FOOTER

 Discussion
The Form Header and Form Footer sections display at the top and bottom of the form
in Form view. They are stationary when you scroll the Detail section, making them
useful for displaying titles or instructions you want visible on the form at all times. If

Page 40 WWP Training Limited


Access 2003: Advanced Lesson 3 - Using Advanced Form Design

you print the form, these sections appear at the top of the first page and the bottom of
the last page.

You can place controls, including images, labels, and fields, in the form header or
footer.

A label added to the Form Header section

You can also display the Form Header and Form Footer
 sections by right-clicking in the Design window and then
selecting the Form Header/Footer command.

You can also add Page Header and Page Footer sections to a
 form. Page headers and footers only appear when the form is
printed. These sections can be added to the form by selecting
the View menu and then selecting the Page Header/Footer
command.

You can change the height of a section by dragging the bottom


 border of the section up or down.

Procedures
1. Open the desired form in Design view.
2. Display the toolbox.
3. Select the View menu.
4. Select the Form Header/Footer command.

WWP Training Limited Page 41


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

CREATING A BLANK FORM

 Discussion
You can create a form from scratch in Design view. For example, if a form does not
currently exist for a particular table or query, you can create one using the fields in the
selected table or query. You can then determine the design of the form by adding fields,
control, and options.

A form created from scratch

Procedures
1. Display the Forms object list.

2. Select the New button on the Database window toolbar.


3. Select Design View.
4. Select the Choose the table or query where the object’s data
comes from list.
5. Select the table or query on which you want to base the form.
6. Select OK.
7. Add items to the form as desired.

Page 42 WWP Training Limited


Access 2003: Advanced Lesson 3 - Using Advanced Form Design

EXERCISE
USING ADVANCED FORM DESIGN

 Task
Use advanced form design.

1. Open Train18x.
2. Create a new form in Design view based on the Project table.
3. Add the Client ID, Course Name, and Sales Rep fields to the 2.5cm
(1”) mark on the horizontal ruler on the form. Move all the controls
so that the labels begin at the 3.8cm (1/2”) mark on the horizontal
ruler.
4. Close the form and save it as Sales.
5. Open the New Payment Form form in Design view. Display the
ruler and the toolbox, if necessary.
6. Using the Combo Box tool, create a combo box for the trainers’
initials at the 3.8cm (1 1/2") mark the horizontal ruler, below the
Payment Date text box.
7. Indicate that the combo box should look up values in a table as the
source for the values in the list. Select Table: Trainer as the table
and include the Initials field in the combo box. Accept the default
column width. Store the values entered in the combo box in the
Trainer Initials field and label the combo box Trainer Initials.
8. Using the List Box tool, create a list box for the credit rating at the
3.8cm (1 1/2”) mark on the horizontal ruler, below the Trainer
Initials combo box.
9. Indicate that you want to type in the values for the list box. Use one
column and type the values A, B, and C as separate entries. Store the
values entered in the list box in the Credit Rating field and label the
list box Credit Rating.
10. Reduce the height of the list box so that it displays only one line of
text. Move the controls under, and left-aligned with the Trainer
Initials controls.
11. Select the Project ID, Payment Date, Trainer Initials, and Credit
Rating bound controls (text boxes) and size them to the narrowest
size. Then, vertically space them equally.
12. Using the Option Group tool, create an option group at the 2.5cm
(1”) mark on the vertical ruler, below the Total Sale text box.

WWP Training Limited Page 43


Lesson 3 - Using Advanced Form Design Access 2003: Advanced

13. Type Yes and No as the label names and select Yes as the default
choice. Change the default value of the Yes label to -1 and the No
label to 0. Store the value entered in the option group in the
Recorded field. Use Option buttons as controls and select the
Raised style. Enter Recorded? as the label.
14. Open the Tab Order dialog box and set the tab order automatically.
15. Switch to Form view and press [Tab] as necessary to view the tab
order. Return to Design view.
16. Create a custom tab order. Move the Payment Date above the
Amount Paid and close the Tab Order dialog box.
17. Display the form header in Design view and create a label with the
text Payment Form in the left side of the form header.
18. Switch to Form view and create the following new record.

Field Value
Project ID: 23
Payment Date: 10/3/01
Amount Paid: 600
Trainer Initials: EK
Credit Rating: B
Recorded: No
19. Close the form and save it.
20. Close the database file.

Page 44 WWP Training Limited


LESSON 4 -
USING ADVANCED REPORT DESIGN

In this lesson, you will learn how to:


 Add report sections in Design view

 Create a calculated control

 Group data in a report

 Create group headers and footers

 Create a running summary

 Insert a date/time control

 Insert a page break

 Change the report margins

 Create a report without using a wizard


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

ADDING REPORT SECTIONS IN DESIGN VIEW

 Discussion
You can create or customize a report in Design view. A report has three basic sections:
Detail, Report Header/Footer, and Page Header/Footer.

The Detail section contains the information from the table or query. You create controls
in the Detail section that display information. You can display either one record per
page or multiple records per page.

The Report Header and Report Footer sections display at the top and bottom of the
report in Design view. When you print the report, these sections appear at the beginning
and the end of the report only. The header can be used for report titles, while the footer
can be used for report totals or other summaries.

The Page Header and Page Footer sections display at the top and bottom of the report
in Design view. When the report is printed, these sections appear at the top and bottom
of every page. Page headers and footers can contain images, lines, text, or any other
controls you want printed on every page.

When you enable the display of either header and footer section, both the header and the
footer appear. You can drag the header and footer sections to size them.

Adding report sections

Procedures
1. Open the desired report in Design view.
2. Select the View menu.

Page 46 WWP Training Limited


Access 2003: Advanced Lesson 4 - Using Advanced Report Design

3. Select the Page Header/Footer or Report Header/Footer


command.

CREATING A CALCULATED CONTROL

 Discussion
You can add a calculated control to a form or report. A calculated control is not bound
to a field. It contains an expression that uses information from fields to calculate a
result. The result is not stored in a table. It is calculated when the report or form is run.

You can type the expression that calculates the result directly into the control or open
the property sheet and type the expression into the Control Source property box on the
Data page.

A calculated control created in a report

You can also create an expression using the Expression


 Builder. You can open the Expression Builder by clicking the
Build button on the Report Design toolbar, selecting
Expression Builder and then OK. The Expression Builder
button also appears to the right of the Control Source
property on the Data page in the property sheet.

A calculated control in a form or report cannot be based on


 another calculated control in the form or report. However, you
can base a calculated control on a calculated field in a query.

WWP Training Limited Page 47


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

Procedures
1. Open the desired report in Design view.
2. Display the toolbox.

3. Click the Text Box tool in the toolbox.


4. Click in the desired location for the control.
5. Type the desired calculated control expression.
6. Press [Enter].
7. Select the label box paired with the control.
8. Press [Delete].

GROUPING DATA IN A REPORT

 Discussion
You can group data in reports that have a common field. It is often easier to read a
report when data is grouped, since you can then easily find the pertinent data. For
example, you can group a sales report by region so that regional personnel can easily
locate the data for their region.

A grouped report automatically sorts the table by the data in the grouped field. You can
nest groups inside one another, up to ten levels. For example, in the regional report, you
may want to group by state within each region.

When you group data, you can display a group header and footer that can be used to
display information at the top or bottom of each group. For example, you can add a
calculated control in a group footer that calculates summary information, such as a total
or an average for each group. Additionally, you can control page breaks by specifying
how group heading and records should be kept together.

You can also use the Sorting and Grouping dialog box to
 specify multiple fields on which to sort. You do not have to
display group headers or footers for all sort fields. For
example, you can group an order form by order number and
sort within the group by order date.

Page 48 WWP Training Limited


Access 2003: Advanced Lesson 4 - Using Advanced Report Design

Procedures
1. Open the desired report in Design view.

2. Click the Sorting and Grouping button on the Report Design


toolbar.
3. Select the Field/Expression list.
4. Select the desired field.
5. Select the corresponding Sort Order field.
6. Select the Sort Order list.
7. Select the desired sort order.
8. Select the Group Header property.
9. Select the Group Header list.
10. Select the desired option.
11. Select the Group Footer property.
12. Select the Group Footer list.
13. Select the desired option.
14. Select the Group On property.
15. Select the Group On list.
16. Select the desired option.
17. Click the Close button.

CREATING GROUP HEADERS AND FOOTERS

 Discussion
You can create a header and footer for each group that appears in a grouped report.

The header displays at the top of each group. Often, the group header contains the
control for the grouped field, meaning that the common value on which the grouping is
based, such as the region, appears only once at the top of each group.

A group footer is often used to display summary information about the group, such as
total or average sales. You create a group summary by inserting a calculated control
into the group footer and create an expression using an aggregate function such as Sum
to display group totals or Avg to display group averages. Group aggregate functions can
also be placed in a group header.

WWP Training Limited Page 49


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

A group header in a report

You can also create an expression using the Expression


 Builder. You can open the Expression Builder by clicking the
Expression Builder button to the right of the Running Sum
property on the Data page in the property sheet. You can also
use the Build button on the Report Design toolbar to open the
Expression Builder.

Procedures
1. Open the desired report in Design view.
2. Select the control you want to insert into the group header.
3. Drag the control to the corresponding group header section.
4. To create a group summary, click the Text Box tool in the toolbox.
5. Click in the location for the control.
6. Type the desired summary expression for the calculated control.
7. Press [Enter].
8. Select the label box paired with the control.
9. Double-click the text in the label box.
10. Type the desired label text.
11. Press [Enter].

Page 50 WWP Training Limited


Access 2003: Advanced Lesson 4 - Using Advanced Report Design

CREATING A RUNNING SUMMARY

 Discussion
In a grouped report, you can create a running summary of the items in the group. A
running summary provides a cumulative total for all the groups above.

Often, the running summary is positioned in the group footer, which appears at the
bottom of every group. For example, in a sales report grouped by region, you can create
a calculated field that displays information in a running summary. After each group, a
cumulative total for all the groups above appears.

Using an expression to create a running summary

Procedures
1. Open the desired report in Design view.
2. Create the group summary calculated control expression.
3. Select the calculated control.

4. Click the Properties button on the Report Design toolbar.


5. Select the Data tab.
6. Select the Running Sum property.
7. Select the Running Sum list.
8. Select the desired option.
9. Click the Close button to close the property sheet.

WWP Training Limited Page 51


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

INSERTING A DATE/TIME CONTROL

 Discussion
You can insert controls that display the current date and/or time in a report. Each
control updates automatically every time the report is previewed or printed. By default,
a date/time control is inserted into the Report Header section. However, you can easily
move it to another section. For example, you could place the date in the Report Footer
section so that it would be readily visible on the last page of the report.

The Date and Time dialog box inserts a control that uses the
 =Date() function to display the current date.

If you create a report with the Report Wizard, Access


 automatically inserts a date/time control in the Page Footer
section with the =Now() function, formatted to show the date
only in Long Date format.

Procedures
1. Open the desired report in Design view.
2. Select the Insert menu.
3. Select the Date and Time command.
4. Select or deselect options as desired.
5. Select OK.
6. Drag the date control to the desired position in the report.

INSERTING A PAGE BREAK

 Discussion
When you print a report, Access automatically starts a new page when necessary. You
can control the pagination by inserting a page break. You can insert a page break in the
Group Footer section to place each group on its own page, or you can insert a page
break in the Report Header section to create a separate title page for a report.

Page 52 WWP Training Limited


Access 2003: Advanced Lesson 4 - Using Advanced Report Design

Previewing a page break

Procedures
1. Open the desired report in Design view.
2. Display the toolbox.

3. Click the Page Break tool in the toolbox.


4. Click in the location for the page break.

CHANGING THE REPORT MARGINS

 Discussion
By default, the margins for a report are one inch on all sides. You can control the
margin settings to fit more or less data on a page as necessary. The margins you set for
a report are saved and applied each time you print the report.

Procedures
1. Open the desired report in Design view.
2. Select the File menu.

WWP Training Limited Page 53


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

3. Select the Page Setup command.


4. Select the text in the Top box.
5. Type the new measurement for the top margin.
6. Select the text in the Bottom box.
7. Type the new measurement for the bottom margin.
8. Select the text in the Left box.
9. Type the new measurement for the left margin.
10. Select the text in the Right box.
11. Type the new measurement for the right margin.
12. Select OK.

CREATING A REPORT WITHOUT USING A W IZARD

 Discussion
You can create a report from scratch in Design view. For example, if a report does not
currently exist for a particular table or query, you can create one using the fields in the
selected table or query. You can then determine the design of the report by adding
fields, control, and options.

A report created without using a wizard

Page 54 WWP Training Limited


Access 2003: Advanced Lesson 4 - Using Advanced Report Design

Procedures
1. Display the Reports object list.

2. Select the New button on the Database window toolbar.


3. Select Design View.
4. Select the Choose the table or query where the object’s data
comes from list.
5. Select the table or query on which you want to base the report.
6. Select OK.
7. Add items to the report as desired.

WWP Training Limited Page 55


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

EXERCISE
USING ADVANCED REPORT DESIGN

 Task
Use advanced report design.

1. Open Train18x.
2. Create a new report in Design view based on the Project table.
3. Add the Client ID field to the 2.5cm (1") mark on the horizontal
ruler in the Detail section. Below the Client ID field, add the
Course Name, Trainer Initials, and Students fields to the report at
the 7.5cm (3") mark on the horizontal ruler in the Detail section.
4. Display the report header and footer. Using the toolbox, add a label
to the left side of the report header. Enter the text Client
Information.
5. Preview the report. Then, close the report and save it as Client Info.
6. Open the Project Information Report report in Design view.
Display the toolbox, if necessary.
7. Add a calculated control below the Trainer Initials text box to
calculate the profit margin of each project. The calculation should
use the following formula: =[Total Sale]*.08. Format the calculation
as currency. Position the calculated control under the Trainer
Initials text box. Change the text in the label to Profit Margin. If
necessary, resize the label to view all the text, and then, position it
under the Trainer Initials label.
8. Preview the report. Notice the profit margin calculation. Then,
switch back to Design view.
9. Sort the report by the Trainer Initials field in an Ascending order
and a secondary sort by Project ID in Ascending order. (Hint: Use
the first and second rows of the Sorting and Grouping dialog box.)
For the Trainer Initials field, include a group header and group
footer, group on each value, and keep the whole group together.
10. Move both Trainer Initials controls to the Trainer Initials Header
section. Move the Profit Margin controls up directly below the
Total Sale controls.
11. Use the Toolbox toolbar to create a horizontal line above the Project
ID controls from 0cm (0”) to 10cm (4”) on the horizontal ruler.
Then, reduce the size of the Details section by moving the bottom
border just under the Profit Margin controls.

Page 56 WWP Training Limited


Access 2003: Advanced Lesson 4 - Using Advanced Report Design

12. Preview the report and scroll through the pages. Notice that the
trainer initials now appear as a header and the records for each
trainer are kept together on a page. Switch back to Design view.
13. Create a new calculated control at the 7.5cm (3”) mark on the
horizontal ruler in the Trainer Initials Footer section that sums the
profit margin for projects by each trainer. The calculation should use
the following formula: =Sum([Total Sale]*.08). Format the
calculated control as currency. Change the text in the label control to
Total Profit.
14. Create another horizontal line in the Trainer Initials Footer section,
above the Total Profit controls, and from 0cm (0”) to 10cm (4”) on
the horizontal ruler. Then, preview the report.

15. Switch back to Design view and change the Total Profit calculated
control to a running summary for each group.
16. Preview the pages of the report. Notice that the total profit
calculation is now cumulative for each trainer.
17. Switch back to Design view. Display the Report Header/Footer
section.
18. Insert the date only using the default date format Move the date
control to the Page Footer section.
19. Adjust the top and bottom page margins to 2cm (.75").

WWP Training Limited Page 57


Lesson 4 - Using Advanced Report Design Access 2003: Advanced

20. Preview the report to see the new margins. Notice that the date
appears on each page of the report. Close the report, saving the
changes.
21. Use the Label Wizard to create labels based on the Trainer table.
Use the Avery L7161 labels and the default font and color settings.
Include the First Name and Last Name fields, separated by a space
on the same line. Sort the labels by the Last Name and First Name
fields. Use Labels Trainer as the name of the report.
22. Close the labels report after viewing it.
23. Close the database file.

Page 58 WWP Training Limited


LESSON 5 -
USING SUBFORMS/SUBREPORTS

In this lesson, you will learn how to:


 Work with subforms/subreports

 Create a subform/subreport

 Edit the layout of a subform

 Display a subform in Datasheet view

 Display a subform total


Lesson 5 - Using Subforms/Subreports Access 2003: Advanced

W ORKING WITH SUBFORMS/SUBREPORTS

 Discussion
You can display a form/ report within a form/ report. The main form/ report includes
information from one table and the subform/ subreport includes information from a
second, related table.

You can show a form or report within a form/ report to more effectively show the
linked data from tables with one-to-many relationships. The main form/ report and the
subform/ subreport are linked by a common field between the tables. The main form/
report represents the one side of the one-to-many relationship and the subform/
subreport represents the many side. When viewing a record in the main form/ report
(one side relationship), the subform/ subreport displays the related records from another
table (many side relationship). For example, you have a Customer table and an Orders
table. Each customer has several orders. In the Customer form (bound to the Customer
table), you can include an Orders subform (bound to the Orders table). The tables
would probably be linked by a Customer ID field; a field present in both tables. As you
view a customer’s record displayed in the main form, the order records of that customer
appear in the subform. When you move to the next customer record in the main form,
the order records in the subform are updated to display that customer’s orders. Just as
you can manipulate table data in a form, you can also manipulate the related table data
using the subform. Using the same example, you can edit the customer records or the
order records.

Subform data can be displayed in either Form view (one record at a time) or Datasheet
view (many records displayed at once), while subreport data can only be displayed in
Print Preview. You can also create and display subform data in a PivotTable or
PivotChart.

You can add any number of subforms/ subreports to a form/ report as well as add a
subform/ subreport within another subform/ subreport. You should keep in mind that
the purpose of a form/ report is to make viewing and entering data easier. You can
avoid cluttering the form/ report (which can cause confusion) by positioning the
subform(s) or subreport(s) carefully, assigning a different background color to each, and
removing any unnecessary items, such as scroll bars. Viewing the properties of the
subform/ subreport is helpful when considering these options.

The SubForm/ SubReport Wizards provide the easiest method for creating a subform
subreport. If you choose not to use the SubForm/ SubReport Wizards, you will need to
design a form/ report and then insert it into another form/ report. You may not want to
use the wizard if you are designing a subform/ subreport that is very different in
appearance from the form report the wizard produces.

Page 60 WWP Training Limited


Access 2003: Advanced Lesson 5 - Using Subforms/Subreports

CREATING A SUBFORM/SUBREPORT

 Discussion
When you add a subform/ subreport to an existing form, it is best to start by creating the
main form/ report before you create the subform/ subreport. The form/ report can then
be edited so that it contains only the information you need, as well as the desired layout.
This form can be added to the design of the main form where it will take on the
properties of a subform or subreport.

You can create a subform that will appear in Form view, Datasheet view, or both
views. When the form is created using the SubForm Wizard, a subform is created that
can be viewed in both Form and Datasheet views. You can customize the subform in
Design view by adding headers, footers, color, fonts, totals, etc.

The SubForm/SubReport Wizard prompts you for the following information:

1. If you want to use an existing form/report as the subform/subreport


or build a new one from tables and queries.
2. If you want to define the link between the main form/report and
subform/subreport yourself or choose from a list of available link
options.
3. A name for the subform or subreport.

A subform within a form

Although it is not necessary to click the Control Wizards


 button before creating a subform or subreport, it is
recommended. Clicking this button enables the control
wizards that assist you in creating a subform or subreport.

WWP Training Limited Page 61


Lesson 5 - Using Subforms/Subreports Access 2003: Advanced

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Display the toolbox.

4. Click the Control Wizards tool in the toolbox, if necessary.

5. Click the Subform/Subreport tool in the toolbox.


6. Click in the form or report where you want to place the top left
corner of the subform or subreport.
7. Select the desired option for the source of the subform or subreport.
8. Select the desired form or report you want to insert as a subform or
subreport.
9. Select Next.
10. Select the desired link option.
11. Select the desired link for the subform or subreport from the list box.
12. Select Next.
13. Type a name for the subform or subreport.
14. Select Finish.

EDITING THE LAYOUT OF A SUBFORM

 Discussion
In order to improve the efficiency or appearance of a subform/ subreport, you can
change its layout the same way you would change the layout of a form/ report. In
Design view for the main form/ report, the subform/ subreport is a control that you can
move, resize, align, add, and delete as you would any other control. Since the subform/
subreport control contains a form/ report, you can open it in Design view and make any
editing changes to its controls. Any changes to the layout of the subform/ subreport are
performed in Design view.

You can open a subform into a separate Design window by


 right-clicking the desired subform and then selecting the
Subform in New Window command from the shortcut menu.

Page 62 WWP Training Limited


Access 2003: Advanced Lesson 5 - Using Subforms/Subreports

Procedures
1. Open the desired database.
2. Open the main form in Design view.
3. Double-click the subform control you want to edit.
4. Double-click the subform control text to select it.
5. Make the desired editing changes.

DISPLAYING A SUBFORM IN DATASHEET VIEW

 Discussion
You can display a subform in Datasheet view. This option allows you to view many
subform records at once, rather than viewing them one at a time in Form view. Since
the benefit of using subforms is to display the “many” side of a one-to-many
relationship, Datasheet view is generally preferred.

A subform in Datasheet view

You can add a record to both the main form and the subform
 by selecting the Insert menu and then selecting the New
Record command.

WWP Training Limited Page 63


Lesson 5 - Using Subforms/Subreports Access 2003: Advanced

You can also display a subform in Datasheet view by right-


 clicking in the desired field, pointing to the Subform
command, and then selecting the Datasheet command.

Procedures
1. Open the desired database.
2. Open the main form in Form view.
3. Select a field in the subform.
4. Select the View menu.
5. Point to the Subform command.
6. Select the Datasheet command.

DISPLAYING A SUBFORM TOTAL

 Discussion
Forms and reports often include totals of the information they contain. These totals are
easily created by adding a calculated control to the form or report that contains an
expression to find the desired total. Expressions are used to obtain information you
cannot obtain directly from the tables in your database. For example, if you have a table
that contains the quantity and cost of various items, you could use an expression to
multiply the quantity and the cost to obtain the current inventory value. Every time you
use a form/report, Access calculates any expressions contained in the form/report,
helping you keep your information as accurate as possible.

Some examples of expressions are listed in the following table:

Control Expression Result


Name
Total =[Cost]+[Shipping]+[Markup] Adds the value of the
Cost field, the value of
the Shipping field, and
the value of the Markup
field of an item to
produce the Total field
Discount =[Price]*.15 Multiplies the Price field
of an item by a constant
discount of 0.15

Page 64 WWP Training Limited


Access 2003: Advanced Lesson 5 - Using Subforms/Subreports

Control Expression Result


Name
Date =Date() Provides the current date
in your computer system

You may want to include a total of information, contained in a subform/subreport, in


the main form/report total. For example, an Orders form may contain a control for
shipping charges. The information in the Product subform may include a total, such as
the total cost of all the products ordered. You can display this subform total on the main
form so that you can add the shipping charges to this total to create a grand total. This
option is performed by adding a control to the main form/report, which refers to the
desired subform/subreport total control, to display the information.

The expression in the main form/report control that refers to the subform/subreport
control defines the name of the subform/subreport and the name of the
subform/subreport control being used in the following format:

= [Name of the Subform/Subreport]![Name of the Subform/Subreport Control]

A subform total displayed in the main form

You can also display a subreport total in the main report using
 the same methods that you use to display a subform total.

You can also display the property sheet by selecting the View
 menu and then selecting the Properties command or by right-
clicking a form or report in Design view and then selecting the
Properties command.

You can also display the property sheet by pressing [F4] on


 the keyboard.

WWP Training Limited Page 65


Lesson 5 - Using Subforms/Subreports Access 2003: Advanced

Procedures
1. Open the desired database.
2. Open the form or report in Design view.
3. Display the toolbox.

4. Click the Text Box tool in the toolbox.


5. Click in the form or report where you want to insert the control.
6. Select the label box.
7. Select the text in the label box.
8. Type a label in the label box.
9. Select the text box.

10. Click the Properties button on the Form Design or Report


Design toolbar.
11. Select the Data tab.
12. Type the expression that refers to the desired subform control.
13. Click the Close button to close the property sheet.

Page 66 WWP Training Limited


Access 2003: Advanced Lesson 5 - Using Subforms/Subreports

EXERCISE
USING SUBFORMS/SUBREPORTS

 Task
Use a subform.

1. Open Train28x.
2. Open the Invoice Form form in Design view.
3. Use the SubForm Wizard to create a subform in the bottom center of
the form.
4. Insert the existing Project Form form as a subform.
5. Select the appropriate option from the list box to link the main form
and subform by the Project ID field. Name the subform Project
Info.
6. Delete the subform’s label box.
7. Size and position the subform control so that all the fields appear, if
necessary.
8. Switch to Form view to see the subform.

9. Close the database file.

WWP Training Limited Page 67


LESSON 6 -
USING OTHER FORM TECHNIQUES

In this lesson, you will learn how to:


 Add a command button

 Save a form as a report

 Create a PivotTable or PivotChart view


Lesson 6 - Using Other Form Techniques Access 2003: Advanced

ADDING A COMMAND BUTTON

 Discussion
You can design one or more command buttons to appear on a form. These command
buttons can then be used to access commonly used functions. For example, if you
frequently use the Calculator, you can create a command button that can simply be
clicked to instantly access the Calculator.

Command buttons are particularly useful because they do not require the database user
to know the Microsoft Access menu structure. For example, instead of making the user
select the Print command from the File menu to print a displayed form, you could add
the Print function to a command button on the form.

Access provides different actions for you to use, which are available in the following
categories: Record Navigation, Record Operations, Form Operations, Report
Operations, Application, and Miscellaneous.

Adding a command button

If you click the Control Wizards button before you create a


 command button, Access provides you with a wizard that
helps you create the command button.

Procedures
1. Open the desired database.
2. Open the desired form in Design view.

Page 70 WWP Training Limited


Access 2003: Advanced Lesson 6 - Using Other Form Techniques

3. Display the toolbox.

4. Click the Control Wizards tool in the toolbox.

5. Click the Command Button tool in the toolbox.


6. Click in the form where you want to insert the command button.
7. Select the desired category from the Categories list box.
8. Select the desired action from the Actions list box.
9. Select Next.
10. Type the file name of the application you want to run and the path if
necessary.
11. Select Next.
12. Select whether you want text or a picture to display on the button.
13. Select the text in the Text box or select the desired picture.
14. Type the text you want to appear on the button, as necessary.
15. Select Next.
16. Type the desired name for the button.
17. Select Finish.

SAVING A FORM AS A REPORT

 Discussion
If you have an existing form you print often, you can save the form as a report. It is
possible to print a form directly, but reports are more suitable for presenting
information on paper, especially if you need to include group totals. Once a form is
saved as a report, its structure can be modified in Report Design view to suit your
needs.

You can also open the Save As dialog box by selecting the
 desired form in the Database window, selecting the File menu,
and then selecting the Save As command.

WWP Training Limited Page 71


Lesson 6 - Using Other Form Techniques Access 2003: Advanced

Procedures
1. Open the desired database.
2. Display the Forms object list.
3. Right-click the form you want to save as a report.
4. Select the Save As command.
5. Type a name for the report.
6. Select the As list.
7. Select the desired Report or Form item.
8. Select OK.

CREATING A PIVOTTABLE OR PIVOTCHART VIEW

 Discussion
You can view any database form in PivotTable or PivotChart view using the View
list. In PivotTable view, you can summarize and analyze large amounts of data.
PivotChart view allows you to display data in a graphical environment. You design a
PivotTable or PivotChart view by dragging fields from the Field List to preset drop
areas in the PivotTable or PivotChart view workspace. As an alternative to dragging
fields, you can also select the desired field in the Field List, select the desired drop area
from the bottom of the Field List, and then use the Add to button to add the field to
that field.

In the Field List, fields are listed below a corresponding fieldset. When you expand the
fieldset, the individual fields are displayed. Field names become bolded when they are
added to the view workspace.

Once the table or chart is designed, fields can be moved, added, or deleted as desired. In
addition, you can apply formatting to the items in PivotTable or PivotChart to enhance
its appearance. You can use options in the property sheet or buttons on the Formatting
(PivotTable/PivotChart) toolbar to apply formatting.

When you create a PivotTable view, Access automatically creates a PivotChart view,
and vice versa. The PivotTable layout is slightly different than the PivotChart layout,
however, and may require slight modification. Specifically, when you drag a field into
the Drop Totals or Detail Fields Here area in a PivotTable, that field is added as a
detail field which displays the detail but not a summary of the detail. Because of the
nature of this field, the information will not display on the chart in the data field area. In
this instance, you will need to add that same field to the data area in PivotChart view.
The addition is also reflected in the PivotTable. Any formatting applied to items in each
view, however, is independent of the other view.

Page 72 WWP Training Limited


Access 2003: Advanced Lesson 6 - Using Other Form Techniques

PivotTable and PivotChart views are automatically saved and updated as part of the
layout of the form when you close the form.

You can also display data in a table or query in PivotTable


 and PivotChart view.

If necessary, you can display the Field List by selecting the


 Field List button on the Formatting (PivotTable/PivotChart)
toolbar, or by right-clicking a blank area of the view
workspace and selecting Field List.

Changes made in PivotTable or PivotChart view cannot be


 undone.

Procedures
1. Open the desired database.
2. Open the desired form.
3. Select the View list on the Form Design toolbar.
4. Select PivotTable View or PivotChart View.
5. Click the Field List button on the PivotTable toolbar.
6. To add a row or category, expand the fieldset on the Field List
containing the field you want to drag to the Drop Row Fields Here
or Drop Category Fields Here area on the view workspace.
7. Drag the desired field button from the Field List to the Drop Row
Fields Here or Drop Category Fields Here area.
8. To add a column or series, expand the fieldset on the Field List
containing the field you want to drag to the Drop Column Fields
Here or Drop Series Fields Here area on the view workspace.
9. Drag the desired field button from the Field List to the Drop
Column Fields Here or Drop Series Fields Here area.
10. To add a totals or a data detail field, expand the fieldset on the Field
List containing the field you want to drag to the Drop Totals or
Detail Fields Here or Drop Data Fields Here area on the view
workspace.
11. Drag the desired field button from the Field List to the Drop Totals
or Detail Fields Here or Drop Data Fields Here area.
12. To add a filter field, expand the fieldset on the Field List containing
the field you want to drag to the Drop Filter Fields Here area on the
view workspace.

WWP Training Limited Page 73


Lesson 6 - Using Other Form Techniques Access 2003: Advanced

13. Drag the desired field button from the Field List to the Drop Filter
Fields Here area.

Page 74 WWP Training Limited


Access 2003: Advanced Lesson 6 - Using Other Form Techniques

EXERCISE
USING OTHER FORM TECHNIQUES

 Task
Use other form techniques.

1 Open Train29x.
2. Display the Forms object list. Open Payment Form in Design view.
Use the Command Button Wizard to add a command button to run
the Calculator from calc.exe. (Hint: Select the Application category
in the wizard.) Have the text Calc appear on the command button
and name the button mycalc. Position the command button on the
form, as desired.
3. Switch to Form view and click the Calc command button to open
the Calculator. Close the Calculator. Close the form and save the
changes.

4. From the Database window, save the Payment Form as a report.


Use the default Copy of Payment Form as the name of the report.
5. Display the Reports object list and verify that the Copy of Payment
Form report was saved.
6. Open the Payment Form in Design view. Design a PivotTable
View using Project ID in the row field, Months in the column field
(Hint: Select Months under the Payment Date: By Month fieldset),
Amount Paid in the detail field, and Credit Rating in the filter
field.
7. Bold the Months column headings and change the background of the
Project ID row headings to any shade of blue. Close the form.
8. Close the database file.

WWP Training Limited Page 75


LESSON 7 -
USING CONTROL WIZARDS

In this lesson, you will learn how to:


 Use Form Control Wizards

 Use Report Control Wizards

 Use Navigation Control Wizards

 Examine and change VBA Code


Lesson 7 - Using Control Wizards Access 2003: Advanced

FORM CONTROL W IZARDS

 Discussion
By using the Form Control Wizards a command button can be set to open a form by
clicking on it. The form can be opened showing all the records or just a set of relevant
records. For example a command button can be set up on a form displaying invoice
information that when activated will display a form showing information about the
customer specific to the invoice currently displayed.

If you select the Control Wizards button before you create a


 command button, Access provides you with a wizard that
helps you create the command button.

Procedures
1. Open the database.
2. Open the form in Design view.

3. Select the Control Wizards button in the toolbox.

4. Select the Command Button tool in the toolbox.


5. Click in the form where you want to insert the command button.
6. Select the Form Operations from the Categories list box.
7. Select the Open Form from the Actions list box.
8. Select Next.
9. Select the appropriate form
10. Select Next.
11. Select either show all records or find specific data as required.
12. Select Next.
13. If required match the fields on each form so Access can find the
specific data on the opening form. Select Next.
14. Select whether you want text or a picture to display on the button.
15. Select the text in the Text text box or select the desired picture.
16. Type the text you want to appear on the button, as necessary.

Page 78 WWP Training Limited


Access 2003: Advanced Lesson 8 – ActiveX Controls

17. Select Next.


18. Type the desired name for the button.
19. Select Finish.

REPORT CONTROL W IZARDS

 Discussion
By using the Report Control Wizards a command button can be set to open a Report by
clicking on it. The Report can opened in Print Preview or printed directly. Thus a
Report can be previewed or printed directly from a Form by clicking on a command
button without having to return to the database window.

Procedures
1. Open the database.
2. Open the form in Design view.

3. Select the Control Wizards button in the toolbox.

4. Select the Command Button tool in the toolbox.


5. Click in the form where you want to insert the command button.
6. Select the Report Operations from the Categories list box.
7. Select Preview Report from the Actions list box.
8. Select Next.
9. Select the Report required.
10. Select Next.
11. Select whether you want text or a picture to display on the button.
12. Select the text in the Text text box or select the desired picture.
13. Type the text you want to appear on the button, as necessary.
14. Select Next.
15. Type the desired name for the button.

WWP Training Limited Page 79


Lesson 7 - Using Control Wizards Access 2003: Advanced

16. Select Finish.

RECORD NAVIGATION/OPERATION CONTROL


W IZARDS

 Discussion
The Command Button Wizards can be used to control record navigation within a Form.
So a Command Button can be used to move forward or backwards through records in a
form or to create a new record. This can be useful when setting up forms for users who
are not so familiar with Access.

Procedures
1. Open the database.
2. Open the form in Design view.

3. Select the Control Wizards button in the toolbox.

4. Select the Command Button tool in the toolbox.


5. Click in the form where you want to insert the command button.
6. Select Record Operation from the Categories list box.
7. Select Add Record from the Actions list box.
8. Select Next.
9. Select whether you want text or a picture to display on the button.
10. Select the text in the Text text box or select the desired picture.
11. Type the text you want to appear on the button, as necessary.
12. Select Next.
13. Type the desired name for the button.
14. Select Finish.

Page 80 WWP Training Limited


Access 2003: Advanced Lesson 8 – ActiveX Controls

EXAMINING AND CHANGING VBA CODE

 Discussion
When using the Command Button Wizard to create a Command Button Access writes
VBA code to actually perform the operation the button is design for. The VBA code
(called an Event Procedure) is assigned to the On Click Property. Thus when the button
is clicked the VBA code is run and the operation is performed.

Once Access has written the VBA for the button it can be edited to alter the operation
the button performs. By Selecting the Event Procedure assigned to the On Click
property for the Command Button and then clicking on the build option the VBA
module window is opened. Now the VBA Code can be edited.

By editing the Event Procedures created by the Command


 Button Wizards it can make the options available from them
far more flexible.

Procedures
1. Open the database.
2. Open the form in Design view.
3. Move the mouse the required Command Button
4. Double Click on the Button to activate the Property Sheet.
5. Select the Event Properties Tab
6. Select the On Click Property
7. Click on the Build Icon to the right of the Event Procedure
8. Edit the VBA code as necessary
9. Close the Module Window

WWP Training Limited Page 81


Lesson 7 - Using Control Wizards Access 2003: Advanced

EXERCISE
CONTROL W IZARDS

 Task
Create a command button to open a form and then edit the Event Procedure created to
open the form in Data Entry Mode.

1. Open Train13a.
2. Open the Project Form in Design view.
3. Create a command button using the Command Button Wizard to
open the Payment Form displaying the specific payments for that
Project. Label and Name the Button Project Payments.
4. Test the Button.
5. Return to the Project Form.
6. Open the Event Procedure for the On Click Event Property of the
Project Payments Button.
7. Add the acFormAdd command to the open form command.
8. Close the module window.
9. Edit the Button Label to New Payment.
10. Test the button.
11. Close the Payment Form.
12. Close the Project Form saving the changes.
13. Close the Database

Page 82 WWP Training Limited


LESSON 8 -
USING ACTIVEX CONTROLS

In this lesson, you will learn how to:


 Work with ActiveX controls

 Register an ActiveX control

 Add an ActiveX control

 Attach an ActiveX control


Lesson 8 – ActiveX Controls Access 2003: Advanced

W ORKING WITH ACTIVEX CONTROLS

 Discussion
In addition to the standard controls, such as option groups, combo boxes, and list boxes,
you can add ActiveX controls to a form or report. ActiveX controls are small
applications that can improve the appearance or functionality of a form or report. A
commonly used ActiveX control is the calendar control. This control appears as a
calendar in a form or report. The calendar control can be bound to a Date field in the
form. Instead of having to type in the dates, you can just click the desired date on the
calendar.

ActiveX controls were referred to as Custom Controls in


 previous versions of Access.

The calendar control is included with your Access application


 and is available as long as you selected it during the Access
Setup routine when you installed the software. Other ActiveX
controls are available from the Access Developer’s Edition as
well as from vendors other than Microsoft. ActiveX controls
have an .ocx file extension.

REGISTERING AN ACTIVEX CONTROL

 Discussion
Before you can use an ActiveX control, it must first be registered with Access. Once it
is registered, the name of the control appears in the ActiveX Controls dialog box.
Access then knows that the control exists and where it is located on the computer or
network.

The ActiveX Controls dialog box

Page 84 WWP Training Limited


Access 2003: Advanced Lesson 8 – ActiveX Controls

Procedures
1. Open the desired database.
2. Select the Tools menu.
3. Select the ActiveX Controls command.
4. Select Register.
5. Select the Look in list.
6. Select the drive where the control is located.
7. Select the folder where the control is located.
8. Select the file containing the desired ActiveX control.
9. Select OK.
10. Select Close.

ADDING AN ACTIVEX CONTROL

 Discussion
After you register an ActiveX control with Access, you can add it to a form or report.
Once it is added, the ActiveX control can be used like any other control. You can move
and size it, as necessary, to fit on the form or report. You can also display and change
the properties of an ActiveX control.

The ActiveX calendar control

WWP Training Limited Page 85


Lesson 8 – ActiveX Controls Access 2003: Advanced

You cannot add an ActiveX control to a form if it has not been


 registered with Access.

Procedures
1. Open the desired database.
2. Select the Insert menu.
3. Select the ActiveX Control command.
4. Select the desired ActiveX control.
5. Select OK.

ATTACHING AN ACTIVEX CONTROL

 Discussion
Depending on the ActiveX control and its function, you can attach it to an existing table
in Access. For example, you can attach the calendar control from Microsoft Windows
95 to a Date field in Access. The calendar will then display the date on a calendar page
for the appropriate month and year.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Select the ActiveX control.

4. Click the Properties button on the Form Design toolbar.


5. Select the Data tab.
6. Select the Control Source list.
7. Select the desired data source.
8. Click the Close button to close the property sheet.

Page 86 WWP Training Limited


Access 2003: Advanced Lesson 8 – ActiveX Controls

EXERCISE
USING ACTIVEX CONTROLS

 Task
Use ActiveX controls.

1. Open Train30x.
2. Open the Project Form form in Design view.
3. Insert the ActiveX calendar control onto the form.
4. Open the property sheet for the calendar control. Set the data source
in the Control Source property box to the Start Date field. Close
the property sheet.
5. Size the calendar control until it is approximately 3'' wide and 2''
high and position it below the existing controls, if necessary. Add a
label called Start Date and centre it above the calendar control.
6. Switch to Form view and move through the records. Notice that the
calendar changes to reflect the start dates.
7. Close the form without saving the changes.
8. Close the database file.

WWP Training Limited Page 87


LESSON 9 -
WORKING WITH INDEXES

In this lesson, you will learn how to:


 View indexes

 Create a single field index

 Create a multiple field index

 Delete an index

 Create a multiple field primary key


Lesson 9 - Working with Indexes Access 2003: Advanced

VIEWING INDEXES

 Discussion
You can use indexes to help Access perform quicker sorts and searches. You should
index the fields you use regularly to sort or search for data.

Indexes have important properties that are listed in the following table:

Property Description
Primary Designates whether or not the index is the primary key
for the table. In other words, this property designates
whether or not the data in the indexed field will be
used to uniquely identify each record. If this property
is set to Yes, the Unique property must be set to Yes.
Unique Designates whether or not the values in the indexed
field must be unique for each record. You can set this
property to Yes without setting the Primary property
to Yes.
Ignore Nulls Determines whether or not records with null values in
the indexed field are included in the index. The default
setting is No, which means that null values are
included.

The Indexes window

You can also display the Indexes dialog box by selecting the
 View menu and then selecting the Indexes command when a
table is open in Design view.

Page 90 WWP Training Limited


Access 2003: Advanced Lesson 9 - Working with Indexes

You cannot create an index for Memo, OLE, or Hyperlink


 fields.

If there are a limited number of different values in a field, then


 indexing the field does not noticeably speed up searches and
sorts. In fact, it may slow down data entry and editing.

Procedures
1. Open the desired database.
2. Open the table in Design view.

3. Click the Indexes button on the Table Design toolbar.

CREATING A SINGLE FIELD INDEX

 Discussion
You should index at least one field for each table to maximize performance. You should
select a field you are likely to use in searches and sorts.

When you change the Indexed property of a field to Yes, you can choose whether or
not to allow duplicates. If you choose the No Duplicates option, Access will not allow
duplicate values to be entered into the field.

Procedures
1. Open the desired database.
2. Open the desired table in Design view.
3. Select the field you want to index.
4. Select the Indexed property.
5. Select the Indexed list.
6. Select the desired indexing option.

WWP Training Limited Page 91


Lesson 9 - Working with Indexes Access 2003: Advanced

CREATING A MULTIPLE FIELD INDEX

 Discussion
If you often search on a combination of fields, you can create an index on multiple
fields to speed up the searches and sorts. For example, if you want to sort customers in
order by region and alphabetically within each region, you can create an index on the
Region and Customer fields.

You must create a multiple field index in the Indexes window. All the fields you want
to include in the index should be listed under the same index name. You can include up
to ten fields in an index.

Procedures
1. Open the desired database.
2. Open the table in Design view.

3. Click the Indexes button on the Table Design toolbar.


4. Select the first blank field in the Index Name column.
5. Type the name of the index.
6. Press [Tab].
7. Select the Field Name list.
8. Select the field you want to index.
9. Press [Tab].
10. Select the Sort Order list.
11. Select the desired sort order.
12. Select the next blank field in the Field Name column.
13. Select the Field Name list.
14. Select the field you want to index.
15. Press [Tab].
16. Select the Sort Order list.
17. Select the desired sort order.
18. Close the Indexes window.

Page 92 WWP Training Limited


Access 2003: Advanced Lesson 9 - Working with Indexes

DELETING AN INDEX

 Discussion
Indexes take up disk space and can slow down the process of adding, editing, and
deleting records. In fact, if there are a limited number of different values in a field, the
sort or search speed is not significantly increased by indexing the field. Therefore, you
can delete any unwanted indexes to increase efficiency.

Procedures
1. Open the desired database.
2. Open the table in Design view.

3. Click the Indexes button on the Table Design toolbar.


4. Point to the row selector to the left of the row containing the index
you want to delete.
5. Click the row selector to the left of the row containing the index you
want to delete.
6. Press [Delete].

CREATING A MULTIPLE FIELD PRIMARY KEY

 Discussion
There are times when it is not possible to uniquely identify fields with the values in a
single field. Therefore, Access allows you to create a primary key using multiple fields.

When you set a primary key using multiple fields, the combination of the information in
the fields must be unique. For example, you have a table that contains line items for
customer orders. The order number is entered for each customer. Because you will most
likely have multiple customers with multiple orders, the order number associated with
each customer may not be unique. Also, a particular item number may appear in
multiple orders. Therefore, the item numbers may not be unique. Thus, you cannot
create a primary index on either of these fields by themselves. The solution is to create a
primary key index on both fields, which allows each item to appear only once on each
order.

WWP Training Limited Page 93


Lesson 9 - Working with Indexes Access 2003: Advanced

Creating a multiple field primary key

Procedures
1. Open the desired database.
2. Open the table in Design view.
3. Point to the row selector to the left of the row containing the first
field for the primary key.
4. Click the row selector to the left of the row containing the first field
for the primary key.
5. Hold the [Ctrl] key and point to the row selector for the second
primary key field.
6. Click the row selector for the second primary key field and release
the [Ctrl] key.

7. Click the Primary Key button on the Table Design toolbar.

Page 94 WWP Training Limited


Access 2003: Advanced Lesson 9 - Working with Indexes

EXERCISE
W ORKING WITH INDEXES

 Task
Work with indexes.

1. Open Train31x.
2. Open the Invoice table in Design view.
3. Index the Client ID field, allowing duplicates.
4. Open the Indexes window.
5. Create a multiple field index called Client/Project. The first field in
the index should be Client ID and the second field should be Project
ID. Use the Ascending sort order for both.

6. Close the Indexes window. Then, close the Invoice table without
saving the changes.
7. Open the Project table in Design view.
8. Open the Indexes window and delete the existing indexes. Close the
Indexes window.
9. Create a multiple field primary key that includes the Project ID and
Client ID fields.
10. Open the Indexes window to view the primary key fields. Then,
close the Indexes window.
11. Close the Project table without saving the changes.
12. Close the database file.

WWP Training Limited Page 95


LESSON 10 -
CREATING MACROS

In this lesson, you will learn how to:


 Work with macros

 Open the Macro Design window

 Create a macro

 Assign an argument to an action

 Save a macro

 Use single step mode for testing

 Run a macro

 Edit an existing macro

 Run a macro using the Tools menu

 Create a macro using the Macro Builder


Lesson 10 - Creating Macros Access 2003: Advanced

W ORKING WITH MACROS

 Discussion
A macro performs a set of commands in sequence. While macros in word processors
and spreadsheets are used mainly to duplicate keystrokes or mouse movements, macros
in Access often automate an action or a series of actions. Such actions include opening
tables, printing forms, finding records, or applying filters. Macros can even be used to
add command buttons, create menus and toolbars, and build complete applications.

Macro commands in Access consist of an action and its arguments. The action is the
task to be performed, such as opening a form. The arguments determine the specifics for
the action, such as which form to open.

You create a macro in Access from the Macro Design window. This window has two
panes. The upper pane, called the Action pane, contains a design grid. The design grid
can contain up to four columns. The Action and Comment columns are always
displayed. The Action column contains one of the many available macro commands. In
the Comment column, you can type a description of the action. Comments are helpful
when you are editing macros that contain many actions. You can also display the
Macro Name and Condition columns. The Macro Name column contains a name for
a macro that can be referred to during events, such as clicking a command button. You
can execute a macro conditionally by adding a statement to the Condition column. The
lower pane, called the Action Arguments pane, contains the arguments. The arguments
listed change, depending on what action is selected.

The right side of the Action Arguments pane displays helpful


 information about the selected action or action argument.

OPENING THE MACRO DESIGN W INDOW

 Discussion
The design grid in the Action pane of the Macro Design window contains at least two
columns: Action and Comment. In the Action column, you enter the actions you want
the macro to perform. You can either type the name of the action or select one from the
list. In the Comment column, you describe the purpose of the action. Adding a
comment may not seem important when a macro is first created, but it can prove helpful
if you need to edit the macro at a later time.

The Action Arguments pane appears at the bottom of the window and varies according
to the action selected in the Action pane. Most actions require one or more arguments.
In the Action Arguments pane, the arguments pertaining to an action appear. The
arguments detail exactly what function the action performs.

Page 100 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

The Macro Design window

Procedures
1. Open the desired database.
2. Display the Macros object list.

3. Select the New button on the Database window toolbar.

CREATING A MACRO

 Discussion
When you select a field in the Action column, a list of actions appears. Most of the
actions are self-explanatory and have equivalent menu commands. For instance, the
OpenQuery action opens a query in Datasheet or Design view, depending on how the
arguments are set.

Other actions can be performed only in macros or in more complex programming


modules. The AddMenu action, for example, creates a custom menu to appear on a
custom menu bar. This action is not available from the menu commands.

A macro can include up to 999 actions. You place each action in a separate row in the
design grid in the order in which they are to be performed. For example, a Maximize
command maximizes the window opened in the step immediately preceding it.

You use the Comment column to enter a description of the action to be performed. This
field can contain up to 255 characters. While comments are optional, it is beneficial to
enter a description of the action. This field is helpful if you want to modify the macro at
a later time.

The following table provides a brief description of each action:

WWP Training Limited Page 101


Lesson 10 - Creating Macros Access 2003: Advanced

Action Description
AddMenu Adds a drop-down menu item to a custom
menu bar.
ApplyFilter Applies a filter or query to restrict or sort
records.
Beep Sounds a tone through the computer's speaker.
CancelEvent Cancels the action that initiated the macro.
Close Closes a specified window.
CopyObject Copies the specified object to a different
database or the same database under a new
name.
DeleteObject Deletes the specified object.
Echo Specifies if the screen is to be updated while
the macro is running.
FindNext Locates the next record that meets criteria
specified by a find.
FindRecord Locates the first record following the current
record that meets criteria specified in the
arguments.
GoToControl Activates the specified field or control.
GoToPage Activates the first control on a specified page.
GoToRecord Makes the specified record the current record.
Hourglass Changes the mouse pointer to an hourglass
while the macro is running.
Maximize Enlarges the active window to fill the screen.
Minimize Reduces the active window to a button on the
taskbar.
MoveSize Moves and/or resizes the active window.
MsgBox Opens a message box containing a warning or
informative text.
OpenDataAccessPage Opens a data access page in the selected view.
OpenDiagram Opens a project diagram.
OpenForm Opens a form in the selected view.
OpenModule Opens a module at the selected procedure.
OpenQuery Opens a query in the selected view.
OpenReport Opens a report in the selected view.
OpenStoredProcedure Opens a project stored procedure in the
selected view.
OpenTable Opens a table in the selected view.
OpenView Opens a view in the current project.
OutputTo Outputs data in the specified object to Excel
text (.XLS), rich-text (.RTF), or MS-DOS text
(.TXT).

Page 102 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

Action Description
PrintOut Prints the specified datasheet, form, report, or
module.
Quit Quits Access.
Rename Renames the specified database.
RepaintObject Completes any pending screen updates for the
active or specified object.
Requery Updates the data in a specified control of an
active object or updates itself if no control is
specified.
Restore Restores a maximized or minimized window to
its previous size.
RunApp Runs an application from within Access.
RunCode Runs a Microsoft Access Basic Function
procedure.
RunCommand Performs a menu command.
RunMacro Runs a macro.
RunSQL Runs an action query using the corresponding
SQL statement.
Save Saves the specified object. If an object is not
specified, the active object is saved.
SelectObject Selects an object.
SendKeys Sends keystrokes directly to Access or to an
active Windows application.
SendObject Includes a specified object in an electronic mail
message to be viewed and forwarded.
SetMenuItem Sets the appearance of a command that appears
in a custom menu.
SetValue Sets the value of a field, control, or property on
a form or report.
SetWarnings Turns system messages on or off.
ShowAllRecords Removes any applied filter from the applicable
active object and displays all records.
ShowToolbar Displays or hides a toolbar.
StopAllMacros Stops all currently running macros.
StopMacro Stops the currently running macro.
TransferDatabase Imports or exports data between an Access
database and another database.
TransferSpreadsheet Imports or exports data between the active
database and a spreadsheet file.
TransferText Imports or exports text between the active
database and a text file.

WWP Training Limited Page 103


Lesson 10 - Creating Macros Access 2003: Advanced

Adding an action and a comment to a macro

You can use the [Tab] key and the [Shift+Tab] key
 combination to navigate between the Action and Comment
columns.

Procedures
1. Open the desired database.
2. Open the Macro Design window.
3. Select the first blank field in the Action column.
4. Select the Action list.
5. Select the desired action.
6. Select the corresponding field in the Comment column next to the
action.
7. Type a description for the action.

ASSIGNING AN ARGUMENT TO AN ACTION

 Discussion
Most action arguments have a default list of available arguments. For example, the
View argument field for the OpenReport action contains a list with the Print, Design,
and Print Preview arguments. For action arguments without a list, you can type the

Page 104 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

argument into the argument field. You can enter up to 255 characters into the argument
field.

Some arguments are required. For example, you must select the Form Name argument
for the OpenForm action. Other arguments, such as Filter Name, are not required for
the OpenForm action. If a required argument is missing, the macro stops when the
action containing the missing argument is encountered.

In some cases, a default argument is used. For example, the View argument defaults to
Form for the OpenForm action. Other arguments are ignored if they are not selected.
For example, the Filter Name argument allows you to select a query to apply to the
form as a filter. If you do not enter a query name, all the records appear.

With forms, you can also specify a Where Condition argument. This argument acts as
a filter, without using an actual query. For example, the argument [Credit Limit] =
1000 limits records to those with a credit limit of $1000. You can type the condition
directly into the argument box or click the Build button in the argument box to open the
Expression Builder dialog box.

Access displays a helpful message explaining the selected argument to the right of the
argument boxes. If you press the [F1] key while the insertion point is in the Action
Arguments pane of the Macro Design window, a help window for the argument opens
with additional information.

The available macro actions and their associated arguments are listed in the following
table. When the text (req.) appears next to an item in the Arguments column, either an
argument or a selection from a list is required for the macro to run properly:

Action Arguments
AddMenu Menu Name (req.), Menu Macro Name (req.),
Status Bar Text
ApplyFilter Filter Name, Where Condition (one or both req.)
Beep None
CancelEvent None
Close Object Type, Object Name, Save (req.)
CopyObject Designation Database, New Name, Source
Object Type, Source Object Name
DeleteObject Object Type, Object Name
Echo Echo On (req.), Status Bar Text
FindNext None
FindRecord Find What (req.), Match (req.), Match Case
(req.), Search (req.), Search As Formatted (req.),
Only Current Field (req.), Find First (req.)
GoToControl Control Name (req.)
GoToPage Page Number (req.), Right, Down (if a Right is
specified, a Down must be specified and vice
versa)
GoToRecord Object Type, Object Name, Record (req.), Offset
Hourglass Hourglass On (req.)

WWP Training Limited Page 105


Lesson 10 - Creating Macros Access 2003: Advanced

Action Arguments
Maximize None
Minimize None
MoveSize Right, Down, Width, Height
MsgBox Message, Beep (req.), Type (req.), Title
OpenForm Form Name (req.), View (req.), Filter Name,
Where Condition, Data Mode (req.), Window
Mode (req.)
OpenModule Module Name, Procedure Name
OpenQuery Query Name (req.), View (req.), Data Mode
(req.)
OpenReport Report Name (req.), View (req.), Filter Name,
Where Condition
OpenTable Table Name (req.), View (req.), Data Mode
(req.)
OutputTo Object Type (req.), Object Name, Output
Format, Output File, Auto Start, Template File
PrintOut Print Range (req.), Page From (req.), Page To
(req.), Print Quality (req.), Copies (req.), Collate
Copies (req.)
Quit Options (req.)
Rename New Name (req.), Object Type, Old Name
RepaintObject Object Type, Object Name
Requery Control Name
Restore None
RunApp Command Line (req.)
RunCode Function Name (req.)
RunCommand Command (req.)
RunMacro Macro Name (req.), Repeat Count, Repeat
Expression
RunSQL SQL Statement (req.), Use Transaction (req.)
Save Object Type, Object Name
SelectObject Object Type (req.), Object Name (req.), In
Database Window (req.)
SendKeys Keystrokes (req.), Wait (req.)
SendObject Object Type, Object Name, Output Format
(req.), To (req.), Cc, Bcc, Subject, Message
Text, Edit Message (req.), Template File
SetMenuItem Menu Index (req.), Command Index (req.),
Subcommand Index, Flag (req.)
SetValue Item (req.), Expression (req.)
SetWarnings Warnings On (req.)
ShowAllRecords None

Page 106 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

Action Arguments
ShowToolbar Toolbar Name (req.), Show (req.)
StopAllMacros None
StopMacro None
TransferDatabase Transfer Type (req.), Database Type (req.),
Database Name (req.), Object Type (req.),
Source (req.), Destination (req.), Structure Only
(req.)
TransferSpreadsheet Transfer Type (req.), Spreadsheet Type (req.),
Table Name (req.), File Name (req.), Has Field
Names (req.), Range
TransferText Transfer Type (req.), Specification Name (req.),
Table Name (req.), File Name (req.), Has Field
Names (req.), HTML Table Name

Assigning an argument to an action

You can press the [F6] key to toggle between the Action pane
 and the Action Arguments pane. You can use the [Tab] key
and the [Shift+Tab] key combination to navigate through the
argument fields.

Procedures
1. Open the desired database.
2. Open the Macro Design window.
3. Select the action in the Action column to which you want to assign
an argument.

WWP Training Limited Page 107


Lesson 10 - Creating Macros Access 2003: Advanced

4. Select the applicable argument in the Action Arguments pane.


5. Type the argument or select the corresponding list.
6. Select an argument from the list, if applicable.

SAVING A MACRO

 Discussion
After creating a macro, you must save it before you can test or run it. When you attempt
to save a macro or close the Macro window without saving, a Save As dialog box opens
with the default name of Macro# (numbered consecutively). It is best to use a short
name that clearly indicates the function of the macro. The name Macro1, for example,
does not mean much to other users who may be working with the macro.

The name that you give the macro appears in the Macros object list in the Database
window. All the macros associated with the database being used appear in the Database
window.

You can rename a macro. However, if you rename a macro, it


 may no longer run, depending on how you initiate the macro.
Instead, it is a good idea to copy a macro, rename it, and then
edit it in order to create macros that perform similar tasks.

You can also save a macro by selecting the File menu and
 then selecting the Save command.

Procedures
1. Open the desired database.
2. Create the desired macro.

3. Click the Save button on the Macro Design toolbar.


4. Type a name for the macro.
5. Select OK.

Page 108 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

USING SINGLE STEP MODE FOR TESTING

 Discussion
Access runs macros so quickly that you may not be able to see each action as it is
performed. If you wish to confirm that the actions are being performed correctly, you
can step through the macro. Single step mode is particularly useful when a macro
contains numerous actions or arguments, or when a macro does not seem to perform as
planned.

When you step through a macro, Access pauses before each action, allowing you to
view each step. The Macro Single Step dialog box opens, displaying the macro name,
condition, action name, and selected arguments. The Macro Single Step dialog box has
three buttons: Step, Halt, and Continue. You select the Step button to perform the
action in the dialog box. If there are no errors, the next action appears in the dialog box.
If you want to stop running the macro in this mode, you select the Halt button. The
macro stops running and the dialog box closes. When you want to stop stepping through
the macro and run the remaining steps, you select the Continue button. The remaining
macro actions are then completed.

If an error does occur, you can make the changes in the Macro Design window. After
you make the changes to a macro, you should retest it.

You should only use single step mode when working in the
 Macro Design window. When you enable single step mode, it
remains activated throughout the current Access session. All
macros will run in single step mode until the mode is disabled.

You can run a macro without testing it by selecting the Run


 menu and then selecting the Run command or by clicking the
Run button on the Macro Design toolbar.

Procedures
1. Open the desired database.
2. Open the desired macro in the Macro Design window.

3. Click the Single Step button on the Macro Design toolbar.

4. Click the Run button on the Macro Design toolbar.


5. Select the Step button as necessary to complete all the macro
actions.

WWP Training Limited Page 109


Lesson 10 - Creating Macros Access 2003: Advanced

6. Select the Halt button to stop running the macro and close the dialog
box.
7. Select the Continue button to run the remaining steps.

RUNNING A MACRO

 Discussion
You can run a macro from the Database window by selecting the Macros tab and
double-clicking the desired macro name or by selecting the desired macro name and
selecting the Run button on the Database window toolbar.

A warning box opens if required arguments are missing or if


 the macro cannot run for any reason.

You can also run a macro by right-clicking the macro name in


 the Database window and then selecting the Run command.

Procedures
1. Open the desired database.
2. Select the Macros object list.
3. Select the macro you want to run.

4. Select the Run button on the Database window toolbar.

EDITING AN EXISTING MACRO

 Discussion
After you have created a macro, you may decide to add or delete existing actions or
change actions or action arguments. In the Macro Design window, you can cut, copy,
and paste to edit a macro. You can also insert and delete rows. After you make the
desired changes, you must save the macro to save the changes. It is a good idea to test
the edited macro using single step mode. You must remember to disable single step
mode after testing a macro.

Page 110 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

Procedures
1. Open the desired database.
2. Select the Macros object list.
3. Select the macro you want to edit.

4. Select the Design button on the Database window toolbar.


5. Edit the macro as desired.
6. Save the changes to the macro.

RUNNING A MACRO USING THE TOOLS MENU

 Discussion
You can run a macro using the Tools menu. This option allows you to execute a macro
from almost anywhere. When the Run Macro dialog box opens, you can either type the
name of the macro in the text box or select the macro name from a list.

Procedures
1. Open the desired database.
2. Display the Macros object list.
3. Select the Tools menu.
4. Point to the Macro command.
5. Select the Run Macro command.
6. Select the Macro Name list.
7. Select the macro you want to run.
8. Select OK.

WWP Training Limited Page 111


Lesson 10 - Creating Macros Access 2003: Advanced

CREATING A MACRO USING THE MACRO BUILDER

 Discussion
You can create a macro using the Macro Builder. The Macro Builder is used when you
want to associate a macro with an existing object or control. The steps for creating a
macro using this method are similar to creating a macro using the New button on the
Database window toolbar.

Creating a macro using this method requires that you associate the macro with an event,
such as On Click or On Close. When you select an Event property, the Build button
appears. The Build button gives you access to the Macro Builder.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Select the desired object or control to associate the macro.

4. Click the Properties button on the Form Design toolbar.


5. Select the Event tab.
6. Select the desired Event property.

7. Click the Build button.


8. Select Macro Builder from the list box.
9. Select OK.
10. Type the macro name.
11. Select OK.

Page 112 WWP Training Limited


Access 2003: Advanced Lesson 10 - Creating Macros

EXERCISE
CREATING MACROS

 Task
Create, test, and edit a macro.

1. Open Train34x.
2. Create a new macro. Enter the following actions and comments:

Action Comment
OpenForm Opens the Invoice Form
MoveSize Sizes the Invoice Form and positions it at
the top of the window
OpenForm Opens the Payment Form in Datasheet view
MoveSize Sizes the Payment Form and positions it
below the Invoice Form

3. Enter the following arguments for each action:

Action Arguments
OpenForm Form Name: Invoice Form
Data Mode: Read Only
MoveSize Right: 0cm (0”)
Down: 0cm (0”)
Width: 15.5cm (6”)
Height: 7.5cm (3”)
OpenForm Form Name: Payment Form
View: Datasheet
Data Mode: Read Only
MoveSize Right: 0cm (0”)
Down: 7.5cm (3”)
Width: 15cm (6”)
Height: 5cm (2”)

4. Save the macro as Open Invoice/Payment Forms.


5. Enable single step mode and run the macro to test it.
6. Close the Form view and Datasheet view windows.
7. Edit the macro. In the second step, MoveSize, change the Height
argument to 5cm (2”). In the fourth step, MoveSize, change the
Down argument to 5cm (2”).

WWP Training Limited Page 113


Lesson 10 - Creating Macros Access 2003: Advanced

8. Save the macro and disable single step mode. Close the Macro
Design window.
9. Run the Open Invoice/Payment Forms macro using the Tools
menu.

10. View the Invoice Form in Design view.


11. Using the Macro Builder, attach a macro to the Close button named
CloseForms. Set the macro to close the Invoice Form and the
Payment Form without prompting when clicked (Hint: Open the
properties box.)
12. Save the changes and close the Macro Design window and the
property sheet.
13. View the Invoice Form in Form view and close the two forms using
the button.
14. Close the database file.

Page 114 WWP Training Limited


LESSON 11 -
USING MACROS

In this lesson, you will learn how to:


 Use properties

 Assign a macro to a control

 Create a command button

 Add a condition to a macro

 Create a group macro

 Create an Autoexec macro


Lesson 11 - Using Macros Access 2003: Advanced

USING PROPERTIES

 Discussion
Properties allow you to specify the appearance and behavior of objects in a database.
Objects include tables, queries, forms, and reports, as well as controls within reports or
forms.

Property sheets display the properties of a selected object. They have several tabs
including Format, Data, Event, and Other that list the properties by group. The groups
are the same for every property, but the items in the group change depending on the
type of object selected. The All page displays all the properties in a single list.

The Format properties allow you to control the appearance of an object, such as color,
font, size, and borders. These properties change automatically when you make changes
to an object. The Data properties allow you to specify the source of the data and control
items, such as default values. The Event properties allow you to control when an action
occurs. The Other properties contain items that do not fit into the other three
categories, such as the name of a control when used in a macro or text that appears in
the status bar.

ASSIGNING A MACRO TO A CONTROL

 Discussion
You can associate a macro with a control on a form or report using the Event properties
of the control. An event is an action, such as a mouse click or a change in value that can
initiate a response. The macro runs automatically when the specified event involving
that control occurs.

Many events involve the control having the focus. Focus means that the control can
receive data from mouse clicks or keyboard actions. For example, field boxes, toggle
buttons, and radio buttons can have the focus, since they can respond to data entry from
the keyboard or mouse. Only one control can have the focus at a time. The Event
properties of a text box control are listed in the following table:

Event Property Action is initiated


Before Update before the data in a control is updated
After Update after the data in a control is updated
On Change when the data in a control is updated
On Enter when the control first receives the focus from
another control on the same form
On Exit when the control loses the focus to another control
on the same form

Page 116 WWP Training Limited


Access 2003: Advanced Lesson 11 - Using Macros

Event Property Action is initiated


On Got Focus when the control gets the focus from another form
or control
On Lost Focus when the control loses the focus to another control
or form
On Click by clicking and releasing the primary mouse button
on the control
On Dbl Click by clicking and releasing the primary mouse button
twice on the control
On Mouse Down by clicking the mouse button while the mouse
pointer is on a control
On Mouse Move by moving the mouse pointer over a control
On Mouse Up by releasing the mouse button while the mouse
pointer is over the control
On Key Down by pressing any key on the keyboard when a
control has the focus or is using a SendKeys
macro
On Key Up by releasing a key or immediately after running the
SendKeys macro
On Key Press by pressing and releasing any key on the keyboard
when on a control that has the focus or when using
a SendKeys macro

By linking a command button or a control with a macro, you can make commonly used
functions easier. Initiating macros this way is particularly useful because it does not
require the user to know or use the Access menu structure. For example, you could
associate a macro with a command button on a form to print a report. The user could
then print the report by clicking the command button, without having to open the report
or know the correct menu commands.

You can also open the property sheet for a control by double-
 clicking the control, selecting the View menu and then
selecting the Properties command, or by right-clicking the
control and then selecting the Properties command.

You can also create an expression using the Expression


 Builder by clicking the Expression Builder button to the right
of any property on the Event page in the Properties dialog
box, by clicking the Build button on the Form Design toolbar,
by right-clicking in the desired property on the Event page
and then selecting the Build command, or by pressing [F4] on
the keyboard.

WWP Training Limited Page 117


Lesson 11 - Using Macros Access 2003: Advanced

Procedures
1. Open the desired database.
2. Open the desired form in Design view.
3. Select the desired control.

4. Click the Properties button on the Form Design toolbar.


5. Select the Event tab.
6. Select the desired property.
7. Select the property list.
8. Select the desired macro.
9. Click the Close button to close the property sheet.

CREATING A COMMAND BUTTON

 Discussion
Command buttons are controls to which you can assign actions. They are often used to
run macros in a form or report. You can place descriptive text or a picture on a
command button so that the user can easily identify the purpose of the button.

You create a command button in Design view using the Command Button tool in the
toolbox. After you create the command button on the form, you set the properties, such
as the event property to initiate the action and the text or picture to appear on the button.

A command button created on a form

Page 118 WWP Training Limited


Access 2003: Advanced Lesson 11 - Using Macros

To create a command button in which a macro will be


 attached, it is recommended to disable the Control Wizards
button in the toolbox.

You can use the Control Wizard to create a command button


 that allows you to synchronize records between two forms. As
you move through records on a form, you can view related
records on a second form by clicking the command button.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Display the toolbox.

4. Click the Control Wizards tool in the toolbox to disable it, as


necessary.

5. Click the Command Button tool in the toolbox.


6. Click in the desired location in the form or report where you want to
create the command button.

7. Click the Properties button on the Form Design or Report


Design toolbar.
8. Select the Event tab.
9. Select the desired property.
10. Select the property list.
11. Select the desired macro.
12. Select the Format tab.
13. Select the text in the Caption property.
14. Type the text you want to appear on the button.
15. Click the Close button to close the property sheet.

WWP Training Limited Page 119


Lesson 11 - Using Macros Access 2003: Advanced

ADDING A CONDITION TO A MACRO

 Discussion
You can add a condition argument to a macro. An argument acts very much like a filter.
Just as a filter displays only the records that meet the condition, the argument only
performs the macro when the condition is met.

Before you can add a condition to a macro, you must display the Condition column in
the Macro Design window. The Condition column appears to the left of the Action
column in the upper pane of the Macro Design window. You can type a condition or use
the Expression Builder dialog box to create the expression.

If you type an expression, there are certain rules you must follow when referring to
controls in tables, queries, forms, and reports. All references must be separated with an
exclamation point. Additional rules for the database objects and controls are listed in
the following table:

Controls Rules
Controls in tables Enclose the name of the table and the name of the
control in square brackets and separate them with
an exclamation point. For example,
[Orders]![Customer ID] refers to the Customer
ID field in the Orders table.
Controls in queries Enclose the name of the query and the name of
the control in square brackets and separate them
with an exclamation point. For example, [Order
Items]![Item Number] refers to the Item
Number field in the Order Items query.
Controls in forms Enclose the name of the form and the name of the
control in square brackets and separate them with
an exclamation point. Indicate that you are
referring to a form by beginning the statement
with the word Forms. For example,
Forms![Customers]![Customer ID] refers to the
Customer ID field in the Customers form.
Controls in reports Enclose the name of the report and the name of
the control in square brackets and separate them
with an exclamation point. Indicate that you are
referring to a report by beginning the statement
with the word Reports. For example,
Reports![Customer Sales]![Contact Name]
refers to the Contact Name field in the
Customer Sales report.

Since you enter the condition in the Condition column in the Macro Design window,
you do not need to include the word IF in the statement. Access assumes the statement
is a condition. If the condition is true, Access performs the corresponding action in that
row. If the condition is false, Access does not perform the action.

Page 120 WWP Training Limited


Access 2003: Advanced Lesson 11 - Using Macros

Adding a condition to a macro

You can also create an expression using the Expression


 Builder when you display the Condition column by right-
clicking in the Condition column and then selecting the Build
command, by right-clicking in the Action Arguments pane
and then selecting the Build command, or by clicking the
Build button on the Macro Design toolbar.

If the condition is true, you can have Access perform more


 than one action by entering an ellipsis (...) in the Condition
column in the Macro Design window. Access performs the
action on the same row as the condition and all rows thereafter
that contain an ellipsis.

You can also display the Conditions column by selecting the


 View menu and then selecting the Conditions command.

Procedures
1. Open the desired database.
2. Open the desired macro in the Macro Design window.

3. Click the Conditions button on the Macro Design toolbar.


4. Select the field in the Condition column next to the applicable
action.
5. Type the condition in the field.

WWP Training Limited Page 121


Lesson 11 - Using Macros Access 2003: Advanced

CREATING A GROUP MACRO

 Discussion
You can place multiple macros on the same macro sheet. This option, called grouping
macros, has several advantages. The most obvious advantage is that it reduces the
number of macros that appear in the window. More importantly, it allows you to
organize your macros by grouping related macros together onto a single macro sheet.
For example, if you created several macros that are related to one form, you can group
all of them together on one macro sheet.

Before you can create a group macro, you need to display the Macro Name column in
the Macro Design window. The Macro Name column appears to the left of the Action
or Condition column, if it is displayed. You can type the macro name directly into the
appropriate field in the Macro Name column.

Like any other macro, a group macro must be saved with a name. You should make
sure that the group macro name is descriptive enough to indicate its contents. This helps
other users know what macros are contained in the group macro. For example, if all the
macros relate to the Orders form, you could name the group macro Order Form
Macros.

When macros are grouped, you can still refer to individual macros. To refer to an
individual macro in a group, you can use its group and macro name in the format
Groupname.Macroname.

Creating a group macro

If you have already created macros, you can cut and paste
 them into a new group macro sheet or edit an existing macro
sheet.

Page 122 WWP Training Limited


Access 2003: Advanced Lesson 11 - Using Macros

You can quickly create a group macro by dragging the desired


 object from the Database window to the Action column in the
Macro Design window. In doing this, the Action column and
Form Name argument field are automatically filled in; you
will need to type a name for the macro, however.

Procedures
1. Open the desired database.
2. Display the Macros object list.
3. Open the Macro Design window.

4. Click the Macro Names button on the Macro Design toolbar.


5. Select the first blank field in the Macro Name column.
6. Type a name for the macro.
7. Select the corresponding field in the Action column next to the
macro name.
8. Select the Action list.
9. Select the desired action.
10. Select the applicable argument in the Action Arguments pane.
11. Select the argument list.
12. Select the desired argument.
13. Continue to add macros to the group macro as desired.

CREATING AN AUTOEXEC MACRO

 Discussion
While you can select a command to run a macro, you can also have a macro that runs
automatically when a database is opened. This type of macro is called an Autoexec
macro because it is automatically executed when the database is opened.

You can create an Autoexec macro to automate or simplify the database for other users.
For example, assume that you want someone in your office to add customer orders on a
specific form. To ensure that they use the correct form, you could create an Autoexec
macro that opens the form for them.

WWP Training Limited Page 123


Lesson 11 - Using Macros Access 2003: Advanced

You can create an Autoexec macro in two ways. You can rename an existing macro
Autoexec, or you can create a new macro and save it with the name Autoexec. Since
the Autoexec macro is stored with the database, each database can have its own
Autoexec macro. However, you can only have one Autoexec macro per database.

You can bypass the Autoexec macro by holding the [Shift]


 key while you open a database.

You can also rename a macro by selecting the desired macro


 in the Database window, selecting the View menu, and then
selecting the Rename command.

Procedures
1. Open the desired database.
2. Display the Macros object list.
3. Right-click the macro name you want to rename.
4. Select the Rename command.
5. Type Autoexec.
6. Press [Enter].

Page 124 WWP Training Limited


Access 2003: Advanced Lesson 11 - Using Macros

EXERCISE
USING MACROS

 Task
Use macros.

1. Open Train35x.
2. Rename the Open Payment/Invoice macro to Autoexec. Make sure
that you press [Enter] after you rename it. Close the database and
reopen it to test the macro. Notice that the two form windows open.
Close the form windows.
3. The Balance macro opens a message box warning that there is a
balance due for the project. Attach the Balance macro to the
Balance Due text box control on the Payment Form form. Use the
On Got Focus event. Close and save the form.
4. Open the Payment Form form in Form view. Click the Balance
Due text box. Notice that a message box opens. Close the message
box. Move through the next several records and notice that the
message box opens whether or not there is a balance due. Close the
form window.
5. Add a condition to the Balance macro so that the macro only runs
when the balance due is greater than 0. Enter the following condition
for the macro: Forms![Payment Form]![Balance Due] > 0.
6. Close the Macro Design window and save the changes to the macro.
7. Open the Payment Form form in Form view. Click the Balance
Due text box. Notice that a message box opens for the first record
because there is a balance due (a balance greater that 0). Move
through the next several records and notice that the message box
only opens when a balance is due. Close the form window.
8. Create a command button on the Project Form form without using
the wizard. Place it in the lower left corner of the form. Attach the
View Report macro to the command button so that it runs when the
mouse button is clicked. Enter the text Print Project Report in the
Caption property box. Resize the button to display all the text, if
necessary.
9. Close and save the Project Form form. Open the Project Form
form in Form view and test the Print Project Report command
button. Notice that the form prints. Close the form.
10. Create a group macro. Enter the following names, actions, and
arguments in the Macro Design window:

WWP Training Limited Page 125


Lesson 11 - Using Macros Access 2003: Advanced

Macro Name Action Argument


Open the form OpenForm Form Name: Client
Information Form
Print the Report OpenReport Report Name: Client
Information Report
View: Print
Open the Trainer table OpenTable Table Name: Trainer

11. Save the macro as Client Macros. Close the Macro Design window.

12. Close the database file.

Page 126 WWP Training Limited


LESSON 12 -
EVENTS

In this lesson, you will learn how to:


 Use Event Properties

 Use macros to ensure data entry

 Use macros to automatically fill in fields.


Lesson 13 - Using Switchboards Access 2003: Advanced

USING EVENT PROPERTIES

 Discussion
Each control, section and entire object on a form or report has properties. It is the event
properties for each of these that can be used to attach either modules or macros. Thus
enabling automation, data validation or various other procedures to be started when
certain events occur.

When a macro/module attached to a event property will actually run will depend on the
event property itself. The table below lists the different event properties and when then
take affect.

Events Occurs when


AfterDelConfirm After you confirm record deletions and
the records are actually deleted, or after
the deletions are canceled.
AfterInsert After a new record is added to the
database.
AfterUpdate After a control or record is updated with
changed data. This event occurs when the
control or record loses the focus, or you
click Save Record on the Records menu.
This event occurs for new and existing
records.
BeforeDelConfirm After one or more records are deleted, but
before Microsoft Access displays a dialog
box asking you to confirm or cancel the
deletion. This event occurs after the
Delete event.
BeforeInsert When you type the first character in a
new record, but before the record is added
to the database.
BeforeUpdate Before a control or record is updated with
changed data. This event occurs when the
control or record loses the focus, or you
click Save Record on the Records menu.
This event occurs for new and existing
records.
OnChange When the contents of a text box or the
text box portion of a combo box changes;
for example, when you type a character in
the control or change the Text property of
the control by using a macro or Visual
Basic.
OnCurrent When the focus moves to a record,
making it the current record, or when you
requery a form's source of data. This
event occurs when a form is first opened,
and whenever the focus leaves one record
and moves to another. It also occurs when

Page 128 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

you requery the source of the data for a


form; for example, when you click
Remove Filter/Sort on the Records menu,
or use the ShowAllRecords action or the
Requery action.
OnDelete When a record is deleted, but before the
deletion is confirmed and actually
performed.
OnNotInList When a value is entered in a combo box
that isn't in the combo box list.
OnUpdated When an OLE object's data has been
modified.
OnError When a run-time error is produced in
Microsoft Access while you are in the
form or report. This includes Microsoft
Jet Database Engine errors, but not run-
time errors in Visual Basic. (Since macros
can't determine what error has occurred,
you normally use Visual Basic event
procedures with this event.)
OnTimer When a specified time interval passes, as
specified by the TimerInterval property of
the form. You can use the Timer event to
keep data synchronised in a multiuser
environment by requerying or refreshing
data at specified intervals.
OnApplyFilter When you click Apply Filter on the
Records menu, or click the Apply Filter
button on the command bar. This applies
the most recently created filter (created
using either the Filter by Form feature or
the Advanced Filter/Sort window).When
you click Filter By Selection after
pointing to Filter on the Records menu, or
click the Filter By Selection button on the
command bar. This applies a filter based
on the current selection in the form.When
you click Remove Filter/Sort on the
Records menu, or click the Remove Filter
button on the command bar. This removes
any filter (or sort) currently applied to the
form.When you close the Advanced
Filter/Sort window or the Filter by Form
window.
OnFilter When you click Filter By Form after
pointing to Filter on the Records menu, or
click the Filter By Form button on the
command bar. This opens the Filter by
Form window, where you can quickly
create a filter based on the fields in the
form.When you click Advanced
Filter/Sort after pointing to Filter on the
Records menu. This opens the Advanced
Filter/Sort window, where you can create

WWP Training Limited Page 129


Lesson 13 - Using Switchboards Access 2003: Advanced

complex filters for the form.


OnActivate When a form or report becomes the active
window.
OnDeactivate When a different Microsoft Access
window becomes the active window, but
before the window becomes the active
window. The Deactivate event does not
occur when the focus moves to another
application's window, a dialog box, or a
pop-up form.
OnEnter Before a control actually receives the
focus, either from a control on the same
form or when the form opens. This event
occurs before the GotFocus event.
OnExit Just before a control loses the focus to
another control on the same form. This
event occurs before the LostFocus event.
OnGotFocus When a control, or a form with no active
or enabled controls, receives the focus. A
form can get the focus only if all visible
controls on a form are disabled, or there
are no controls on the form.
OnLostFocus When a form or control loses the focus. A
form can have the focus only if all visible
controls on a form are disabled, or there
are no controls on the form.
OnKeyDown When you press any key on the keyboard
while a control or form has the focus. A
form can have the focus only if all visible
controls on the form are disabled, or there
are no controls on the form. The
KeyDown event also occurs if you send a
keystroke to a form or control using the
SendKeys action in a macro or the
SendKeys statement in Visual Basic. A
form also receives all KeyDown events
(even those for controls) before they
occur for the controls if you set the form's
KeyPreview property to Yes. If you hold
down a key, the KeyDown event occurs
repeatedly.
OnKeyPress When you press and release a key or key
combination that produces a standard
ANSI character while a control or form
has the focus. A form can have the focus
only if all visible controls on the form are
disabled, or there are no controls on the
form. For example, you can use the
KeyPress event to respond to keystrokes
entered in a text box or combo box. For
keystrokes not recognised by KeyPress,
such as function keys or navigation keys,
use the KeyDown and KeyUp events. The
KeyPress event also occurs if you send a

Page 130 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

keystroke that produces a standard ANSI


character to a form or control using the
SendKeys action in a macro or the
SendKeys statement in Visual Basic. A
form also receives all KeyPress events
(even those for controls) before they
occur for the controls if you set the form's
KeyPreview property to Yes. If you hold
down a key, the KeyPress event occurs
repeatedly.
OnKeyUp controls) When you release a pressed
key while a control or form has the focus.
The object with the focus receives all the
keystrokes. A form can have the focus
only if all visible controls on the form are
disabled, or there are no controls on the
form. The KeyUp event also occurs if you
send a keystroke to a form or control
using the SendKeys action in a macro or
the SendKeys statement in Visual Basic.
A form also receives all KeyUp events
(even those for controls) before they
occur for the controls if you set the form's
KeyPreview property to Yes. If you hold
down a key, the KeyUp event occurs after
all the KeyDown and KeyPress events
have occurred.
OnClick For a control, this event occurs when you
press and then release (click) the left
mouse button on a control. For a form,
this event occurs when you click a record
selector or an area outside a section or
control.
OnDblClick When you press and release (click) the
left mouse button twice on a control or its
label. For a form, this event occurs when
you double-click on a blank area or record
selector on the form.
OnMouseDown When you press a mouse button while the
pointer is on a form or control. Canceling
the MouseDown event using the
CancelEvent action in a macro for a form
or control prevents the shortcut menu
from being displayed when you right-
click the form or control.
OnMouseMove When you move the mouse pointer over a
form, form section, or control.
OnMouseUp When you release a pressed mouse button
while the pointer is on a form or control.
OnFormat When Microsoft Access determines
which data goes in a report section, but
before Microsoft Access formats the
section for previewing or printing. Your
macro or event procedure can use data in

WWP Training Limited Page 131


Lesson 13 - Using Switchboards Access 2003: Advanced

the current record to make changes to the


page layout.
OnNoData After Microsoft Access formats a report
for printing that has no data (the report is
bound to an empty recordset), but before
the report is printed. You can use this
event to cancel printing of a blank report.
OnPage After Microsoft Access formats a page for
printing, but before the page is printed.
OnPrint After Microsoft Access has formatted the
data in a report section, but before the
section is printed.
OnRetreat When Microsoft Access must "back up"
past one or more report sections on a page
in order to perform multiple formatting
passes. This occurs after the section's
Format event, but before the Print event.
The Retreat event for each section occurs
as Microsoft Access backs up past the
section. This allows you to undo any
changes you have made during the
Format event for the section.
OnClose When a form or report is closed and is
removed from the screen.
OnLoad When a form is opened and its records are
displayed. This event occurs before the
Current event, but after the Open event.
OnOpen When a form is opened but before the
first record is displayed.
OnResize When the size of a form changes. This
event also occurs when a form is first
displayed.
OnUnload When a form is closed and its records are
unloaded, but before it's removed from
the screen. This event occurs before the
Close event.

ENSURING DATA ENTRY

 Discussion
By using a conditional macro a field can be tested to see if it contains a correct value.
Although this can be done using Validation Rules and the required properties by using a
macro the response to a incorrect value can be customised to not only come up with and
error message, but also return the user to the appropriate field.

Using the MsgBox action can create a custom message box and the GoTo Control
action can be used to return the user to the appropriate field.

Finding the appropriate event to attach a macro is a important factor to take into
account. If the macro to check the value entered was attached to the OnExit property of

Page 132 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

the field, it would not check the fields contents if the fields was skipped over by the
user. Instead if the macro was attached to the before update property of the form it will
always check the contents of the field before the record is saved.

Procedures
1. Open the database.
2. Select the Forms tab.
3. Open the Form in design view
4. View the Forms Properties
6. Select the Before update Property
7. Click on the build option and select the macro builder
8. Name the macro and add conditions
9 Set the test to check the contents of the Field
10. Set the Actions to perform the appropriate commands
11. Assign the appropriate arguments to the actions
12. Close the Macro Builder window and save the changes
13. Close the property sheet

AUTOMATICALLY FILLING FIELDS

 Discussion
By using a conditional macro fields can be automatically filled on a form depending
upon the value of another field. The check on the contents of the field can be carried
out after the data ahs been entered into the field and the user presses tab or enter to
move onto the next field. Thus by assigning a conditional macro to the OnExit property
to the field another field can be conditionally filled depending upon the value of the
first field.

By using the SetValue action in a macro a control or a controls properties can be set .
Then using the Goto control action the filled control can be bypassed.

WWP Training Limited Page 133


Lesson 13 - Using Switchboards Access 2003: Advanced

Procedures
1. Open the database.
2. Select the Forms tab.
3. Open the Form in design view
4. View the Fields Properties
6. Select the OnExit Property
7. Click on the build option and select the macro builder
8. Name the macro add conditions
9 Set the test to check the contents of the Field
10. Set the Actions to perform the appropriate commands
11. Assign the appropriate arguments to the actions
12. Close the Macro Builder window and save the changes
13. Close the property sheet

Page 134 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

EXERCISE
EVENT PROPERTIES

 Task
Create a macro to check the contents of a field

1. Open Train10a.
2. Open the New Payments form in Design view.
3. Attach a macro to the Forms Before update property, calling it check
4. Create the macro to require a number >0 is entered into the amount
paid field
5. Set the macro to stop the update, produce a relevant message box and
return the user to the appropriate field.
6. Close and save the macro.
7. Switch to the Form View

WWP Training Limited Page 135


LESSON 13 -
USING SWITCHBOARDS

In this lesson, you will learn how to:


 Open and use a switchboard

 Create a switchboard form

 Add a command button to a switchboard

 Set startup options


Lesson 13 - Using Switchboards Access 2003: Advanced

OPENING AND USING A SWITCHBOARD

 Discussion
In Access, a switchboard is a form that allows users of a database to get from one place
to another or perform several commands from a central location. If a database has a
switchboard, it is usually the first item the user sees when the database is opened. While
a simple database may have one switchboard, a database with many forms and reports
may have several switchboards.

A switchboard is basically a form that is not bound to a table or a query. It contains


command buttons or other objects that run macros in response to an action by a user.

Creating a switchboard should be one of the last things you do when creating a
database. You may want to consult with the people who use the database, or let them
use it without a switchboard for a while, so that you can get a better idea of what needs
to be automated. There are several ways to create a switchboard. You can use the
Database Wizard, the Switchboard Manager, or start with a blank form. When you use
the Database Wizard to create a database, the wizard automatically creates a
switchboard. You can make changes to this switchboard by editing it as you would any
other form.

The Switchboard Manager automates the process of making or editing a switchboard. It


allows you to make a switchboard the default switchboard so that it appears on startup
or branch to other switchboards. When a switchboard is created using the Switchboard
Manager, Access creates a table that describes what the buttons on the form display and
do.

You can also create a switchboard in Design view using a blank form. When you create
a form to be used as a switchboard, it should not be bound to a table or query. To ensure
that the switchboard does not look or work like a form, you need to set certain
properties, such as not displaying navigation buttons and scroll bars. Creating a
switchboard using a blank form requires that you add your own command buttons,
controls, and graphics, as well as set the desired form properties.

A switchboard

Page 138 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

If you create a switchboard with the Switchboard Manager and


 then make changes in the Form Design window, the
switchboard may not work. If you think that you may have to
make extensive changes to a switchboard, you should create
the switchboard using a blank form.

Procedures
1. Open the desired database.
2. Display the Forms object list.
3. Double-click the switchboard form to open it.
4. Select an option on the switchboard.

CREATING A SWITCHBOARD FORM

 Discussion
Before creating the switchboard form, you should have an idea what needs to be
included. If you are going to use macros to initiate certain actions, you should create
them before you start creating the switchboard.

Because you do not want the switchboard to look like a typical form, you should set the
properties listed in the following table:

Property Setting
Default View Single Form
Record Selector No
Navigation Buttons No
Auto Center Yes
Scroll Bars Neither
Auto Resize Yes

You may also want to size the switchboard form so that it covers the entire screen. To
further enhance the switchboard form, you can change the background color and add
text and graphics.

You do not have to name switchboard forms with any special


 name.

WWP Training Limited Page 139


Lesson 13 - Using Switchboards Access 2003: Advanced

Procedures
1. Open the desired database.
2. Display the Forms object list.

3. Select the New button on the Database window toolbar.


4. Select OK.

5. Click the Properties button on the Form Design toolbar.


6. Select the Format tab.
7. Select the Default View property.
8. Select the Default View list.
9. Select Single Form.
10. Select the desired Allow ... View property.
11. Select the Allow ... View list.
12. Select Yes.
13. Select the Record Selectors property.
14. Select the Record Selectors list.
15. Select No.
16. Select the Navigation Buttons property.
17. Select the Navigation Buttons list.
18. Select No.
19. Select the Auto Center property.
20. Select the Auto Center list.
21. Select Yes.

ADDING A COMMAND BUTTON TO A SWITCHBOARD

 Discussion
Once you have created the switchboard form, you add controls, such as command
buttons, to it. As your database changes, you can modify the switchboard, as necessary.

Page 140 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

To improve the appearance of your switchboard, you can add labels and graphics,
change object colors and fonts, and modify other form properties.

If a control performs a single function, such as opening a form or printing a report, and
the form or report already exists, you can add the control using the Control Wizards. If
the form or report has not been created, you can create the control without using the
Control Wizards. Then, after the form or report is created, you can assign an action to
the control and change any other properties, as desired.

When a control performs two or more functions, you should assign the control’s action
to a macro. As with single function controls, you can use the Control Wizard. This
method of assigning control actions to macros is the most common because many
switchboard controls perform two actions, such as opening a form and closing the
switchboard.

A command button added to a switchboard

A quick way to add a control to a switchboard is to open the


 switchboard in Design view and drag a macro to it. When you
create a control this way, the control action is automatically
assigned the On Click event property.

Procedures
1. Open the desired database.
2 Open the desired switchboard form in Design view.
3. Display the toolbox.

4. Click the Control Wizards button to enable it, as necessary.

5. Click the Command Button tool in the toolbox.


6. Click in form where you want to insert the command button.
7. Select the desired category from the Categories list box.

WWP Training Limited Page 141


Lesson 13 - Using Switchboards Access 2003: Advanced

8. Select the desired action from the Actions list box.


9. Select Next.
10. Select the appropriate option.
11. Select Next.
12. Select the Picture option.
13. Select the desired picture in the list box.
14. Select Next.
15. Type the desired name for the button.
16. Select Finish.

SETTING STARTUP OPTIONS

 Discussion
You can set startup options for a database. Startup options control what appears when
the database opens. For example, you can choose to hide the Database window and the
status bar. You may also select a default form to appear automatically when the
Database window opens.

Switchboard forms are often specified in the startup options as the default form. This
option allows you to create a form with all the options a user needs and have it appear
automatically when the user opens the database.

Autoexec macros run after the options selected in the Startup


 dialog box are executed.

Procedures
1. Open the desired database.
2. Close all open forms.
3. Select the Tools menu.
4. Select the Startup command.
5. Select the Display Form/Page list.
6. Select the switchboard form.
7. Select OK.

Page 142 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

WWP Training Limited Page 143


Lesson 13 - Using Switchboards Access 2003: Advanced

EXERCISE
USING SWITCHBOARDS

 Task
Use switchboards.

1. Open Train36x.
2. Open the Training Switchboard form in Design view.
3. Change the Format properties of the form as shown in the following
table:

Property Setting
Default View Single Form
Scroll Bars Neither
Record Selectors No
Navigation No
Buttons
Auto Resize Yes
Auto Center Yes

4. Close the property sheet.


5. Disable the Control Wizards, if necessary. Add a command button to
the upper left corner of the form.
6. Open the property sheet for the command button.
7. On the Event page, set the On Click property to run the Open
Payment/Invoice Forms macro. On the Format page, enter the text
Open Forms as the caption.
8. Close the property sheet.
9. Create another command button on the form approximately 1.5cm
(1/2”) below the Open Forms button. Open the property sheet for
the command button.
10. On the Event page, set the On Click property to run the Customer
Macros.Print the Report macro. On the Format page, enter the text
Print Report as the caption.
11. Close the property sheet.
12. Enable the Control Wizards. Add another command button to the
form approximately 1.5cm (1/2”) below the Print Report button.

Page 144 WWP Training Limited


Access 2003: Advanced Lesson 13 - Using Switchboards

13. In the Command Button Wizard, select the Form Operations


category and the Close Form action. Display text on the button that
reads Close Switchboard. Name the button Closes Switchboard.
14. Align the buttons, if necessary. Close and save the form.
15. Open the Startup dialog box. Display the Training Switchboard
form at startup. Close the Startup dialog box.
16. Close and reopen Train36x. Notice that the switchboard opens.

17. Test the buttons on the switchboard. Close any open windows, as
necessary.
18. Close the database file.

WWP Training Limited Page 145


LESSON 14 -
CREATING CUSTOM TOOLBARS

In this lesson, you will learn how to:


 Create a custom toolbar

 Add a built-in menu item

 Create a custom menu item

 Add a command to a menu item

 Add custom commands

 Dock a floating toolbar

 Link a toolbar to a report

 Add a separator bar

 Create a shortcut menu

 Link a custom shortcut menu

 Add buttons to a custom toolbar

 Change a button image

 Delete a custom toolbar


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

CREATING A CUSTOM TOOLBAR

 Discussion
When you create a custom application, you might also want to create custom menus.
Custom menus allow you to limit the actions a user can perform. For example, you can
remove certain commands from the File menu, such as New and Rename to prevent
users from modifying the application database. You can also add a custom command
that initiates a macro.

Menus and command buttons reside on toolbars. Usually a toolbar contains only menus
or only buttons. However, you can display both on the same toolbar.

Once you have created a custom toolbar, you can link it to a form or a report, meaning
that it will automatically appear when you open or run the form or report.

A new toolbar appears as a floating toolbar.



You can also open the Customize dialog box by selecting the
 Tools menu and then selecting the Customize command.

The toolbar will automatically resize when you add custom


 menus and buttons.

Procedures
1. Open the desired database.
2. Select the View menu.
3. Point to the Toolbars command.
4. Select the Customize command.
5. Select the Toolbars tab.
6. Select the New button.
7. Type a descriptive name for the new toolbar.
8. Select OK.
9. Select Close.

Page 148 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

ADDING A BUILT-IN MENU ITEM

 Discussion
When the Customize dialog box opens, any toolbar can be displayed and edited. Menu
items are listed by category, each of which contains a group of related menu commands.
For instance, the Edit category, when selected, displays editing commands such as
Copy and Paste. You can quickly add or remove entire menu items or individual menu
commands to and from existing toolbars in Access. For example, you may wish to
remove the File menu to prevent users from performing any file operations. The
Customize dialog box includes built-in menus you can add to a toolbar. These built-in
menu items already include a group of commands.

Adding a built-in menu item

When adding Built-in Menu items to a custom toolbar, you


 cannot add items that are not relative to the object window.

Procedures
1. Open the desired database.
2. Display the desired toolbar.
3. Select the View menu.
4. Point to the Toolbars command.
5. Select the Customize command.
6. Select the Toolbars tab.

WWP Training Limited Page 149


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

7. Click the option to the left of the toolbar you want to edit.
8. Select the Commands tab.
9. Select Built-in Menus from the Categories list box.
10. Select the desired built-in menu from the Commands list box.
11. Drag the built-in menu to the desired toolbar.
12. Close the Customize dialog box.

CREATING A CUSTOM MENU ITEM

 Discussion
A quick way to develop a custom toolbar is by adding built-in menus. Built-in menus
are menu items that already contain a group of commands. However, you may want to
create your own menu item to which you can assign a group of commands. Access
allows you to create a new menu item to which you can assign a name and add
commands that appear in a list when the menu is selected.

Procedures
1. Open the desired database.
2. Open the Customize dialog box.
3. Select the Commands tab.
4. Select New Menu from the Categories list box.
5. Select New Menu from the Commands list box.
6. Drag the New Menu menu to the desired toolbar.
7. Select the Modify Selection button in the Customize dialog box.
8. Drag to select the text in the Name box.
9. Type a descriptive name for the new menu item.
10. Press [Enter].
11. Close the Customize dialog box.

Page 150 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

ADDING A COMMAND TO A MENU ITEM

 Discussion
You can add commands to a menu item when the Customize dialog box is open.
Related commands are grouped in categories. For instance, the File category contains
file handling commands, such as Open Database, Save, and Print. You may want to
add commonly used commands to a menu item if they are not already there. When you
add a command, a vertical or horizontal bar appears, indicating where the command
will be added.

Commands added to a menu item

Procedures
1. Open the desired database.
2. Open the Customize dialog box.
3. Select the Commands tab.
4. Select the desired category from the Categories list box.
5. Select the desired command from the Commands list box.
6. Drag the command to the menu name on the desired toolbar and then
place it in the desired location.
7. Close the Customize dialog box.

WWP Training Limited Page 151


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

ADDING CUSTOM COMMANDS

 Discussion
Most of the commands available in the Customize dialog box already have an action
associated with them. For example, the Print command, when selected, performs the
action of printing the active object, such as a form or report. However, the Custom
command, which is included in the selection of available commands, has no action
associated with it when added to a menu item. You can assign a macro to this command
so that when it is selected, it performs the actions of that macro. You can also rename
the Custom command to provide a description of the actions that the command
performs.

A custom command added to a menu item

Procedures
1. Open the desired database.
2. Open the Customize dialog box.
3. Select the Commands tab.
4. Select File from the Categories list box.
5. Select Custom from the Commands list box.
6. Drag the Custom command to the menu name on the desired toolbar
and then place it in the desired location.
7. Select the Modify Selection button in the Customize dialog box.

Page 152 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

8. Drag to select the text in the Name box on the Modify Selection
menu.
9. Type a descriptive name for the command.
10. Select the Properties command on the Modify Selection menu.
11. Select the On Action list.
12. Select the macro you want to assign to the command.
13. Close the Customize dialog box.

DOCKING A FLOATING TOOLBAR

 Discussion
When you create a custom toolbar, it appears as a floating toolbar by default, meaning
that it appears as a small window that can be easily moved and closed. Toolbars can be
docked horizontally along the top or bottom of the Access window, or vertically along
either side of the window. This flexibility allow you to place the toolbar in the location
you prefer.

Procedures
1. Open the desired database.
2. Display the floating toolbar.
3. Drag the toolbar to the desired edge of the Access window.

LINKING A TOOLBAR TO A REPORT

 Discussion
After you have created a custom toolbar, you can link it to a form or report. When the
form or report opens, the custom toolbar appears along with any default toolbars.

WWP Training Limited Page 153


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

Procedures
1. Open the desired database.
2. Display the Forms or Reports object list.
3. Select the desired form or report.

4. Select the Design button on the Database window toolbar.

5. Click the Properties button on the Report Design or Form


Design toolbar.
6. Select the Other tab.
7. Select the Toolbar property.
8. Select the Toolbar list.
9. Select the desired toolbar.

ADDING A SEPARATOR BAR

 Discussion
You can create separator bars on menus to group related commands. For example, the
File menu in Access has several separator bars that distinguish groups of file
operations, such as opening, closing, saving, and printing. You can add separator bars to
menus you have created to group related commands.

Procedures
1. Open the desired database.
2. Display the toolbar to which you want to add a separator bar.
3. Open the Customize dialog box.
4. Select the Commands tab.
5. Display the menu on the toolbar to which you want to add a
separator bar.
6. Select the command before which you want to insert a separator bar.
7. Select Modify Selection in the Customize dialog box.
8. Select the Begin a Group command.

Page 154 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

9. Close the Customize dialog box.

CREATING A SHORTCUT MENU

 Discussion
Shortcut menus appear when you right-click in an application. You can use shortcut
menus to select commonly used commands rather than having to locate the commands
in a menu. You can link a shortcut menu to a form or report, or you can have it appear
globally.

To have a custom shortcut menu bar appear globally, you need


 to change the option in the Shortcut Menu Bar text box in
the Startup dialog box from <default> to the name of the
custom shortcut menu. Changes made in the Startup dialog
box do not take effect until the next time the database is
opened. Custom shortcut menus linked to forms and reports
replace the global custom shortcut menu.

Procedures
1. Open the desired database.
2. Open the Customize dialog box.
3. Select the Toolbars tab.
4. Select the New button.
5. Type a descriptive name for the shortcut menu.
6. Select OK.
7. Select the Properties button.
8. Select the Type list.
9. Select Popup.
10. Select OK.
11. Select Close.
12. Double-click Shortcut Menus in the Toolbars list box.
13. Select the Custom menu on the Shortcut Menus toolbar.
14. Select the shortcut menu to which you want to add commands.

WWP Training Limited Page 155


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

15. Select the Commands tab in the Customize dialog box.


16. Select the desired category in the Categories list box.
17. Select the desired command in the Commands list box.
18. Drag the command to the desired location on the custom shortcut
menu on the Shortcut Menus toolbar.
19. Close the Customize dialog box.

LINKING A CUSTOM SHORTCUT MENU

 Discussion
After you have created a custom shortcut menu, you can link it to a form or report. If
the form is open in Form view or the report is open in Print Preview, the shortcut
menu appears when you right-click in the form or report.

A custom shortcut menu linked to a form

Procedures
1. Open the desired database.
2. Display the Forms or Reports object list.
3. Select the desired form or report.

4. Select the Design button on the Database window toolbar.

5. Click the Properties button on the Form Design or Report


Design toolbar.

Page 156 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

6. Select the Other tab.


7. Select the Shortcut Menu Bar property.
8. Select the Shortcut Menu Bar list.
9. Select the desired shortcut menu.

ADDING BUTTONS TO A CUSTOM TOOLBAR

 Discussion
You can add command buttons to a custom toolbar. Command buttons, when clicked,
perform an action, such as saving a file or opening a database object. Generally, the
action is depicted in a graphic on the button. For example, the Save button has a graphic
of a floppy disk on it. The Customize dialog box allows you to select command buttons
from several categories. You can create a toolbar that contains only command buttons,
or you can mix menu items with command buttons. The Commands list in the
Customize dialog box displays the text for the commands as well as the corresponding
buttons.

By default, when you add a command to a toolbar, only the


 button appears. However, you can display the text for the
command as well by selecting the Modify Selection menu and
then selecting the Image and Text command. When you add a
command from the All Macros category, on the other hand,
the button and command text appear by default. You can
disable the display of the command text by selecting the
Modify Selection menu and then deselecting the Image and
Text command.

To remove a button from a toolbar, you can drag it off the


 toolbar when the Customize dialog box is open.

To rearrange buttons on a toolbar, you drag them to the


 desired locations when the Customize dialog box is open.

Procedures
1. Open the desired database.
2. Open the Customize dialog box.
3. Display the desired toolbar.
4. Select the Commands tab.

WWP Training Limited Page 157


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

5. Select the desired category from the Categories list box.


6. Select the desired command in the Commands list box.
7. Drag the command to the desired toolbar.
8. Close the Customize dialog box.

CHANGING A BUTTON IMAGE

 Discussion
When you add a button to a custom toolbar, Access displays the default button. When
you add an object to a custom toolbar, Access displays the default button for that type
of object. You can change the face of any button on any toolbar. Access includes a
button editor so that you can modify an existing button image or create your own.

If you do not want to use the available button images, you can
 create your own graphic by selecting the Modify Selection
menu and then selecting the Edit Button Image command.

Procedures
1. Open the desired database.
2. Display the desired toolbar.
3. Open the Customize dialog box.
4. Select the command button you want to change.
5. Select Modify Selection in the Customize dialog box.
6. Point to the Change Button Image command.
7. Select the desired button image.
8. Close the Customize dialog box.

Page 158 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

DELETING A CUSTOM TOOLBAR

 Discussion
You can delete a custom toolbar when you no longer need it. Deleting toolbars is a good
way to keep your desktop and the Customize dialog box free of clutter.

You can delete a custom shortcut menu by selecting the


 Shortcut Menus toolbar on the Toolbars page in the
Customize dialog box and then selecting Properties. In the
Toolbar Properties dialog box, you can select the shortcut
menu you want to delete in the Selected Toolbar list and then
change the toolbar type to Menu Bar in the Type list. The
shortcut menu will then appear in the Toolbars list box in the
Customize dialog box and you can delete it just as you would
any other toolbar.

Procedures
1. Open the desired database.
2. Open the Customize dialog box.
3. Select the Toolbars tab.
4. Select the toolbar you want to delete in the Toolbars list box.
5. Select Delete.
6. Select OK.
7. Close the Customize dialog box.

WWP Training Limited Page 159


Lesson 14 - Creating Custom Toolbars Access 2003: Advanced

EXERCISE
CREATING CUSTOM TOOLBARS

 Task
Create a custom toolbar.

1. Open Train37x.
2. Close the switchboard.
3. Create a new toolbar named Form Operations.
4. Add the File built-in menu item to the toolbar.
5. Add a custom menu item to the right of the File menu on the toolbar.
Rename the menu Navigation. (Hint: Remember to select the New
Menu category.)
6. Add the following commands from the Records category to the
Navigation menu item: First, Previous, Next, Last, New Record,
and Delete Record.
7. Add a custom command to the Navigation menu item below the
previously created commands. Name the command Exit and assign
the Save/Close Payment Form macro in the On Action property
box to it.
8. Add a separator bar above the Exit command.
9. Add the View Report command button from the All Macros
category to the right of the Navigation menu. Change the button
image to an image of an eye (last row, fourth column).
10. Link the Form Operations toolbar to the Payment Form form.
Close and save the form.
11. Create a custom popup shortcut menu named Sorting. Add the Sort
Ascending and Sort Descending commands from the Records
category to the menu.
12. Link the Sorting shortcut menu to the Payment Form form. Close
and save the form.
13. Open the Payment Form form in Form view. Dock the Form
Operations toolbar below the already existing menu commands.
Test the new toolbar and shortcut menu.

Page 160 WWP Training Limited


Access 2003: Advanced Lesson 14 - Creating Custom Toolbars

14. Close any open windows.


15. Delete the Form Operations toolbar.
16. Delete the Sorting shortcut menu.
17. Close the database file.

WWP Training Limited Page 161


APPENDICES -

 Analyzing Tables

 Using Advanced Database Features

 Exporting Data to Excel and Word

 Using Advanced Query Wizards

 Creating Charts using Access

 Using Access and the Internet

 Access Security

 Replicating Databases

 Introduction to VBA Modules


APPENDIX I -
ANALYZING TABLES

 Analyze a table

 Use relationships in splits

 Use the Table Analyzer Wizard

 Use the Performance Analyzer


Appendix I - Analyzing Tables Access 2003: Advanced

ANALYZING A TABLE

 Discussion
When you create or analyze a table, you should look at its structure to determine the
efficiency of its design. If the same information appears in multiple records, the table
can probably be split into two related tables. Splitting a table is more efficient because
the tables are then smaller and, as a result, easier to manage. In addition, information
will only need to be entered one time. Smaller tables also reduce the chance of making
data entry errors.

If you feel that a table may need to be split, you can use the Table Analyzer Wizard to
analyze it for you and suggest which fields should be in each table. The Table Analyzer
Wizard can also create the correct table relationships.

USING RELATIONSHIPS IN SPLITS

 Discussion
When the Table Analyzer Wizard splits a table, it creates the necessary relationships in
the resulting tables. These relationships allow data from all the tables to be used in
queries, forms, and reports.

Access provides two basic types of relationships: one-to-one and one-to-many. When a
table is split, a one-to-many relationship is usually created. This relationship allows one
record in the first table to be related to many records in the other related tables,
eliminating data duplication.

USING THE TABLE ANALYZER W IZARD

 Discussion
The Table Analyzer Wizard looks at a table to determine if it contains duplicated
information. If the Table Analyzer Wizard determines that a table has a lot of duplicated
data, it splits the table, creating new tables and leaving the original table intact.

The Table Analyzer Wizard has seven pages. The first two pages are informational,
with the first page describing the problem of duplicate data in the table and the second
describing the solution. You can choose not to display these pages.

You then select the table you want to analyze. On subsequent pages, you indicate
whether you want the wizard to decide how to split the table or whether you want to do
it yourself. If you allow the wizard to split the table, the recommended tables and the
relationships between them appear. You can then move fields between tables or even

Page 4 WWP Training Limited


Access 2003: Advanced Appendix I - Analyzing Tables

drag fields to create new tables. Each piece of information should be stored in only one
location, and each table should contain only data that refers to a single subject.

Once the fields have been put into the correct tables, you can set the primary keys. In
order to be related properly, each table must have a primary key, and the primary key
must be a field that uniquely identifies each record. Therefore, a primary key field
cannot contain duplicate data. Access will generate unique fields, if necessary.

On the last page, you can allow the Table Analyzer Wizard to create a query. The query
will be given the same name as the old table and the old table will be renamed. As a
result, any reports, forms, or queries that refer to the old table can still be used.

The Table Analyzer Wizard

You can also activate the Table Analyzer Wizard by selecting


 the Tools menu, pointing to the Analyze command, and
selecting the Table command.

You may need to install the Additional Wizards feature in


 order to use the Table Analyzer Wizard.

Procedures
1. Click the arrow on the Analyze button on the Database
toolbar.
2. Select the Analyze Table command.
3. Select Next >.

WWP Training Limited Page 5


Appendix I - Analyzing Tables Access 2003: Advanced

4. Select Next >.


5. Select the table you want to analyze.
6. Select Next >.
7. Select whether or not you want to allow the Table Analyzer Wizard
to decide which fields are put in each table.
8. Select Next >.
9. Double-click the title bar of the first table.
10. Type the desired table name.
11. Select OK.
12. Double-click the title bar of the second table.
13. Type the desired table name.
14. Select OK.
15. Select Next >.
16. Select the field you want to set as a primary key.

17. Click the Set Unique Identifier button at the top of the Table
Analyzer Wizard window.
18. Select Next >.
19. Select whether or not you want the Table Analyzer Wizard to create
a query for you.
20. Select Finish.
21. Close the Microsoft Access Help window, if necessary.

USING THE PERFORMANCE ANALYZER

 Discussion
The Performance Analyzer analyzes the efficiency of your database in order to optimize
its performance.

The Performance Analyzer window contains a page for each available object type in
Access, as well as a Current Database page and an All Object Types page. The
Current Database page allows you to analyze features that are not objects, such as
relationships. You can analyze a single object or multiple objects on different pages. If
you are analyzing different types of objects, the All Object Types page allows you to
view all database objects in one location.

The results of the performance analysis appear in the Analysis Results box. The results
are categorized as a Recommendation, Suggestion, or Idea. The Analysis Notes box

Page 6 WWP Training Limited


Access 2003: Advanced Appendix I - Analyzing Tables

provides additional information about the selected result. You can use the Optimize
button to have Access perform the action suggested in a Recommendation or
Suggestion; you must manually perform the action for an Idea.

Performance Analyzer results

After you have selected the Optimize button, the Performance


 Analyzer marks the action as Fixed.

You can use the Select All button to select all the results in the
 Analysis Results box.

The Additional Wizards feature may need to be installed in


 order to use the Performance Analyzer.

Procedures
1. Click the arrow on the Analyze button on the Database
toolbar.
2. Select the Analyze Performance command.
3. Select the tab containing the objects you want to analyze.
4. Select the objects you want to optimize.
5. Select OK.
6. To view an explanation, click any result in the Analysis Results box.
7. Select Close.

WWP Training Limited Page 7


Appendix I - Analyzing Tables Access 2003: Advanced

Page 8 WWP Training Limited


Access 2003: Advanced Appendix I - Analyzing Tables

EXERCISE
ANALYZING TABLES

 Task
Use the Table Analyzer Wizard to analyze tables.

1. Open Train11x.
2. Open the Table Analyzer Wizard. Select Next as needed and then
select the Project List table. Select Next.
3. Allow the wizard to decide how to split the table.
4. Rename Table1 to Project and Table2 to Client.
5. Drag the State field from the Project field list below the City field
in the Client field list.
6. Set the Client ID field as the primary key in the Client table.
7. Do not have the Table Analyzer Wizard create a query.
8. Select Finish.
9. Close the Microsoft Access Help window. View the tables and then
close them and restore the Database window.
10. Analyze the performance of the Client and Payment tables. (Notice
that the analysis result does not fit the data; changing the Zip field to
a long integer field would not allow for zip codes with leading
zeroes, such as 08054.)
11. Close the Performance Analyzer.
12. Close the database file.

WWP Training Limited Page 9


APPENDIX II -
USING ADVANCED DATABASE FEATURES

 Import data

 Link data to an Access table

 Use the Linked Table Manager

 Export data

 Convert files

 Compact a database

 Use Name AutoCorrect

 Back up a database
Appendix II - Using Advanced Database Features Access 2003: Advanced

IMPORTING DATA

 Discussion
You can import data from one or more external data sources. The external data source
can be another Access database, a database created in a different program (such as
dBASE or Excel), ASCII text, or an HTML data table.

When you import data from a spreadsheet, another type of database, or ASCII text, a
wizard opens to step you through the process. The format of the data in the external data
source does not change. You can use Access to add, edit, or delete the data.

If the external data source is an Access database, you can also import database objects
such as queries, reports, and forms. This option allows you to copy a query from one
database to another and modify it as necessary, rather than creating a new one. In
addition, you can easily copy standard reports and forms between databases.

Using the Import Data Wizard

If the table you import has a lookup field, you should also
 import the source of the information for the lookup field.

You can select the Options button in the Import Objects


 dialog box to select import options.

You can also open the Import dialog box by right-clicking in


 the Database window and then selecting the Import
command.

Page 12 WWP Training Limited


Access 2003: Advanced Appendix II - Using Advanced Database Features

Procedures
1. Select the File menu.
2. Point to the Get External Data command.
3. Select the Import command.
4. Select the Files of type list.
5. Select the desired file type.
6. Select the Look in list.
7. Select the drive where the source data is stored.
8. Open the folder where the source data is stored.
9. Select the file containing the source data.
10. Select Import.
11. Select the appropriate data format.
12. Select Next.
13. Select the appropriate delimiter.
14. Select the First Row Contains Field Names option, if applicable.
15. Select Next.
16. Indicate whether the data is to be stored in a new or existing table,
select any additional options, and select Next.
17. Modify field options as desired, and select Next.
18. Select the desired primary key option.
19. Select additional options as desired, and select Next.
20. Enter the desired table name.
21. Select Finish.
22. Select OK.

LINKING DATA TO AN ACCESS TABLE

 Discussion
You can link to an external data source, such as another Access database or a database
created in a different program (e.g., dBASE or Excel). You can also link to HTML data
tables on a network server or on the Internet.

WWP Training Limited Page 13


Appendix II - Using Advanced Database Features Access 2003: Advanced

When you link to an external data source, the format of the data in the data source does
not change, although you can use Access to add, edit, or delete the data.

A linked table displays a special icon in the Database window. A table linked to another
Access database has an arrow to the left of the icon. A table linked to a source created
in a different program displays an arrow and the initials of the source program (e.g., Px
for Paradox).

Linking tables is useful when you want to share data on a network. If you link to a table
on a network, the link ensures that the data you are viewing is always the latest
available.

When you delete a linked table, you are deleting the icon and
 the link to the source table, not the source table itself.

You can also open the Link dialog box by right-clicking in the
 Database window and selecting the Link Tables command.

Procedures
1. Select the File menu.
2. Point to the Get External Data command.
3. Select the Link Tables command.
4. Select the Look in list.
5. Select the drive where the source data is stored.
6. Open the folder where the source data is stored.
7. Select the file containing the source data.
8. Select Link.
9. Select the table containing the source data.
10. Select OK.

USING THE LINKED TABLE MANAGER

 Discussion
You can use the Linked Table Manager to view, refresh, or correct the file name and/or
path of a linked table. If the structure of a linked table changes, for example, you can
use the Linked Table Manager to refresh the link. In addition, if a linked table is moved
to a different location, you can use the Linked Table Manager to correct the path and
reestablish the link.

Page 14 WWP Training Limited


Access 2003: Advanced Appendix II - Using Advanced Database Features

Using the Linked Table Manager

The Linked Table Manager does not physically move database


 files or tables; it only refreshes or corrects the link
information.

If you change the name of a table after it has been linked, the
 Linked Table Manager will not be able to refresh the links. In
this case, you must delete the link and create a new one.

Procedures
1. Select the Tools menu.
2. Point to the Database Utilities command.
3. Select the Linked Table Manager command.
4. Select the linked table you want to update.
5. Select OK.
6. Select the Look in list.
7. Select the drive where the file is stored.
8. Open the folder where the file is stored.
9. Select the name of the file containing the linked table.
10. Select Open.
11. Select OK.
12. Select Close.

WWP Training Limited Page 15


Appendix II - Using Advanced Database Features Access 2003: Advanced

EXPORTING DATA

 Discussion
You can export data and database objects to a variety of supported databases, programs,
and file formats. For example, you can export data to another program (such as dBASE
or Excel), to ASCII text, or to an HTML data table. You can also export most database
objects from a Microsoft Access database to another Access database. The process of
exporting data and database objects is very similar in functionality to copying and
pasting.

The following table lists some of the data formats to which you can export:

Application Supported Version or Format


Microsoft Access database Access 2.0, 7.0/95, 8.0/97, 9.0/2000,
10.0/2002 and 11.0/2003
dBase III, IV, 5, and 7 (Requires Borland
Database Engine 4.x or later)
Paradox, Paradox for Windows 3.x, 4.x, 5.0, and 8.0 (Requires
Borland Database Engine 4.x or later)
Microsoft Excel 3.0, 4.0, 5.0, 7.0/95, 8.0/97, 9.0/2000,
and 10.0/Excel 2002
Microsoft Word, Rich Text All
Format
Lotus 1-2-3 .wj2, .wk1, and .wk3
Delimited text files All
XML document All

Exporting data to another Access file

Page 16 WWP Training Limited


Access 2003: Advanced Appendix II - Using Advanced Database Features

When exporting database objects to another database, you can


 only export one object at a time. If you need to export multiple
objects to a database, it may be more efficient to open the
database to which you want to export and import the objects.

When you export an object to another database, it might be


 helpful to export all related objects to ensure full functionality.
For example, a report is usually based on a query, and a query
is based on one or more tables.

Procedures
1. Select the database object you want to export.
2. Select the File menu.
3. Select the Export command.
4. Select the Look in list.
5. Select the drive where the file to which you want to export is stored.
6. Open the folder where the desired file is stored.
7. Select the desired file.
8. Select Export.
9. Enter the desired name for the database object.
10. Select OK.

CONVERTING FILES

 Discussion
Access 2003 uses the Access 2000 file format as its default. As a result, you can work
with and modify Access 2000 files in Access 2003 without having to convert them. In
addition, all databases created in Access 2003 will automatically have the Access 2000
file format. It is not necessary to convert Access 2000 files to the 2003 format, unless
you plan on using any of Access 2003’s more complex design features, such as saving
your database as an MDE file (used for databases containing Microsoft Visual Basic
code).

If you decide to convert your Access 2000 files to the 2003 format, it is important to
remember that, once a file has been converted to the Access 2003 file format, you can
no longer open it in Access 2000. This is important if you are working in an
environment where not everyone has upgraded to Access 2003.

WWP Training Limited Page 17


Appendix II - Using Advanced Database Features Access 2003: Advanced

If you are working with a Microsoft Access database created in Access 2.0 or later, you
can convert it to the Access 2000 or Access 2003 file format as desired. Whenever you
open a database created in an earlier version of Access, you are given an opportunity to
convert the database.

You should always make a copy of your Microsoft Access database before you convert
it. This will ensure that your original file is still intact, should you encounter a problem
during the conversion process.

Access 2003 includes a Conversion Error Logging feature. If an error occurs when
converting a database from Access 97, 2000 or 2002 to Access 2003, the Conversion
Error Logging feature creates a table that lists information about each error.

The Convert/Open Database dialog box

You can convert an Access 2003 file format back to Access


 2002, 2000 or 97, if necessary.

When you convert a previous-version Microsoft Access


 database that contains linked tables, make sure that the
external tables have not been moved; if Microsoft Access
cannot find the linked tables, you will not be able to use the
converted database.

You can also convert a previous-version Access database by


 importing its database objects into a new or existing Access
2000, 2002 or 2003 database.

Procedures
1. Click the Open button on the Standard toolbar.
2. Select the Look in list.
3. Select the drive where the file you want to convert is located.
4. Open the folder in which the desired file is located.

Page 18 WWP Training Limited


Access 2003: Advanced Appendix II - Using Advanced Database Features

5. Select the file you want to convert.


6. Select Open.
7. Select the Convert Database option, if necessary.
8. Select OK.
9. Type the desired file name in the File name box.
10. Select Save.
11. Select OK.

PRINTING A RELATIONSHIP DOCUMENT

 Discussion
It is a good idea to document your database structure and relationships. The
Documenter feature in Access allows you to view, print, and save the design
characteristics of database objects. You can view and print such information as the
properties associated with tables, queries, forms, and reports. This type of information
is very useful for deciding what changes you want to make or when you have to
maintain a database that was developed by someone else.

Although the Relationship window is a good way to view table relationships, as well as
join lines and types, you cannot print from it. The Documenter feature allows you to
print the relationships between tables in your database. The relationship report that the
Documenter feature produces provides information on related tables, their attributes,
and the type of relationship, which in turn, provides you with all the information you
need to analyze your database table relationships.

The Documenter feature is not included in the default


 installation. You can install it with the initial installation, or it
can be installed at a later time.

You can also open the Documenter dialog box by selecting the
 arrow on the Analyze button on the Database toolbar and the
Documenter command.

Procedures
1. Select the Tools menu.
2. Point to the Analyze command.
3. Select the Documenter command.

WWP Training Limited Page 19


Appendix II - Using Advanced Database Features Access 2003: Advanced

4. Select the Current Database tab.


5. Select the Relationships option.
6. Select OK.

7. Click the Print button on the Print Preview toolbar.

COMPACTING A DATABASE

 Discussion
When you delete tables and other objects in a database, the database size on the disk
does not necessarily decrease. Access provides a utility that compacts (defragments) the
database, thereby releasing storage space.

You can create a copy of the original database by saving the compacted database with a
different name or to a different location. Although you can compact the current database
while it is open, the database must be closed in order to make a copy.

Procedures
1. Open the database you want to compact.
2. Select the Tools menu.
3. Point to the Database Utilities command.
4. Select the Compact and Repair Database command.

USING NAME AUTOCORRECT

 Discussion
The Name AutoCorrect feature automatically fixes inconsistencies that can occur
when you rename tables, forms, reports, queries, fields, or other controls in an Access
database.

The Name AutoCorrect options must be enabled, however. The Track name
AutoCorrect info option saves information about changes, but does not automatically
repair the inconsistencies. When the Perform name AutoCorrect option is enabled,
Access automatically corrects any differences between related objects. Furthermore, if

Page 20 WWP Training Limited


Access 2003: Advanced Appendix II - Using Advanced Database Features

you enable both options, you can also enable the Log name AutoCorrect changes
option, which creates a table named Name AutoCorrect Log that documents changes.

Name AutoCorrect is enabled by default for new Access 2002 and 2003 databases.
However, if you are working in a converted database, you must manually enable it.

Selecting Name AutoCorrect options

Changes made to forms, reports, or other objects must be


 saved before Name AutoCorrect can fix related objects.

You must have permission to modify the design of an object in


 order to save changes.

Procedures
1. Select the Tools menu.
2. Select the Options command.
3. Select the General tab.
4. Select the Track name AutoCorrect info option.
5. Select additional options under Name AutoCorrect as desired.
6. Select OK.

WWP Training Limited Page 21


Appendix II - Using Advanced Database Features Access 2003: Advanced

BACKING UP A DATABASE

 Discussion
It is important to backup your database on a regular basis. Most companies have a
backup process to ensure that all data is saved at least once a day; consequently, all
databases shared on a company network server are backed up daily as well.

Your database may be saved to the hard drive of a personal computer, however, most
databases are too large to fit on a floppy disk. In this case, you should back up your
hard drive regularly by saving it to another drive or to removable media (a tape or CD,
for example). Backing up your hard drive ensures that all data, queries, forms, and
reports in your database are saved. As a result, you can recover your database if
something were to happen to it.

If neither of the above options are available, you can export individual components
(such as tables, queries, forms, etc.) to a floppy disk. In addition, you can save data as
ASCII text or as Excel tables; you cannot, however, save queries, forms, or reports in
this manner.

Page 22 WWP Training Limited


Access 2003: Advanced Appendix II - Using Advanced Database Features

EXERCISE
USING ADVANCED DATABASE FEATURES

 Task
Use advanced database features.

1. Open Trainne, selecting the Open Exclusive option.


2. Print a relationship document. Then, close the Print Preview, Report,
and the Relationships windows, as needed; do not save the changes.
3. Import the Sales by Rep 2 query from Train17x. (Select Microsoft
Access from the Files of Type list, if necessary.)
4. Add a link to the Sales table in Train17x.
5. Open the Linked Table Manager and update the link to the Types
table. Correct its path to Train17x in the student data folder. Then,
select OK as necessary and close the Linked Table Manager.
6. Make sure that the Name AutoCorrect option is enabled. Then,
change the name of the LAST_NAME field in the Reps table to
LastN and close the Reps table, saving the changes.
7. Open the Reps form in Design view. Notice that, although the label
in the Form Header area has not changed, the control source in the
Detail area has been corrected to LastN. Close the Reps form.
8. Compact Trainne. Then, close Trainne.
9. Open Train97. Convert Train97, saving it as Train02.
10. Use the Page Wizard to create a data access page from the Trainer
table. Use all the fields in the table, do not add any grouping levels,
and sort it by the Initials field in ascending order. Save the page as
Trainer.
11. View the data access page in Page view; then close it, saving it again
as Trainer. Select OK as necessary.
12. Export the Project Payments query to Trainne; accept the default
name.
13. Close the database file.

WWP Training Limited Page 23


APPENDIX III -
EXPORTING DATA TO EXCEL AND WORD

 Export data to an Excel workbook

 Drag and drop data into Excel

 Create Excel workbooks - Office links

 Create Word documents - Office links


Appendix III - Exporting Data to Excel and Word Access 2003: Advanced

EXPORTING DATA TO AN EXCEL W ORKBOOK

 Discussion
You can export database records from a database file in Access to a workbook in Excel.
The Access data source can be a table, query, form, report, view, or macro. When you
export data from a database, Access creates a workbook file in Excel with the data from
the database. Any field names from the data source appear in the first row of the
workbook.

When you export to Excel, you can choose to export to an existing workbook, or you
can indicate that you want to export to a new workbook by providing a new name in the
File name text box in the Export dialog box. You can also choose to save the fonts,
field widths, and data displayed from Lookup fields in your Access datasheet by
selecting the Save formatted option before exporting.

Exporting data to Excel is a useful way to display and work with data using the
capabilities of Excel. For example, you could transfer a table containing investment
portfolio information to Excel in order to perform calculations on investment
performance.

When you export to an existing workbook file, the data in the


 workbook is deleted and replaced by the Access data, unless
you are exporting to an Excel version 5.0 or later, in which
case the data is copied to the next available worksheet.

The Save formatted option in the Export dialog box is only


 available in Excel versions 5.0 - 7.0 or in Excel 97 - 2000.

You can also open the Export dialog box by right-clicking in


 the Database window and then selecting the Export
command.

Procedures
1. Open the desired database.
2. Display the desired object list.
3. Select the data source you want to export.
4. Select the File menu.
5. Select the Export command.
6. Select the Save as type list.

Page 26 WWP Training Limited


Access 2003: Advanced Appendix III - Exporting Data to Excel and Word

7. Select the file type corresponding to the workbook format to which


you want to export.
8. Select the Save in list.
9. Select the drive to which you want to export.
10. Select the folder to which you want to export.
11. Select the Save formatted option, if desired.
12. Select Export.

DRAGGING AND DROPPING DATA INTO EXCEL

 Discussion
You can drag and drop data from Access into Excel. For example, you can drag and
drop tables and queries from Access and place them in a workbook in Excel. The drag
and drop method is very useful when you are building information in an Excel
workbook and want to use data from an Access database file in the workbook. When
you drag and drop data from Access to Excel, it is best to display the two program
windows side by side on the desktop.

When you drag and drop data to Excel, any formatting that has been applied to the data
in Access will be lost in Excel. However, the field headings in Access are preserved in
Excel.

You can also drag and drop into Excel by dragging the data
 from Access to the program button on the taskbar until the
Excel window appears and then dragging the data into the
desired workbook.

Procedures
1. Open Microsoft Excel.
2. Open the desired workbook.
3. Open the desired database in Access.
4. Display the desired object list.
5. Select the Access data source you want to drag into Excel.
6. Drag the data source to the desired location in the Excel workbook.

WWP Training Limited Page 27


Appendix III - Exporting Data to Excel and Word Access 2003: Advanced

CREATING EXCEL W ORKBOOKS - OFFICE LINKS

 Discussion
You can use the Office Links feature to export a database data source from an Access
database to an Excel workbook. The Access data source can be a table, query, form, or
report. When you export data from a database, Access creates a workbook file in Excel
with the data from the database. Any field names from the data source appear in the first
row of the workbook.

When you export to Excel using the Office Links feature, a new workbook is created.
The workbook is automatically named the same as the data source. Exporting data using
this method is a quick way to create a workbook that you can share with others who
may not have Access installed on their computers.

You can also use the Tools menu to access the commands on
 the Office Links submenu.

Procedures
1. Open the desired database.
2. Display the desired object list.
3. Select the data source you want to export.

4. Click the arrow on the OfficeLinks button on the Standard


toolbar.
5. Select the Analyze It with Microsoft Excel command.

CREATING W ORD DOCUMENTS - OFFICE LINKS

 Discussion
You can use the Office Links feature to export a database data source from an Access
database to create a Word document. The Access data source can be a table, query,
form, or report. When you export data from a database, Access creates a document in
Word with the data from the database. When a table, query, or form is exported to
Word, the data is inserted into a table. Any field names from the data source appear in
the first row of the table and are shaded. Reports appear in Word as standard documents
with tabs used to separate the data.

Page 28 WWP Training Limited


Access 2003: Advanced Appendix III - Exporting Data to Excel and Word

When you export to Word using the Office Links feature, a new document is created in
the .rtf (rich text format) file format. The document is automatically named the same as
the data source. Exporting data using this method is a quick way to create a document
that you can share with others who may not have Access installed on their computers.
In addition, it enables you to use the formatting features found in Word.

You can also use the Tools menu to access the commands on
 the Office Links submenu.

Procedures
1. Open the desired database.
2. Display the desired object list.
3. Select the data source you want to export.

4. Click the arrow on the OfficeLinks button on the Standard


toolbar.
5. Select the Publish It with Microsoft Excel command.

WWP Training Limited Page 29


Appendix III - Exporting Data to Excel and Word Access 2003: Advanced

EXERCISE
EXPORTING DATA TO EXCEL AND W ORD

 Task
Export Access data into Excel and Word.

1. Open Train38x.
2. Export the Invoice table as an Excel workbook named Invoice.
3. Open Excel and the Invoice workbook that was just created.
4. Insert a new worksheet into the workbook and name it Payment.
5. Tile the Access and Excel windows.
6. Drag the Payment table in Access to cell A1 of the Payment
worksheet in Excel.
7. Save and close the workbook and Excel.
8. Create a new Excel workbook using the Office Links feature and the
data in the New Payment Form form.
9. Close the workbook and Excel.
10. Create a new Word document using the Office Links feature and the
data in the Projects by Client report.
11. Save the report as a Word document and close Word.
12. Close the database file.

Page 30 WWP Training Limited


APPENDIX IV -
USING ADVANCED QUERY WIZARDS

 Use the Crosstab Query Wizard

 Use the Find Duplicates Query Wizard

 Use the Find Unmatched Query Wizard


Appendix IV – Advanced Query Wizards Access 2003: Advanced

USING THE CROSSTAB QUERY W IZARD

 Discussion
Crosstab queries are used to group and summarize information in a spreadsheet format.
Crosstab queries make it easier to read and analyze selected data. The Crosstab Query
Wizard provides a step by step process to help you quickly create a crosstab query,
allowing you to enter information about the tables and fields you want to add to your
query.

You must have three fields in a crosstab query. The values in the first field appear as
row headings in the resultant spreadsheet, the values in the second field appear as
column headings, and the calculation is performed on the values in the third field.

A crosstab query can display, for example, products sold (row headings) by sales
representative (column headings); the number of products sold by each sales
representative would appear at the intersection of the corresponding row and column.

A crosstab query recordset

You should select the field with the fewest values for the
 column headings; your resultant spreadsheet will have a less
cluttered appearance.

Page 32 WWP Training Limited


Access 2003: Advanced Appendix IV – Advanced Query Wizards

Procedures
1. Display the Queries object list.

2. Select the New button on the Database window toolbar.


3. Select Crosstab Query Wizard.
4. Select OK.
5. Select the desired table or query from the Which table or query
contains the fields you want for the crosstab query results? list.
6. Select Next.
7. Add the desired field you want to use as row headings to the
Selected Fields list.
8. Select Next.
9. Add the field you want to use as column headings from the Which
field’s values do you want as column headings? list.
10. Select Next.
11. Select the field on which you want to calculate from the Fields list.
12. Select the desired function from the Functions list.
13. Select Next.
14. Type the desired query name. in the What do you want to name
your query? box
15. Select Finish.

USING THE FIND DUPLICATES QUERY W IZARD

 Discussion
You can use a Find Duplicates Query Wizard to find duplicate records in a table. For
instance, there may be identical records stored in a table, when only one record is
necessary. The Find Duplicates Query Wizard will find the duplicate records so that
you can delete them from the table.

WWP Training Limited Page 33


Appendix IV – Advanced Query Wizards Access 2003: Advanced

Procedures
1. Display the Queries object list.

2. Select the New button on the Database window toolbar.


3. Select Find Duplicates Query Wizard.
4. Select OK.
5. Select the desired table or query from the Which table or query do
you want to search for duplicate field values? list.
6. Select Next.
7. Add the desired fields to the Duplicate-value fields list.
8. Select Next.
9. Add the desired fields to the Additional query fields list.
10. Select Next.
11. Type the desired query name in the What do you want to name
your query? box.
12. Select Finish.

USING THE FIND UNMATCHED QUERY W IZARD

 Discussion
The Find Unmatched Query Wizard helps you manage data in related tables. This
wizard finds records that are “orphans,” meaning that they have no corresponding
records in the related table. Suppose, for example, that you have deleted the records of
inactive customers from a Customers table. Two years later, one of those customers
places an order, which is entered into the Orders table. Because the Customers and
Orders tables are related, however, having an order without the corresponding
customer data will cause problems. You can use the Find Unmatched Query Wizard to
correct the problem by updating the Customers table.

Unmatched records cannot occur if referential integrity is


 enforced in the table relationship.

Page 34 WWP Training Limited


Access 2003: Advanced Appendix IV – Advanced Query Wizards

Procedures
1. Display the Queries object list.

2. Select the New button on the Database window toolbar.


3. Select Find Unmatched Query Wizard.
4. Select OK.
5. Select the desired table or query from the Which table or query
contains records you want in the query results? list.
6. Select Next.
7. Select the related table or query from the Which table or query
contains the related records? list.
8. Select Next.
9. Select the desired field in the Fields in list on the left.
10. Select the matching field in the Fields in list on the right.

11. Click the <=> button .


12. Select Next.
13. Add the desired fields to the Selected fields list.
14. Select Next.
15. Type the desired query name in the What would you like to name
your query? box.
16. Select Finish.

WWP Training Limited Page 35


Appendix IV – Advanced Query Wizards Access 2003: Advanced

EXERCISE
USING ADVANCED QUERY W IZARDS

 Task
Use advanced query wizards.

1. Open Train17x.
2. Create a crosstab query from the existing Sales by Rep query. Use
the Client ID field for the row headings and the Sales Rep field for
the column headings. Have the calculated value be the sum of the
Total Sales field.
3. Name the query Total Sales by Sales Rep, and select the option to
view the query. After you have viewed the recordset, close the query.

4. Use the Find Duplicates Query Wizard to locate any duplicate


records in the Client table. Select the Client Name, Address, and
City fields as possible duplicate-value fields. Do not select any
additional fields to show in the query.
5. Name the query Find Duplicate Clients and select the option to
view the query. Notice that two duplicate records were found. Close
the query.
6. Use the Find Unmatched Query Wizard to find any projects in the
Project table that have no record of payment in the Payment table.
Select the Project ID field as the matching field for the two tables,
if necessary. Then, have the Client ID, Course Name, and End
Date fields also display in the query.
7. Name the query No Record of Payment and select the option to
view the results. After you have viewed the recordset, close the
query.

Page 36 WWP Training Limited


Access 2003: Advanced Appendix IV – Advanced Query Wizards

8. Close the database file.

WWP Training Limited Page 37


APPENDIX V -
USING CHARTS

 Create a chart

 Add a chart to a form or report

 Activate Microsoft Graph to edit

 Change the chart type

 Change the chart title

 Format the chart title

 Add data labels to a chart


Appendix V –Charts Access 2003: Advanced

CREATING A CHART

 Discussion
With Access, you can enhance forms and reports by adding graphs, pictures, and other
objects.

The Chart Wizard assists you in creating charts quickly. Charts allow you to represent
information in a database graphically. Charts can be either two or three dimensional,
depending on the type and amount of data you need to represent. The message a chart
conveys should be clear, and you should avoid providing too much information.

Access includes a number of charts from which you can choose. The Chart Wizard
provides a description of each chart type to assist you in selecting the appropriate type
for the data you are using. For example, a bar chart best represents comparisons of like
data, such as quarterly profits, and a pie chart best represents parts of a whole, such as
each salesperson’s contribution to overall sales. Many of the available charts are similar
in the way they represent data, but differ aesthetically. For instance, you can replace the
bars in a bar chart with cylinders or cones to provide a more dramatic effect.

Depending on the type of chart selected, you may have a series field, data field, and an
axis field associated with the chart. After selecting the chart type and advancing the
wizard, Access will automatically insert fields into the series, data, and axis boxes from
those available. You may change the contents of any of these boxes by dragging the
field buttons in and out of the boxes.

A pie chart

The Chart Wizard is not included in the default installation.


 You can choose to install it with the initial installation, or it
can be installed by itself at a later time.

If the fields you need to create a chart are in different tables,


 you can create a query to combine the fields and then base the
chart on the results of the query.

Page 40 WWP Training Limited


Access 2003: Advanced Appendix V – Charts

You can use the Chart Wizard to add a chart to an existing


 form or report by selecting the Insert menu and then selecting
the Chart command while in Design view of the form or
report.

Procedures
1. Open the desired database.
2. Display the Forms or Reports object list in the Database window.

3. Select the New button on the Database window toolbar.


4. Select Chart Wizard.
5. Select the Choose the table or query where the object’s data
comes from list.
6. Select the table or query on which you want to base the query.
7. Select OK.
8. Add the field containing the data you want to display in the chart
from the Available Fields list box.
9. Add additional fields from the Available Fields list box as desired.
10. Select Next.
11. Select the desired chart type.
12. Select Next.
13. Arrange the contents of the Data, Series, and Axis boxes as desired.
14. Select Next.
15. Select Next.
16. Type a title for the chart.
17. Select whether or not to display a legend on the chart.
18. Select whether or not to open the form with the chart or modify the
design.
19. Select Finish.

WWP Training Limited Page 41


Appendix V –Charts Access 2003: Advanced

ADDING A CHART TO A FORM OR REPORT

 Discussion
Access considers a chart to be an unbound object, meaning that you can manipulate the
chart as you would any other object. For example, a chart can be added to a form or
report to improve its usefulness and appearance.

A chart appears differently in Design view, due to the fact that


 the actual data is not displayed.

You can also paste the chart object from the Clipboard task
 pane.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Select the chart object.
4. Right-click the chart object.
5. Select the Copy command.
6. Close the form or report.
7. Select the Forms or Reports object list.
8. Select the desired form or report.

9. Select the Design button on the Database toolbar.


10. Click in the desired section of the form or report.

11. Click the Paste button on the Form Design or Report Design
toolbar.

Page 42 WWP Training Limited


Access 2003: Advanced Appendix V – Charts

ACTIVATING MICROSOFT GRAPH TO EDIT

 Discussion
You may want to make changes to a chart to improve its appearance or emphasize
aspects of the chart. You can change the chart type; the text of the chart, such as the title
and the data labels; the colors used in the chart; and the actual data the chart displays.
When editing a chart, Access displays an editing toolbar to allow you to quickly make
any changes.

You use Microsoft Graph to modify charts in Access. The Microsoft Graph window
consists of two elements. The first element is the Datasheet window. The datasheet is a
worksheet of the data that is used to create the chart. Any changes to the data
comprising the chart are made in the datasheet. The second element is the Chart
window, which displays the graphical representation of the data. You can make a chart
easier to read by revising its appearance, such as modifying the layout or formatting the
title.

It is important to note that a chart is displayed in a control. Microsoft Graph is used to


edit the chart and chart data within the control. Formatting changes, such as moving or
resizing the chart, are accomplished by manipulating the control in Design view of the
form or report.

The Datasheet window consists of rows and columns in which you can enter labels and
numbers. The rows are identified with numbers and the columns are identified with
letters. The intersection of a row and column identifies the cell with a cell address, such
as A1, CA10, DE100, etc. When you make a change in the Datasheet window, the
changes are reflected in the Chart window.

The major parts of the Datasheet window are listed in the following table:

Part Description
Row headings The identifiers to the left of the first column in the
datasheet.
Column headings The identifiers above the top row of the datasheet.
Cell The intersection of a column and row.
Data point A single cell value.
Data series A row or column of data.
Series names Names used to identify each row or column of
data that appear in the legend of the Chart
window.

The major parts of the Chart window are listed in the following table:

Part Description
Chart The area inside the Chart window.
Data marker An item in a chart that marks a single data point
or value, such as a bar, a shape, or a symbol.

WWP Training Limited Page 43


Appendix V –Charts Access 2003: Advanced

Part Description
Data series A group of data points. A chart can have one or
more data series.
Attached text Describes the data or items in a chart and is linked
to a chart item, such as a data marker. Attached
text moves with the item to which it is linked, and
cannot be moved independently.
Unattached text Describes the data or items in a chart. Because it
is not linked, you can move unattached text
anywhere on a chart.
Gridlines Optional lines that make it easier to view the data
values.
Axes Lines that serve as a major reference point for
plotting data in charts. Usually, categories of data
are plotted along the horizontal (x) axis and data
values are plotted along the vertical (y) axis.

The Microsoft Graph window

You can also activate Microsoft Graph by double-clicking a


 chart object in Design view or by right-clicking a chart object,
pointing to the Chart Object command, and then selecting the
Open command.

Procedures
1. Open the database.
2. Open the desired form or report in Design view.
3. Select the chart object you want to edit.

Page 44 WWP Training Limited


Access 2003: Advanced Appendix V – Charts

4. Select the Edit menu.


5. Point to the Chart Object command.
6. Select the Open command.

CHANGING THE CHART TYPE

 Discussion
After creating a chart, you may decide to display the data more effectively with another
type of chart. You can change the chart type in the Microsoft Graph window. Access
includes a number of chart types from which you can choose.

You can also choose from a number of available chart sub-types. An example of a chart
sub-type is a pie chart that is “exploded,” meaning the wedges of the pie are pulled out
from the center.

The Chart Type dialog box

Because it is very easy to change the chart type and/or sub-


 type while in the Microsoft Graph window, you may want to
sample several types of charts to find the one that best
emphasizes your point.

You can also open the Chart Type dialog box by right-clicking
 a chart and then selecting the Chart Type command.

WWP Training Limited Page 45


Appendix V –Charts Access 2003: Advanced

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Open the Microsoft Graph window.
4. Select the Chart menu.
5. Select the Chart Type command.
6. Select the Standard Types tab.
7. Select the desired chart type from the Chart type list box.
8. Select the desired chart sub-type.
9. Click and hold the Press and Hold to View Sample button.
10. Release the mouse button.
11. Select OK.

CHANGING THE CHART TITLE

 Discussion
You can change the title of a chart in the Microsoft Graph window. If the data in the
chart has changed, you can revise the title to provide a better description of the chart’s
contents.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Open the Microsoft Graph window.
4. Select the chart title.
5. Select the chart title text.
6. Type the new title for the chart.
7. Click in a blank area of the chart to deselect the chart title.

Page 46 WWP Training Limited


Access 2003: Advanced Appendix V – Charts

FORMATTING THE CHART TITLE

 Discussion
You can format the chart title in the Microsoft Graph window. You can change the
pattern, font, and alignment of the chart title. The pattern of the chart title controls the
type of border around the title, if any, and the background color of the title. The font
controls the appearance of the chart title text, such as font type, style, and size. The
alignment of the chart title controls where the title text appears relative to the chart, as
well as the orientation of the title text.

You can also open the Format Chart Title dialog box by right-
 clicking the chart title and then selecting the Format Chart
Title command.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Open the Microsoft Graph window
4. Select the chart title.
5. Select the Format menu.
6. Select the Selected Chart Title command.
7. Select the tab for the desired type of formatting changes.
8. Select the desired format.
9. Select OK.

ADDING DATA LABELS TO A CHART

 Discussion
You can add data labels to a chart in the Microsoft Graph window. These labels identify
the data displayed in the chart. They differ from the legend in that they are placed on the
pieces of the chart, rather than in a key beside it. Data labels can display amounts and
percentages from the chart data. You can use data labels to present a more detailed and
effective chart.

WWP Training Limited Page 47


Appendix V –Charts Access 2003: Advanced

You can also open the Chart Options dialog box by right-
 clicking the chart and then selecting the Chart Options
command.

Procedures
1. Open the desired database.
2. Open the desired form or report in Design view.
3. Open the Microsoft Graph window.
4. Select the chart plot area.
5. Select the Chart menu.
6. Select the Chart Options command.
7. Select the Data Labels tab.
8. Select the desired data labels option.
9. Select OK.

Page 48 WWP Training Limited


Access 2003: Advanced Appendix V – Charts

EXERCISE
USING CHARTS

 Task
Use a chart.

1. Open Train27x.
2. Display the Reports object list in the Database window.
3. Using the Chart Wizard, select the Sales table, and include the Cost
and Sales Rep fields to create a Bar Chart (second row, first
column). Accept the default layout and title for the chart and select
not to display a legend. Select to open the report with the chart
displayed on it.
4. Switch to Design view. View the Sales chart in the Microsoft Graph
window. (Hint: When you display the chart in the Microsoft Graph
window, the data that appears is sample data. It is not representative
of the actual data that will appear in the final chart.)
5. Change the chart type to Column. Select the Clustered Column
sub-type, if necessary.
6. Change the chart title to Sales Reps.
7. Apply the Bold Italic style and a 12 point font size to the chart title.
8. Add data labels that show the actual values represented by the chart.
9. Size and position the chart as necessary to view the values.
10. Preview the report.

11. Close and save the report as Sales Report.

WWP Training Limited Page 49


Appendix V –Charts Access 2003: Advanced

12. Close the database file.

Page 50 WWP Training Limited


APPENDIX VI -
USING ACCESS AND THE INTERNET

 Work with hyperlinks

 Create a hyperlink field

 Insert a hyperlink field

 Edit a hyperlink field

 Delete a hyperlink field

 Hide/Display the Web toolbar

 Create a data access page

 Group and sort data access pages

 Create a PivotTable in a Data Access page

 Encrypt a database

 Assign a database password

 Remove a database password


Appendix V – Access and the Internet Access 2003: Advanced

W ORKING WITH HYPERLINKS

 Discussion
Access 2003 supports the use of hypertext within the application. Hypertext, or
hyperlinks, are strings of text that declare an address or a path to a document. Hypertext
is active in that, if you click it, your PC and/or modem lead you to the document.
Hyperlinks provide an electronic path to documents in much the same way as your
home address provides a path for the mail you receive. For example, by reading the
address, the postal service knows to first go to Pennsylvania, then to Pittsburgh, then to
Forbes Avenue, and then to house number 2250.

Hyperlinks can be a URL address or a UNC address. The URL (Uniform Resource
Locator) is the address of a resource, or file, available on the Internet or your intranet.
The URL contains the protocol of the resource (e.g. http:// or ftp://), the domain name
for the resource, and the hierarchical name for the file (address). For example, a page on
the internet may be at the URL http://www.globalknowlege.com/terms/url.shtml. The
beginning part, http:// provides the protocol, the next part www.globalknowledge.com
is the domain, the main domain is globalknowledge, while www is a pointer to a
computer or a resource. The rest, /terms/url.shtml is the pointer to the specific file on
that server. Domain extensions identify the source; .com for companies, .org for
organizations, .gov for government, and .edu for educational institutions.

A UNC (Universal Naming Convention) is the address to a shared file in a computer


without having to specify (or know) the storage device it is on. The UNC can be used
instead of the local naming system. In Windows operating systems, the UNC name
format is: \\servername\sharename\path\filename. The share name logically identifies
the storage device that the file is on. For example: \\corp1\acctept\forms\triprpt.xls
might specify on a server in the corporate main office a shared file (triprpt.xls) kept
with other accounting forms that employees of the corporation might download and
read or print and use. A UNC hyperlink, when clicked, launches Excel and opens the
file in the designated folder. Similarly, when you click a URL hyperlink address,
Access activates the application you use to navigate the Internet and takes you to that
site.

CREATING A HYPERLINK FIELD

 Discussion
You can add hyperlinks to tables in Design view by adding a field name and identifying
it as a hyperlink data type. You can then add hyperlinks to the appropriate column in
Datasheet view, allowing you to jump to objects in the same database, in another
database, in other Microsoft office documents, on the internet, or on an intranet.

Page 52 WWP Training Limited


Access 2003: Advanced Appendix V – Access and the Internet

Procedures
1. Open the desired database.
2. Open the desired table in Design view.
3. Select the first blank row in the Field Name column.
4. Type the desired field name.
5. Press [Tab].
6. Select the Data Type list.
7. Select the Hyperlink data type.

INSERTING A HYPERLINK FIELD

 Discussion
You can insert a hyperlink into a field in a table or form. However, the field data type
must be designated as Hyperlink. The default settings display a new hyperlink in blue
underlined text and a followed hyperlink (one that has been used) in purple underlined
text. When you click the label, the hyperlink path is followed to the specified location.
The document at the end of the path can be a web page for company headquarters in
Los Angeles, another form or report in the current database, or anywhere in between.
For example, in the header of an Annual Sales Report, you can insert hyperlink labels
that, when activated, open related reports, such as a Quarterly Sales Report for that year.
Another example is to create a hyperlink label for a Product field on a form that jumps
to a listing of products on your supplier’s web page.

Hyperlink labels in forms or reports must contain a viable path, but the path itself does
not need to be displayed on the label. As with hyperlink fields, you can display a label
with descriptive text rather than the actual path.

When you point to a hyperlink, the mouse pointer changes into a hand pointing upward,
signifying that one mouse click activates the hyperlink.

WWP Training Limited Page 53


Appendix V – Access and the Internet Access 2003: Advanced

The Insert Hyperlink dialog box

When you activate a hyperlink, the Web toolbar appears


 automatically.

You can type hyperlink text directly into a field. You can also
 type it directly into the Insert Hyperlink dialog box, which is
opened by selecting the Insert menu and then selecting the
Hyperlink command when the insertion point is located in a
hyperlink column.

Procedures
1. Open the desired database.
2. Open the desired table in Datasheet view.
3. Select the desired row in the hyperlink column.

4. Click the Insert Hyperlink button on the Table Datasheet


toolbar.
5. Select the Objects in This Database button in the Link to bar.
6. Double-click the desired object type.
7. Select the desired object to which you want to link.
8. Select OK.

Page 54 WWP Training Limited


Access 2003: Advanced Appendix V – Access and the Internet

EDITING A HYPERLINK FIELD

 Discussion
You may occasionally have to edit your hyperlinks. Changes in web addresses are
common, and any file location changes on your PC or server need to be reflected with
an updated hyperlink. You can edit the hyperlink text or replace it with a new location.

When you edit most text in Access, you simply click or double-click the text and then
make the necessary changes. By design, hyperlinks are activated when clicked and,
therefore, must be edited differently.

Procedures
1. Open the desired database.
2. Open the desired table or form in Datasheet view.
3. Point to the hyperlink you want to edit.
4. Right-click the hyperlink you want to edit.
5. Point to the Hyperlink command.
6. Select the Edit Hyperlink command.
7. Double-click the desired object type.
8. Select the new object to which you want to link.
9. Select OK.

DELETING A HYPERLINK FIELD

 Discussion
If a hyperlink becomes invalid, or is no longer of any use, it can be deleted. As with
editing a hyperlink, you cannot simply double-click a hyperlink to select it.

You can also delete a hyperlink by selecting it and pressing


 the [Delete] key.

WWP Training Limited Page 55


Appendix V – Access and the Internet Access 2003: Advanced

Procedures
1. Open the desired database.
2. Open the desired table or form in Datasheet view.
3. Point to the hyperlink you want to delete.
4. Right-click the hyperlink you want to delete.
5. Point to the Hyperlink command.
6. Select the Edit Hyperlink command.
7. Select the Remove Link button.

HIDING/DISPLAYING THE W EB TOOLBAR

 Discussion
Among the available toolbars in Access is the Web toolbar. The Web toolbar
automatically appears when you activate a hyperlink. This toolbar is very similar to
toolbars used with web browsers. The Web toolbar enables you to easily navigate
through documents, whether on your hard drive or on the Internet. The features on the
Web toolbar include a display of the current address, forward and back buttons, and a
Favorites list that can include commonly used hyperlink addresses. The same
procedure is used to both display and hide the Web toolbar.

Procedures
1. Open the desired database.
2. Open the desired table or form in Datasheet view.
3. Select the View menu.
4. Point to the Toolbars command.
5. Select the Web command.

Page 56 WWP Training Limited


Access 2003: Advanced Appendix V – Access and the Internet

CREATING A DATA ACCESS PAGE

 Discussion
Data access pages are web pages that appear in a browser which may be used to add,
edit, view, or analyze data in an existing Access or Microsoft SQL Server database.
These pages are connected directly to the database. Each page is a separate file that is
stored outside Access; however, Access automatically adds a shortcut to the file in the
Database window.

Creating data access pages is similar to creating forms and reports in that you use the
field list, toolbox, controls, etc. when creating and editing a page. In addition, you can
create data access pages from scratch in Design view or by using a wizard. However,
there are some differences that you need to keep in mind.

When you create data access pages in Design view, you can either drag individual fields
from the Field List task pane to the page, or add all fields from a specific table or
query. If you choose to add all fields from a table or query, you can choose a layout,
such as Columnar, Tabular, PivotTable, PivotChart, or Office Spreadsheet. When
you select Columnar, Tabular, or Office Spreadsheet, the fields are automatically
added to the data access page in accordance with the selected layout. With the
PivotTable layout, the data is displayed in Datasheet view where each column can be
filtered, if desired. PivotChart layout requires you to add the desired fields to the chart.

When creating a page for entering and editing data, you should use individual toolbox
controls such as text boxes, option buttons, etc. Controls should be placed in the body
or in a section. You can only group on one record source. You should also ensure that
the Data Page Size property in the Sorting and Grouping window is set to 1. You can
use the Office Spreadsheet tool in the toolbox if you want to perform calculations on
fields in a record.

If you want to analyze data, you should use the Office PivotTable tool in the toolbox,
since it allows you to reorganize data in different ways. When using the Office
PivotTable tool, you place the PivotTable in either the body or a section of the page.
When using the PivotTable tool on a grouped data access page, you place the
PivotTable and bound controls in a section and make sure that the PivotTable is in the
lowest group level. If the PivotTable is the only control in a section, you can delete or
hide the navigation section from the group level in which the PivotTable is located. You
should also ensure that the Data Page Size property in the Sorting and Grouping
window is set to 1.

When a user views the data access page in a browser, he or she is viewing his or her
own copy of the page. Therefore, any filtering, sorting, and other changes that are made
which affect what appears only affect that user’s copy of the data access page.
However, since the pages are connected directly to the database, any changes that the
user makes to the data will affect the data in the database.

If you created a Data Access Page using a local Access database and want to share it
with other users, you will need to move or copy the database to a network location and
then change the connection path location on the Connection page of the Data Link
Properties dialog box. The Data Link Properties dialog box is accessed by selecting the
Page connection properties button on the task pane.

WWP Training Limited Page 57


Appendix V – Access and the Internet Access 2003: Advanced

A newly created Data Access page

Individual fields from a table or query may be dragged


 directly onto a data access page from the field list.

You can also save an existing form, report, or view, such as


 PivotTable or PivotChart, as a Data Access Page using the
Save As command.

You can also create a Data Access Page that automatically


 adds all of the fields from a table or query to the page by
selecting the AutoPage: Columnar option in the New Data
Access Page dialog box.

Procedures
1. Open the desired database.
2. Display the Pages objects list.

3. Select the New button on the Database window toolbar.


4. Select the desired data access creation method option.
5. Select the Choose the table or query where the object’s data
comes from list.
6. Select the desired table or query.
7. Select OK.

Page 58 WWP Training Limited


Access 2003: Advanced Appendix V – Access and the Internet

8. Select the desired table or query from the Field List task pane.

9. Select the Add to Page button on the task pane.


10. Select the desired layout.
11. Select OK.

12. Click the Save button on the Page Design toolbar.


13. Type a name for the page.
14. Select Save.
15. Select OK.

GROUPING AND SORTING DATA ACCESS PAGES

 Discussion
You can group records on data access pages. Grouping records on a data access page is
similar to grouping records in a report. Grouping records allows you to create a
structure that groups records from general categories to specific details. Grouped data
access pages are bound to the database so that they always display the current database
data. These pages also allow you to filter and sort data.

You can create a group data access page from scratch very much the same way you
would create a group report using the Sorting and Grouping window. Another way is to
use the Page Wizard. As you step through the wizard, it will prompt you for grouping
levels and sort orders.

When you group levels, the data access page becomes


 read-only.

Procedures
1. Open the desired database.
2. Display the Pages objects list.

3. Select the New button on the Database window toolbar.


4. Select the desired data access creation method option.

WWP Training Limited Page 59


Appendix V – Access and the Internet Access 2003: Advanced

5. Select the Choose the table or query where the object’s data
comes from list.
6. Select the desired table or query.
7. Select OK.
8. Select the fields you want to appear on your page from the Available
Fields list box.
9. Select Next.
10. Select the field(s) for the desired grouping level(s).
11. Select Add.
12. Select Next.
13. Select the 1 sort field list.
14. Select the desired field.
15. Select Next.
16. Enter the title for the page.
17. Select Finish.

18. Click the Save button on the Page Design toolbar.


19. Type a name for the page.
20. Select Save.
21. Select OK.

CREATING A PIVOTTABLE IN A DATA ACCESS PAGE

 Discussion
Office PivotTables allow you to summarize large amounts of data quickly. The Office
PivotTable tool in the toolbox, provides control and flexibility in creating PivotTables.

When using the Office PivotTable tool, you place the PivotTable in either the body or
a section of the page. Each drop area of the PivotTable workspace displays help text,
such as Drop Row Fields Here. When you first create a PivotTable, the Drop Totals
or Detail Fields Here area displays the text No Details. As you begin adding fields to
the PivotTable, the Drop Totals or Detail Fields Here help text is displayed.

The fields of a PivotTable can be laid out directly in the PivotTable workspace. The
Field List task pane displays the fields available in the source data (table or query)
previously selected. You lay out the PivotTable by dragging the fields directly into the
PivotTable workspace in the desired drop area.

Page 60 WWP Training Limited


Access 2003: Advanced Appendix V – Access and the Internet

If you would like to arrange the data by displaying the shipping date at the beginning of
each row you would drag the Shipping Date field to the Drop Row Fields Here area
of the workspace. Likewise, if you want to display the shipping method at the top of
each column, you would drag the Shipping Method button to the Drop Column Fields
Here area of the workspace.

The data field area contains the fields that are calculated. Therefore, they are usually,
but not limited to, numerical fields. For the Shipping Date by Shipping Method
PivotTable, you may want to summarize the data in the Shipping Cost field; in other
words, report the total shipping cost per shipping method by shipping date.

Filter fields are often used with large databases to filter information. They can break a
large portion of information down into smaller, more manageable sections. For
example, you may want to view shipping information for a particular sales
representative. You would accomplish this by adding the Sales Rep field to the Drop
Filter Fields Here area.

Once the appropriate fields have been added to the drop areas, you can move or delete
fields as desired.

You can also design a PivotTable or PivotChart view based on


 a table, query, or form object by opening the desired object
and switching to PivotTable or PivotChart view.

You can also add an Office PivotTable by selecting the Office


 PivotTable from the Insert menu.

Procedures
1. Open the desired database.
2. Display the Pages objects list.

3. Select the New button on the Database window toolbar.


4. Select Design View.
5. Select the Choose the table or query where the object’s data
comes from list.
6. Select the desired table or query.
7. Select OK.
8. Select the Office PivotTable tool on the toolbox.
9. Select the data access page.
10. To resize the PivotTable object, point to the desired sizing handle.
11. Drag the sizing handle in the desired direction to expand the
PivotTable.

WWP Training Limited Page 61


Appendix V – Access and the Internet Access 2003: Advanced

12. To add a row field, drag the desired field from the Field List task
pane to the Drop Row Fields Here area.
13. To add a column field, drag the desired field from the Field List task
pane to the Drop Column Fields Here area.
14. To add a data field, drag the desired field from the Field List task
pane to the Drop Totals or Detail Fields Here area.
15. To add a filter field, drag the desired field from the Field List task
pane to the Drop Filter Fields Here area.

Page 62 WWP Training Limited


APPENDIX VII -
ACCESS SECURITY
Appendix VII – Access Security Access 2003: Advanced

ENCRYPTING A DATABASE

 Discussion
You can encrypt an Access database to protect it from unauthorized use. Ideally, it is
better practice to encrypt a secured database, as any user can open and work with
objects in a database where no security measures or permissions have been defined.
When you encrypt a database, Access compresses it, and it becomes unreadable by
utility programs or word processors. Decrypting a database removes the encryption.

In order to encrypt or decrypt a database, you must be the owner of the database. If you
are encrypting or decrypting a secured database, you must be part of the system
administrators group and be granted appropriate permissions for the database. If you
attempt to encrypt or decrypt a database that you did not create or do not have adequate
permission to, an error message box appears.

A database can be open or closed when it is encrypted, however a database must be


closed when it is decrypted. If you choose to encrypt a database when it is closed, you
will first need to select the database from the Encrypt/Decrypt dialog box before
proceeding with the rest of the encryption process. Procedures for decrypting a database
are similar to those used when encrypting the database.

Renaming a database when you encrypt or decrypt it keeps the


 original database intact.

Procedures
1. Open the desired database.
2. Select the Tools menu.
3. Point to the Security command.
4. Select the Encrypt/Decrypt Database command.
5. Type a name for the encrypted database.
6. Select the Save in list.
7. Select the drive where you want to store the file.
8. Select the folder where you want to store the file.
9. Select Save.

Page 64 WWP Training Limited


Access 2003: Advanced Appendix VII – Access Security

ASSIGNING A DATABASE PASSWORD

 Discussion
You can assign a password to a database so that only those users who know the
password can open or make changes to the database. Assigning a password protects the
database, not the database objects from unauthorized users. Database objects are
protected when user-level security is established.

Passwords are case-sensitive and can be up to 20 characters. They can contain any
combination of letters, numbers, symbols, and spaces, excluding the characters " \ [ ] : |
< > + = ; , . ? * , leading spaces, and ASCII 10-31 control characters.

A database must be open for exclusive use in order to assign or remove a password.
After a password has been assigned, you are prompted for the password each time you
open the database.

Assigning a password to a replicated database prevents the


 database from being synchronized.

You may want to save a backup copy of the database before


 assigning a password.

If user-level security has been defined, you will be unable to


 assign a database password.

If you forget the assigned password, you cannot open the


 database.

Procedures
1. Click the Open button on the Database toolbar.
2. Select the Look in list.
3. Select the drive where the database you want to open is located.
4. Open the folder in which the database you want to open is located.
5. Select the name of the database you want to open.
6. Select the Open list.
7. Select the Open Exclusive command.

WWP Training Limited Page 65


Appendix VII – Access Security Access 2003: Advanced

8. Select the Tools menu.


9. Point to the Security command.
10. Select the Set Database Password command.
11. Type the desired password.
12. Press [Tab].
13. Type the password again.
14. Select OK.

REMOVING A DATABASE PASSWORD

 Discussion
If a password is no longer necessary, you can remove it from the database. You can then
open the database at any time without a password.

A database must be open for exclusive use in order to remove a password.

Procedures
1. Select the Tools menu.
2. Point to the Security command.
3. Select the Unset Database Password command.
4. Type the desired password.
5. Select OK.

Page 66 WWP Training Limited


Access 2003: Advanced Appendix VII – Access Security

EXERCISE
USING ACCESS AND THE INTERNET

 Task
Use Access and the Internet.

1. Open Train33x.
2. Create a field called Linked to with a Hyperlink data type in the
Sales table.
3. Insert a hyperlink in the Sales table to the Payment Form form.
4. Click the hyperlink text to display the Payment Form form. Close
the form.
5. Edit the hyperlink so that it opens the Client Information Form
form. Expand the Linked to column as necessary.

6. Click the hyperlink text to display the Client Information Form


form. Close the form.
7. Delete the hyperlink to the Client Information Form form.
8. Hide the Web toolbar, if necessary. Close the table and do not save
the changes.
9. Create a data access page in Design View based on the Sales table.
Add all the fields from the Sales table and choose Columnar as the
layout type (Hint: Remember to click the Add to Page button.).
10. Save the new data access page as Sales Information, click OK to
close the connection message, and then close the page.

WWP Training Limited Page 67


Appendix VII – Access Security Access 2003: Advanced

11. Create a grouped data access page using the Page Wizard based on
the Invoice table. Add all the fields, group by Client ID, and sort by
Due Date. Add the title Grouped by Due Date and open the page in
Design view.
12. Switch to Page view. Use the navigation buttons to view the data
grouped by Client ID. Click the plus sign (+) to expand the group.
13. Save the new data access page as Grouped Invoice Information,
click OK to close the connection message box, and then close the
page.
14. Create a PivotTable in a new data access page in Design view based
on the Project table. Resize the PivotTable as desired.
15. Drag the following fields to the designated drop area:

Field Name Drop Area


Trainer Initials Drop Row Fields Here
Course Name Drop Column Fields Here
Start Date Drop Totals or Detail
Fields Here
Client ID Drop Filter Fields Here

16. Use the Filter list to display information for the Abbott and Gains
clients. Then, select All from the Filter list to display all client
information.
17. Save the page as Course PivotTable, select OK to close the
connection message box, and then close the page.
18. Encrypt the Train33x database, naming it Trainenc. Close the
database.
19. Decrypt the Trainenc database, naming it Traindec.
20. Open Train33x exclusively (Hint: Use the Open Exclusive option
from the Open dialog box.).
21. Assign the password class to the database. Close Train33x.
22. Open Train33x exclusively. Notice that you must enter the
password. Remove the password.
23. Close the database file.

Page 68 WWP Training Limited


Appendix VIII – Replicating A Database Access 2003: Advanced

APPENDIX VIII -
REPLICATING DATABASES

 Replicate a database

 Synchronize database replicas

 Resolve replication conflicts

WWP Training Limited Page 73


Access 2003: Advanced Appendix VIII – Replicating A Database

REPLICATING A DATABASE

 Discussion
Replicating a database allows you to share a database. It is useful to share a database
across a network or create copies for remote users, such as a mobile sales force. While
you could copy the file, there is an advantage to replication. Any changes to data made
in a replica can be updated in the original database and other replicas through
synchronization. Additionally, any design changes to the original database are
distributed among the replicas.

You can create a single replica or multiple replicas. You may want to create a single
replica if you want to place the database on a remote computer, such as a laptop, or if
you want to create a backup of the database. You can create multiple replicas to
distribute the database among members of a department or a workgroup. The databases
can then be stored on the hard drives of the machines, which decreases activity on a
network. All the replicas made from a single Design Master make up a replica set.

When you replicate a database, the original database becomes the Design Master. The
Design Master and each of the replicas function as standalone databases. Each user can
add, edit, or delete data in their replica. These changes in the replicas can then be
synchronized with the Design Master and other replicas in the replica set. Each user can
add, edit, or delete objects in the database, such as tables, queries, reports, or forms.
However, these changes are not copied to the Design Master during synchronization.
Only the structural changes made in the Design Master are distributed to the replica set.

When a database becomes a Design Master, Access adds hidden fields and tables to the
database to facilitate synchronization. These hidden fields increase the size of the
database. Certain properties are also added to the property sheets of database objects as
well. The two visible properties are Replicable and KeepLocal. The Replicable
property applies to a database or an object and indicates whether the database or object
can be replicated. The KeepLocal property applies to database objects. You can keep
an object in the Design Master from being replicated by setting this property to True.
This option can be useful if there are tables in the Design Master that you do not want
to include in the replicas, such as those containing sensitive information, or information
that would be of no use to the replica user and would only take up disk space. In this
case, you would be creating a partial replica.

When you create a replica for the first time, the current database is converted to a
Design Master. After the first time, you simply create another replica.

Page 74 WWP Training Limited


Appendix VIII – Replicating A Database Access 2003: Advanced

The Design Master database window

During the replication procedure, you can create a backup of


 the original file. This option is useful because you will always
have a second copy of your database in case the original is
lost, damaged, or becomes corrupted.

The Microsoft Briefcase Replication is not included in the


 default installation. You can choose to install it with the initial
installation, or it can be installed by itself at a later time.

If you have AutoNumber fields in a table, their behavior


 changes in database replicas. While the existing numbers do
not change, any new records added generate random numbers.
If the incremental numbering in the AutoNumber field is
crucial, use another Date/Time field to produce incremental
numbers.

If you plan to convert an Access 2003 database to an Access


 97 database, you must perform the conversion before it
becomes a part of a replica set. To convert an Access 2003
database to an Access 97 database, select the Tools menu,
point to the Database Utilities command, point to the
Convert to Database command, and then select the To Prior
Access Database Version command.

Procedures
1. Open the desired database.
2. Select the Tools menu.

WWP Training Limited Page 75


Access 2003: Advanced Appendix VIII – Replicating A Database

3. Point to the Replication command.


4. Select the Create Replica command.
5. Select Yes.
6. Select Yes.
7. Type a name for the replica in the File name text box.
8. Select the Save in list.
9. Select the drive where you want to save the replica.
10. Select the folder where you want to save the replica.
11. Select OK.
12. Select OK.

SYNCHRONIZING DATABASE REPLICAS

 Discussion
When changes have been made to replicated files or the Design Master, they can then
be synchronized. You can synchronize a replica with the Design Master or another
replica in the replica set.

Synchronization is bi-directional, meaning that all changes are exchanged between the
files in both directions.

Procedures
1. Open the Design Master database window.
2. Select the Tools menu.
3. Point to the Replication command.
4. Select the Synchronize Now command.
5. Select the Directly with Replica list.
6. Select the desired replica file.
7. Select OK to begin the synchronization process.
8. Select Yes to complete the synchronization process.
9. Select OK.

Page 76 WWP Training Limited


Appendix VIII – Replicating A Database Access 2003: Advanced

RESOLVING REPLICATION CONFLICTS

 Discussion
When replicas are synchronized with one another, replication conflicts can occur.
Conflicts are usually generated when the same data in multiple files has been changed
in different ways. If a table has replication conflicts, Access opens a message box when
the file is opened. You can choose to resolve the conflicts at this point or resolve them
later using the Resolve Conflicts feature.

Access stores replication conflicts in a conflicts table in the database. This table holds
all records with conflicts. When you resolve conflicts, Access displays the existing
record and the conflicting record next to each other. If you choose to keep the existing
record, Access overwrites the conflicting record. If you choose to keep the conflicting
record, Access overwrites the existing record. Either way, you cannot undo the change.

Procedures
1. Open the Design Master database window.
2. Select the Tools menu.
3. Point to the Replication command.
4. Select the Resolve Conflicts command.
5. Select Resolve Conflicts.
6. Select Keep Existing Record or Overwrite with Conflict Record.
7. Select Yes or No to confirm.
8. Repeat steps 5-7 until all conflicts are resolved.
9. Select OK.
10. Select Close to close the Resolve Replication Conflicts dialog box.

WWP Training Limited Page 77


Access 2003: Advanced Appendix VIII – Replicating A Database

EXERCISE
REPLICATING DATABASES

 Task
Replicate a database.

1. Open Train32x.
2. Create a replica called Train32_Rep and save it to the student data
folder.
3. Open the Trainer table in Train32 in Datasheet view and change
the Address field in the first record to 123 Main St.. Close the table.
4. Synchronize the database with Train32_Rep.
5. Close Train32.
6. Open Train32_Rep. Open the Trainer table in Datasheet view and
verify that the address information for the first record has changed.
7. Close the table.
8. Close the database file.

Page 78 WWP Training Limited


Appendix IX – VBA Modules Access 2002 (XP): Advanced

APPENDIX IX -
INTRODUCTION TO VBA MODULES

 Use the Module Window

 Use Sub Procedures

 Add Comments

 Use Keywords

WWP Training Limited Page 79


Access 2002 (XP): Advanced Appendix IX – VBA Modules

THE MODULE W INDOW

 Discussion
The Module window is used in Access for creating and editing Visual basic for
Applications(VBA) code.

Depending on the type of Module (either Private or Global) the Module window can be
opened via the module page of the database window or via an event property. Private
Modules are object based and run from event properties. Global modules are not object
based and can be accessed via the database window.

Database objects can have VBA modules attached to them via the various event
properties for each of their controls. For example one form could have a VBA module
attached to each of its event properties for each of its controls.

Once in the Module window the different code associated with the current Object can be
selected from the drop down lists on the toolbar. The left hand list shows all the controls
on the object and the right hand list shows all the event properties for each of the
controls. For example you could select a command button from a form on the left hand
list and the On Click property on the right hand list to see what coding is attached to the
button when it is clicked.

Global Modules are created via the database window and are used when VBA coding is
required to be accessed from anywhere in the database.

Access uses different colours for the text in a Module to represent what that text stands
for:
Black - General Text
Green - Comments
Blue - Key Words
Red - Code that contains Errors or bugs

This colour coding helps when deciphering large amounts of code and also when
debugging.

SUB PROCEDURES

 Discussion
When Creating VBA code attached to an event property a Sub Procedure is created
within the Module for that object. To define the Sub Procedure and separate it from the
rest of the code the Sub……End Sub keywords are used. The correct syntax for these
is as follows

Private Sub Procedure_Name ()

Page 80 WWP Training Limited


Appendix IX – VBA Modules Access 2002 (XP): Advanced

End Sub

The Private Sub Keyword must be the first line of the procedure. It defines the
beginning of the procedure and the procedure name. The procedure name cannot
contain spaces. When Access creates private sub procedures (via command button
wizards) it automatically names the sub procedure by the associated control and event
property for the procedure.

The End Sub keyword has to be the last line of the procedure and declares the end of the
sub procedure.

ADDING COMMENTS

 Discussion
When creating VBA code even in small quantities, adding comments to keep track of
what you are doing is recommended.

To add a comment to the end of a line of code or on a line of its own just start off the
comment with a single quote '.For example:

‘This is a comment

Comments appear in the Modules window as Green Text to separate them from the rest
of the code.

KEYWORDS

 Discussion
Keywords are the main commands of VBA, there are over 500 keywords in VBA each
with its own specific function. Keywords appear as blue text in the module window to
distinguish them from the rest of the code.

Examples include the Private Sub and End Sub Keywords that have already been
discussed. As more complex coding is used the more key words will occur as part of the
modules.

To see all the keywords available and their functions type in keywords into the index
section Access Help and display the results. They are all split into various categories of
associated keywords. From these different categories the different keywords can be
selected and their functions and syntax displayed.

WWP Training Limited Page 81


INDEX

creating ................................................. 32
A
Crosstab Query Wizard ............................. 32
ActiveX controls using ..................................................... 32
adding ............................................. 85, 86 Custom commands
attaching ............................................... 86 adding ................................................. 152
registering ....................................... 84, 85
D
using ..................................................... 84
Advanced Query Wizards ......................... 31 Data
Analyzing Tables ........................................ 3 exporting ......................................... 16, 17
importing ........................................ 12, 13
B
linking to a table .............................. 13, 14
Backing Up a Database ............................. 22 Data Access Page ...................................... 57
Built-in menu items Data access pages
adding to a toolbar .............................. 149 creating ........................................... 57, 58
creating a PivotTable ....................... 60, 61
C
grouping ................................................ 59
Calculated controls sorting ............................................. 59, 60
creating ........................................... 47, 48 Data formats.............................................. 16
Charts ....................................................... 39 Database objects
activating Microsoft Graph.............. 43, 44 exporting ......................................... 16, 17
adding data labels............................ 47, 48 importing ........................................ 12, 13
adding to a form .................................... 42 Databases
adding to a report .................................. 42 backing up ............................................. 22
changing the title................................... 46 compacting ............................................ 20
changing the type ............................ 45, 46 converting ....................................... 17, 18
Chart Wizard .................................. 40, 41 decrypting ............................................. 64
creating ........................................... 40, 41 encrypting ............................................. 64
formatting the title ................................ 47 replicating ....................................... 74, 75
Combo boxes resolving replication conflicts ................ 77
creating ........................................... 33, 34 synchronizing .................................. 74, 76
Command buttons synchronizing replicas ........................... 76
adding ............................ 70, 78, 79, 80, 81 Date control
adding to switchboard .................. 140, 141 inserting ................................................ 52
creating ........................................ 118, 119 Documenter
Commands using ..................................................... 19
adding to a menu item ......................... 151
Compacting a Database............................. 20 E
Concatenation Encrypting a Database ............................... 64
using in a query..................................... 17 Event Properties ...................................... 127
Controls Excel
ActiveX controls ................................... 84 creating workbooks using Office Links .. 28
adding logic .................................... 38, 39 dragging and dropping data into............. 27
creating calculated .......................... 47, 48 exporting data to.................................... 26
using the Combo Box tool ............... 33, 34 Exporting to Excel ................................. 25
using the List Box tool .......................... 35 Exporting
using the Option Group tool .................. 37 data ................................................. 16, 17
Conversion Error Logging feature ............. 18 Exporting to Excel and Word................. 25
Converting Exporting Data .......................................... 16
database files .................................. 17, 18
F
Converting Files ....................................... 17
Crosstab queries Fields

Page 82 WWP Training Limited


Yes/No............................................ 38, 39 I
Files
Importing Data .......................................... 12
removing a password............................. 66
Indexes
Find Duplicates Query .............................. 33
creating a multiple field ......................... 92
Find Duplicates Query Wizard
creating a multiple field primary key 93, 94
using ..................................................... 33
creating a single field............................. 91
Find Unmatched Query ............................. 34
deleting ................................................. 93
Find Unmatched Query Wizard
viewing ........................................... 90, 91
using ..................................................... 34
Footer J
adding to a form .................................... 41 Join lines
adding to a report ............................ 46, 47 deleting ........................................... 27, 28
Form Footer .............................................. 32
Form Header ............................................. 32 L
Forms Linking Data ............................................. 13
adding a form header and footer ...... 40, 41 List boxes
adding logic controls ....................... 38, 39 creating ........................................... 34, 35
creating a combo box ...................... 33, 34
creating a list box ............................ 34, 35 M
creating an option group .................. 36, 37 Macro Builder
creating blank ....................................... 42 creating macros ................................... 112
saving as a report ............................ 71, 72 Macros
sections ................................................. 32 adding a condition ....................... 120, 121
setting the tab order automatically ... 39, 40 adding an action .......................... 101, 104
setting the tab order manually................ 40 assigning an argument to an action ..... 104,
using in Design view ............................. 32 107
G assigning to a control ................... 116, 118
creating ....................................... 101, 104
Group footers creating Autoexec ........................ 123, 124
creating ........................................... 49, 50 creating group ............................. 122, 123
displaying summary information ..... 49, 50 creating using the Macro Builder ......... 112
Group headers editing existing ............................ 110, 111
creating ........................................... 49, 50 opening the Macro Design window ..... 100,
Group macros 101
creating ........................................ 122, 123 running ................................................ 110
Grouping running using the Tools menu .............. 111
report data ....................................... 48, 49 saving.................................................. 108
H using single step mode for testing ........ 109
working with ....................................... 100
Header Margins
adding to a form .................................... 41 changing................................................ 53
adding to a report .................................. 46
Microsoft Graph
Hyperlink Field ......................................... 52 activating......................................... 43, 44
Hyperlinks adding chart data labels ................... 47, 48
creating fields ................................. 52, 53 changing the chart title........................... 46
deleting fields ................................. 55, 56
changing the chart type .................... 45, 46
displaying the Web toolbar .................... 56 formatting the chart title ........................ 47
editing fields ......................................... 55
hiding the Web toolbar .......................... 56 N
inserting fields ................................ 53, 54 Name AutoCorrect .................................... 20
working with ......................................... 52 options ............................................ 20, 21
Hypertext using ............................................... 20, 21
working with ......................................... 52 Normalising Data ...................................... 10

WWP Training Limited Page 83


O changing the margins ............................. 53
creating a calculated control .................. 47
Office Links
creating a group header and footer ... 49, 50
using to create Excel workbooks ........... 28
creating a running summary................... 51
using to create Word documents ...... 28, 29
creating blank .................................. 54, 55
Option groups
creating without a wizard................. 54, 55
creating ........................................... 36, 37
grouping data .................................. 48, 49
P inserting a date control .......................... 52
Page breaks inserting a page break ...................... 52, 53
inserting a time control .......................... 52
inserting .......................................... 52, 53
Page Footer ......................................... 32, 46 sections ................................................. 46
Page Header........................................ 32, 46 using in Design view ............................. 46
Running summary
Parameter queries
creating ................................................. 16 creating ................................................. 51
Password .................................................. 65 S
Passwords
Security..................................................... 63
assigning ............................................... 65
Separator bars
removing .............................................. 66
adding ................................................. 154
Performance Analyzer............................. 6, 7
Shortcut menus
PivotChart
creating ............................................... 155
creating a view ................................ 72, 73
linking ................................................. 156
PivotTable ................................................ 60
Subdatasheets
creating ........................................... 60, 61
viewing ........................................... 26, 27
creating a view ................................ 72, 73
Subforms
Primary key
creating ........................................... 61, 62
creating a multiple field................... 93, 94
displaying a total ............................. 64, 66
Properties
displaying in Datasheet view ........... 63, 64
using ................................................... 116
editing the layout ............................. 62, 63
Q working with ......................................... 60
Subreports
Queries
crosstab................................................. 32 creating ........................................... 61, 62
parameter .............................................. 16 displaying a total ............................. 64, 66
using a concatenation in ........................ 17 editing the layout ............................. 62, 63
working with ......................................... 60
R Switchboards
Records adding a command button ............ 140, 141
viewing in forms ................................... 72 creating ....................................... 139, 140
Referential integrity opening ....................................... 138, 139
setting ............................................. 24, 26 setting startup options .......................... 142
Relationship Document ............................. 19 using ............................ 133, 134, 138, 139
Relationship documents Synchronizing ........................................... 76
printing ................................................. 19 T
Relationships
creating between tables ................... 23, 24 Tab order
setting automatically........................ 39, 40
deleting join lines ............................ 27, 28
one-to-many...................................... 23, 4 setting manually .................................... 40
one-to-one......................................... 23, 4 Table Analyzer Wizard............................ 4, 5
Tables
setting referential integrity .............. 24, 26
using related tables ................................ 22 analyzing ..................................... 4, 5, 6, 7
window ................................................. 23 deleting join lines .................................. 27
joining ................................................... 23
Replicating Databases ............................... 73
Reports linking ................................................... 14
adding headers and footers .................... 46 linking data ........................................... 14
related ................................................... 22

Page 84 WWP Training Limited


splitting ................................................... 4 V
viewing subdatasheets ........................... 26
VBA Modules ........................................... 79
Time control
inserting ................................................ 52 W
Toolbar buttons Web toolbar
changing image ................................... 158 displaying .............................................. 56
Toolbars
hiding .................................................... 56
adding a built-in menu item ................. 149 Wizards
adding a command to a menu item ...... 151 Crosstab Query ...................................... 32
adding a custom command .................. 152
Find Duplicates Query ........................... 33
adding a separator bar ......................... 154 Find Unmatched Query.......................... 34
adding buttons ..................................... 157 Word
changing a button image...................... 158
creating documents using Office Links . 28,
creating a custom menu item ............... 150 29
creating custom ................................... 148 Exporting to Word ................................. 25
delete custom ............................... 158, 159
docking floating .................................. 153
linking to a report ................................ 153

WWP Training Limited Page 85


NOTES

Page 86 WWP Training Limited


NOTES

WWP Training Limited Page 87


NOTES

Page 88 WWP Training Limited


NOTES

WWP Training Limited Page 89


NOTES

Page 90 WWP Training Limited


NOTES

WWP Training Limited Page 91


Page 92 WWP Training Limited

You might also like