Beruflich Dokumente
Kultur Dokumente
FO
TR
IN
IN
C C T G L O B A L
.C O M
IN
Cheltenham Courseware for Trainers 1995-2003 No part of this document may be copied without written permission
from Cheltenham Courseware for Trainers unless produced under the terms of a courseware site license agreement with
Cheltenham Courseware for Trainers.
IN
All reasonable precautions have been taken in the preparation of this document, including both technical and nontechnical proofing. Cheltenham Courseware for Trainers and all staff assume no responsibility for any errors or
omissions. No warranties are made, expressed or implied with regard to these notes. Cheltenham Courseware for
Trainers shall not be responsible for any direct, incidental or consequential damages arising from the use of any material
contained in this document. If you find any errors in these training modules, please inform Cheltenham Courseware for
Trainers. Whilst every effort is made to eradicate typing or technical mistakes, we apologize for any errors you may
detect. All courses are updated on a regular basis, so your feedback is both valued by us and will help us to maintain the
highest possible standards.
TR
FO
FO
TR
IN
IN
TR
IN
IN
FO
TR
IN
IN
FO
IN
FO
TR
IN
1
2003 Cheltenham Courseware for Trainers
IN
When you have completed this learning module you will have seen how to:
Check for Northwind
Install Northwind
IN
About Northwind
Northwind is a sample database that is supplied with Access 2002. It contains product and
sales data for the fictitious company Northwind Traders.
It is recommended that Northwind be installed in order to follow the lessons in this
manual.
TR
FO
Installing Northwind
Insert the Microsoft Office XP CD-ROM in the CD-ROM drive.
Double-click Setup.
Note: If your computer has autorun enabled, you will be presented directly with the Microsoft
Office XP setup screen.
Select Add or Remove Features.
Click Next.
Under Features to Install, select the Microsoft Access for Windows subtree.
2
2003 Cheltenham Courseware for Trainers
Click Update.
Once the installer completes, click OK to finish.
TR
IN
IN
FO
Review Questions
Note: Once the Northwind database is installed, search for it again and open it.
3
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
When you have completed this learning module you will have seen how to:
Understand SQL Statements
Understand SQL Conventions
Understand SQL Syntax
Use SELECT Statement
Select All Data
Select Specific Data
Select Conditional Data
Use ORDER BY Statement
Sort Data
Use Aggregate Functions
Calculate Data
Use GROUP BY Statement
Group Data
Create a Subquery with Equality
Create a Subquery with an Aggregate Function
Use ANY and ALL Statements
Understand SQL Joins
Create a Simple Join
Sort a Join
Create Outer Join
Create Left Outer Join
Create Right Outer Join
Create Full Outer Join
Use INSERT Statement
Understand INSERT Statement Rules
Insert Data using VALUES
Insert Data using Defaults
Insert Data using SELECT
Use UPDATE Statement
Update All Rows
Update Specific Rows
Update Multiple Columns
Use DELETE FROM Statement
Delete Specific Rows
Delete All Rows
View SQL in Access 2002
Understand SQL in Access 2002
Write SQL Specific Queries
Find Help on SQL Queries
4
2003 Cheltenham Courseware for Trainers
IN
IN
TR
FO
SELECT
FROM
[predicate] { * | [column_name] [, ] }
table_name
condition]
column_name]
group_condition]
column_name] ;
5
2003 Cheltenham Courseware for Trainers
SELECT
FROM
*
staff;
TR
IN
IN
position
Manager
Snr Asst
Deputy
Assistant
Manager
Assistant
bno
B5
B3
B3
B7
B3
B5
FO
salary
30000.00
12000.00
18000.00
9000.00
24000.00
9000.00
6
2003 Cheltenham Courseware for Trainers
salary
30000.00
12000.00
18000.00
9000.00
24000.00
9000.00
SELECT
FROM
lname
White
Beech
Ford
Howe
Brand
Lee
O
N
col4
2500.00
1000.00
1500.00
750.00
2000.00
750.00
FO
TR
lname
White
Beech
Ford
Howe
Brand
Lee
IN
IN
SELECT
FROM
lname
White
Beech
Ford
Howe
Brand
Lee
monthly_salary
2500.00
1000.00
1500.00
750.00
2000.00
750.00
7
2003 Cheltenham Courseware for Trainers
IN
lname
White
Howe
Brand
Lee
position
Manager
Assistant
Manager
Assistant
FO
SELECT
FROM
WHERE
lname
Beech
Howe
Lee
position
Snr Asst
Assistant
Assistant
salary
30000.00
12000.00
18000.00
24000.00
position
Manager
Snr Asst
Deputy
Manager
TR
lname
White
Beech
Ford
Brand
IN
SELECT
FROM
WHERE
salary
12000.00
9000.00
9000.00
8
2003 Cheltenham Courseware for Trainers
Sorting Data
Example 9: Single Column Ordering
(list salaries for all staff, arranged in descending order of salary).
salary
30000.00
24000.00
18000.00
12000.00
9000.00
9000.00
SELECT
FROM
ORDER BY
position
Snr Asst
Manager
Deputy
Assistant
Assistant
Manager
FO
TR
lname
White
Brand
Ford
Beech
Howe
Lee
IN
IN
SELECT
FROM
ORDER BY
9
2003 Cheltenham Courseware for Trainers
Calculating Data
Example 11: Use of COUNT(*)
(find the total number of staff that have salary of 9000).
COUNT(*) AS count
staff
salary = 9000;
IN
TR
IN
SELECT
FROM
WHERE
FO
avg
17000.00
Grouping Data
Example 14: Use of GROUP BY
(find number of staff in each branch and their total salaries).
SELECT
FROM
GROUP BY
ORDER BY
sum
54000.00
39000.00
9000.00
10
2003 Cheltenham Courseware for Trainers
SELECT
FROM
WHERE
lname
Beech
Ford
White
IN
A
Note: Inner SELECT finds branch number corresponding to branch at 163 Main St which is
(B3). Outer SELECT then retrieves details of all staff who work at this branch. The outer
SELECT then becomes:
TR
IN
SELECT
FROM
WHERE
position
Snr Asst
Deputy
Manager
FO
SELECT
FROM
WHERE
Note: You cannot write WHERE salary > AVG(salary). Instead, you can use Subquery to
find the average salary (17000), and then use outer SELECT to find those staff members with
a salary greater than this:
lname
White
Ford
Brand
position
Manager
Deputy
Manager
salary
30000.00
18000.00
24000.00
SELECT
FROM
WHERE
11
2003 Cheltenham Courseware for Trainers
SELECT
FROM
WHERE
Note: Inner SELECT produces the set {12000, 18000, 24000} and outer SELECT lists those
staff whose salaries are greater than any of the values in this set.
FO
lname
White
Ford
Brand
position
Manager
Deputy
Manager
salary
30000.00
18000.00
24000.00
TR
IN
IN
SELECT
FROM
WHERE
lname
White
position
Manager
salary
30000.00
12
2003 Cheltenham Courseware for Trainers
IN
SELECT
FROM
WHERE
Note: To obtain correct rows, include only those rows from both tables that have identical
values in the rno columns: r.mo = v.mo. These two columns are the matching columns for
two tables.
lname
Stewart
Stewart
Stewart
Tregear
Kay
TR
IN
pno
PG36
PA14
PG4
PA14
PG4
FO
Sorting a Join
Example 20: Sort a Join
(for each branch, list names of staff who manage properties).
SELECT
FROM
WHERE
ORDER BY
O
N
lname
Ford
Ford
Beech
Beech
Lee
Howe
pno
PG4
PG16
PG21
PG36
PL94
PA14
13
2003 Cheltenham Courseware for Trainers
bcity
Glasgow
Bristol
London
IN
BRANCH1
bno
B3
B4
B2
SELECT
FROM
WHERE
b.*, p.*
branch1 b, property_for_rent1 p
b.bcity = p.pcity;
OR
SELECT
FROM
ON
b.*, p.*
branch1 b INNER JOIN property_for_rent1 p
b.bcity = p.pcity;
pno
PG4
PL94
FO
TR
IN
PROPERTY_FOR_RENT1
pno
pcity
PA14
Aberdeen
PL94
London
PG4
Glasgow
pcity
Glasgow
London
Note: The result table has two rows where the cities are the same. There are no rows
corresponding to the branches in Bristol and Aberdeen.
SELECT
FROM
ON
b.*, p.*
branch1 b LEFT JOIN property_for_rent1 p
b.bcity = p.pcity;
pno
PG4
NULL
PL94
pcity
Glasgow
NULL
London
Note: Left outer join includes those rows of first (left) table that are unmatched with rows
from second (right) table. Columns from second table are filled with NULLs.
14
2003 Cheltenham Courseware for Trainers
pcity
Aberdeen
Glasgow
London
Note: Right outer join includes those rows of second (right) table that are unmatched with
rows from first (left) table. Columns from first table are filled with NULLs.
IN
pno
PA14
PG4
PL94
b.*, p.*
branch1 b RIGHT JOIN property_for_rent1 p
b.bcity = p.pcity;
IN
SELECT
FROM
ON
b.*, p.*
branch1 b FULL JOIN property_for_rent1 p
b.bcity = p.pcity;
pcity
Aberdeen
Glasgow
NULL
London
Note: Full outer join includes those rows that are unmatched in both tables. Unmatched
columns are filled with NULLs.
FO
pno
PA14
PG4
NULL
PL94
TR
SELECT
FROM
ON
Inserting Data
INSERT INTO
VALUES
table_name [ (column_list) ]
(data_value_list);
Column_list is optional.
If omitted, SQL assumes a list of all columns in their original order.
Any columns omitted must be declared as NULL when the table is created, unless DEFAULT
is specified when creating the column.
15
2003 Cheltenham Courseware for Trainers
staff
(SG16, Alan, Brown, Assistant, B3, 8300);
IN
INSERT INTO
VALUES
INSERT INTO
VALUES
IN
INSERT INTO
VALUES
TR
OR
staff
(SG16, Alan, Brown, Assistant, B3, NULL);
table_name [ (column_list) ]
;
FO
INSERT INTO
SELECT
INSERT INTO
staff_prop_count
(SELECT s.sno, fname, lname, COUNT(*)
FROM staff s, property_for_rent p
WHERE s.sno = p.sno
GROUP BY s.sno, fname, lname);
16
2003 Cheltenham Courseware for Trainers
Updating Data
Using UPDATE Statement
Data is updated in the table using the UPDATE statement.
SET clause specifies names of one or more columns that are to be updated.
WHERE clause is optional. If omitted, named columns are updated for all rows in table. If
specified, only those rows that satisfy search_condition are updated.
New data_value(s) must be compatible with the data type for the corresponding column.
IN
IN
[WHERE
table_name
column_name1 = data_value1
[, column_name2 = data_value2 ]
search_condition];
UPDATE
SET
staff
salary = salary*1.03;
TR
UPDATE
SET
Note: WHERE clause finds rows that contain data for Managers. Update is applied only to
these particular rows.
FO
staff
salary = salary*1.05
position = Manager;
UPDATE
SET
WHERE
UPDATE
SET
WHERE
17
2003 Cheltenham Courseware for Trainers
Deleting Data
Using DELETE FROM Statement
Data is removed from the table using the DELETE FROM statement.
DELETE FROM
WHERE
staff
position = Manager;
DELETE FROM
staff;
TR
IN
IN
Search_condition is optional. If omitted, all rows are deleted from the table.
This does not delete the table.
If search_condition is specified, only those rows that satisfy the condition are deleted.
table_name
search_condition];
DELETE FROM
[WHERE
FO
18
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
19
2003 Cheltenham Courseware for Trainers
This will open the Design View for the selected query:
While in Design View, from the main menu, choose View > SQL View.
This will open the SQL View:
FO
TR
IN
IN
SELECT
FROM
WHERE
The column names that contain spaces must be enclosed in square brackets [ ].
If the column name does not contain spaces, square brackets are not needed.
20
2003 Cheltenham Courseware for Trainers
TR
In the New Query dialog box, select Design View and click OK:
FO
IN
IN
21
2003 Cheltenham Courseware for Trainers
In the Show Table dialog box, click Close without adding any table:
From the main menu, choose Query > SQL Specific > then select the type of query you
want to create, Union, Pass-Through or Data Definition:
FO
TR
IN
IN
22
2003 Cheltenham Courseware for Trainers
In the Contents page, navigate to Queries > SQL Queries to list all subjects on this issue:
FO
TR
IN
IN
23
2003 Cheltenham Courseware for Trainers
IN
IN
A
FO
TR
Review Questions
N
T
R
FO
IN
TR
IN
25
2003 Cheltenham Courseware for Trainers
Automating Tasks
TR
IN
IN
When you have completed this learning module you will have seen how to:
Understand Macros
Use the Macro Window Toolbar
Create New Macros
Run a Macro
Step Through a Macro
Modify a Macro
Add Conditions to Macros
Use the Expression Builder to Create Conditions
Run Macros with Conditions
Attach Macros to a Form
Attach Macros to a Report
Filter Records
Comment Macros
Print Macro Definitions
View Macro Definitions
FO
Understanding Macros
Macros present a way of programming Access 2002 to perform a variety of tasks and actions.
Macros are easy to create - you simply select from the list of predefined actions and their
arguments.
Each action performs a specific operation.
Each action can have arguments, which specify additional information for that action.
Macros are best for performing simple tasks, like opening and closing forms, running reports,
and displaying custom toolbars.
Macros are individual Access objects listed in the Macros page in the Database window:
26
2003 Cheltenham Courseware for Trainers
Once macros are created, you can attach them to an Event property of any object in your
database.
Note: Access macros differ from other macros in Office XP and other applications, because
it does not record the keystrokes.
IN
TR
IN
FO
27
2003 Cheltenham Courseware for Trainers
Insert Rows button inserts one or more blank rows in the grid above the selected row:
TR
IN
IN
FO
Single Step button runs the macro one action at a time, displaying intermediate information:
28
2003 Cheltenham Courseware for Trainers
Creating Macros
FO
TR
IN
IN
29
2003 Cheltenham Courseware for Trainers
The Comment column contains optional comments used for documenting macros.
Once you select an Action, the pane on the bottom area displays the associated Action
Arguments:
Depending on the selected action, some arguments are required and some are optional.
For example, for the Close action, you can select an Object Type, such as Form:
FO
TR
IN
IN
30
2003 Cheltenham Courseware for Trainers
Once the Object Type is selected, you can select an Object Name. Access will list all
available Forms in the current database:
The last argument is the Save option (required). Here, you can select what type of actions
Access should perform at the end:
FO
TR
IN
IN
31
2003 Cheltenham Courseware for Trainers
Note: The information pane at the bottom-right area of the Macro window displays
information about the part of the macro sheet that is currently active. If you need more
information, press the F1 key for help.
Close the Macro window and click Yes to save changes for your new macro:
In the Save As dialog box, enter the name in the Macro Name field, then click OK:
The new macro is now available in the Macros tab of the Database window:
FO
TR
IN
IN
32
2003 Cheltenham Courseware for Trainers
TR
IN
IN
To run a macro:
Select the macro name from the Macros page of the Database window.
Click Run button:
Running a Macro
Once you have created a macro, you will have to run it and see if it works.
You can run the whole macro at once, or you can run step-by-step through the macro.
If you get an error while running a macro, make sure you run through the macro step-by-step
to find where the error occurs, and fix it.
FO
OR right-click the macro name and choose Run from the popup menu:
33
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
34
2003 Cheltenham Courseware for Trainers
The Step button moves to the next action, if there are more actions in the macro. This is the
default option.
The Halt button stops macro execution.
The Continue button stops the Single Step mode and runs the rest of the macro without
stopping.
Modifying Macros
TR
IN
IN
Modifying a Macro
Select the name of the macro you want to modify from the Macros page of the Database
window.
Click Design button to open the Macro window.
Use the Insert Rows toolbar button or the Insert menu command to add actions.
Use the Delete Rows toolbar button or the Edit menu command to delete actions.
Use the Cut, Copy, and Paste operations to edit a macro.
Use the Undo button to reverse the recent changes.
When you have finished editing the macro, Save it again.
Run and test your newly saved macro to make sure it works properly.
FO
By default, the condition only applies to the action on the same row in the macro sheet.
If the condition is not met, the next action (i.e. the next row) will be executed.
35
2003 Cheltenham Courseware for Trainers
To extend the condition to the next action, you must enter the ellipsis () in the Condition
column of the next row:
When debugging a macro, you can temporarily disable an action by entering False in the
Condition column:
FO
TR
IN
IN
36
2003 Cheltenham Courseware for Trainers
In the Expression Builder dialog box, create the logical expression (for example if the Total
Pages number is greater than 0) and click OK:
FO
TR
IN
IN
IN
IN
37
2003 Cheltenham Courseware for Trainers
FO
TR
Note: The MsgBox action has a condition [CurrentRecord]=0, meaning if no records are
returned for the selected letter, display a message. Then Access goes to the next action with
an ellipsis () ShowAllRecords that will show all records. Then Access continues to the
next action with an ellipsis () SetValue that will press in the All button.
38
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
39
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
40
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
41
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
42
2003 Cheltenham Courseware for Trainers
Choose the Macro name from the drop-down list of available macros (for example, Sales
Totals by Amount):
TR
Filtering Data
IN
IN
FO
Filtering Records
The Northwind sample database contains a macro that alphabetically filters the records in the
Customer Phone List form.
Open the Northwind database by selecting Help > Sample Databases > Northwind Sample
Database from the main menu.
In the Main Switchboard window, click on the Display Database Window button:
43
2003 Cheltenham Courseware for Trainers
In the Database window, click on the Macros tab, then select the Customer Phone List
macro and click on the Design button:
FO
TR
IN
IN
In the Comment column, you can see that this macro is attached to the Customer Phone List
form. In order to see how the macro works, we should run it first.
In order to run the macro, we have to open the form attached to the macro.
44
2003 Cheltenham Courseware for Trainers
Go back to the Database window, click on the Forms tab, and select Customer Phone List:
FO
TR
IN
IN
As you can see, the form has Alphabet buttons that will filter data when pressed. Only the
company names that start with a specified letter of the alphabet will be displayed.
45
2003 Cheltenham Courseware for Trainers
Click on the Design button to see the underlined programming for this form:
The row of Alphabetic buttons are actually an Option Group control named
CompanyNameFilters, which returns a value depending which button is selected.
If you open the Properties for this control, you will see that the macro Customer Phone
List.Alpha Button is attached to the After Update event. This means that the macro will run
when the user clicks one of the buttons in the option group.
Go back to the Customer Phone List macro sheet to see how this is done:
The Alpha Buttons macro applies a filter to the list, based on which button is pressed.
For example, if the A button is pressed, the macro will filter for company names that start with
FO
TR
IN
IN
46
2003 Cheltenham Courseware for Trainers
Now go back to the Customer Phone List macro sheet and scroll down to the last rows. In
the GoToControl action row, the stated condition is that if the current record count is greater
than 0, the records are displayed and the macro stops. The ellipsis () in the StopMacro
action row carries over the condition from the row above it:
However, if no records are returned by the filter (based on the condition if the current record
count equal to 0), the message will be displayed in the MsgBox action. When the user clicks
OK to close the message window, all records are displayed on the screen, as the ellipsis ()
in the ShowAllRecord action row carries over the condition from the row above it.
Furthermore, the next action row containing ellipsis () SetValue, will press in the All button
in the form:
TR
IN
IN
FO
Documenting Macros
Commenting Macros
To make programming and future updates easier, make sure you comment macros using the
Comment column in the macro sheet:
47
2003 Cheltenham Courseware for Trainers
Properties include the container, date created, date of last update, owner, and user.
Actions and Arguments include all the actions with their conditions, as well as values for all
arguments.
Permissions by User and Group include user permissions and group permissions.
IN
IN
FO
TR
48
2003 Cheltenham Courseware for Trainers
IN
IN
FO
TR
Review Questions
49
2003 Cheltenham Courseware for Trainers
TR
IN
IN
When you have completed this learning module you will have seen how to:
Use Visual Basic Modules
Convert Macros to Visual Basic Code
Understand Modules
Create Modules
Understand Module Declarations
Understand Procedures
Use Naming Rules
Declare Variables
Set Variable Scope
Declare Constants
Use Methods
Use Arguments
Customize the Visual Basic Editor Window
Set the Visual Basic Editor Options
Use Microsoft Visual Basic Help
Get Visual Basic Syntax Help
In this manual, we will cover only the basics of Visual Basic programming regarding its use in
Access 2002.
If you want to learn more about Visual Basic, refer to one of the numerous manuals and
books on this subject.
FO
50
2003 Cheltenham Courseware for Trainers
IN
IN
OR from the main menu, choose File > Save As and in the Save As dialog box, select
Module under the As filed. Click OK to continue:
Check the Add error handling to generated functions and Include macro comments
options and click Convert.
The Convert macros to Visual Basic message box shows the conversion is finished.
FO
TR
51
2003 Cheltenham Courseware for Trainers
This will create Converted Macro macro_name module, listed under the Modules folder
in the Visual Basic Editor window. Click on the module to see the code:
Scroll to the end of the code window to view the whole Visual Basic code:
FO
TR
IN
IN
52
2003 Cheltenham Courseware for Trainers
Newly created module is also listed in the Modules tab of the Database window:
TR
IN
IN
The Function statement represents the global module that is available to the entire
database.
The DoCmd statement performs macro action in a Visual Basic procedure.
Apostrophe () marks the comment line.
FO
Uncheck Add error handling to generated functions and check Include macro comments
options and click Convert.
The Convert macros to Visual Basic message box shows the conversion is finished.
53
2003 Cheltenham Courseware for Trainers
Click on the Code toolbar button to open the Visual Basic Editor window with the converted
macros code:
Scroll to the end of the code window to view the whole Visual Basic code:
FO
TR
IN
IN
The Sub statement represents the local code, stored with a form.
The DoCmd statement performs macro action in a Visual Basic procedure.
The Apostrophe () marks the comment line.
FOR USE AT THE LICENSED SITE(S) ONLY
Cheltenham Courseware for Trainers 1995-2003 - www.cctglobal.com
54
2003 Cheltenham Courseware for Trainers
IN
Uncheck Add error handling to generated functions and check the Include macro
comments option and click Convert.
The Convert macros to Visual Basic message box shows the conversion is finished.
TR
IN
Understanding Modules
The Visual Basic module consists of declarations and procedures.
Modules are used to create event procedures that execute when an event occurs.
There are two types of modules:
1. Module objects listed in the Modules page of the Database window.
2. Form and Report modules stored together with a form or report containing procedures
and functions associated with a single form or report.
FO
Creating Modules
Click on the Modules tab in the Database window.
Click on the New button:
55
2003 Cheltenham Courseware for Trainers
The new module, named Module1, opens up in the Visual Basic Editor window:
If you do not see the Option Explicit declaration, choose Tools > Options from the Visual
Basic Editor window main menu.
In the Options dialog box, click on the Editor tab and check the Require Variable
Declaration option. Click OK to continue:
TR
FO
IN
IN
56
2003 Cheltenham Courseware for Trainers
IN
IN
Understanding Procedures
Procedures consist of statements and methods.
A statement is a complete instruction to Visual basic and consists of keywords, operations,
variables, constants, and expressions.
TR
FO
Add prefixes to names that can indicate what type of item or variable they are:
- con used to indicate a constant
- int used to indicate an integer variable
- dte used to indicate a date variable
- str used to indicate a string variable
- rst used to indicate a recordset
- frm used to indicate a form
57
2003 Cheltenham Courseware for Trainers
You can declare several variables in the same statement, separated by commas.
In the above example, we have used prefixes to descriptively name the variables in order to
include their data type.
The last variable has no data type declaration, so the type is Variant.
TR
IN
IN
Declaring Variables
Variables are items with unique names that contain data that can be changed during
procedure execution.
You can specify the data type for each variable, or let Access assign the default Variant type.
A Variant type variable can contain string, date, time, Boolean, or numeric values.
The Dim statement is used to declare variables:
FO
Declaring Constants
Constants are items with unique names within which data cannot be changed during
procedure execution.
A constant data type can be a string or number value, another constant, or an expression.
The Const statement is used to declare constants and give them a value:
You can declare several constants in the same statement separated by commas.
In the above example, we have used prefix con to descriptively name the constants instead
of their data types.
You must assign a constant a value at the time of declaration.
58
2003 Cheltenham Courseware for Trainers
Methods have specific synax that indicates the object and the action:
IN
IN
Using Methods
Methods are actions that database objects can perform, or procedures that apply to
database objects.
Access 2002 modules can use nearly 160 methods that apply to different database objects.
Some examples of methods are:
- Opening or closing a form.
- Sounding a beep when specific event occurs.
- Going to a specific field in a form.
- Filtering records for a report.
- Printing multiple copies of a report, etc.
In the example above, the method moves the cursor to the Company Name field in the
Customer Phone List form.
TR
Using Arguments
Arguments are used in the sub or function procedure calls.
They are optional, depending on the procedure.
There are two ways you can list arguments: in a procedure order, or by name.
For example, this is the sub procedure with argument list:
When you run the procedure, you can list the arguments in the same order as the procedure:
Or, you can list the arguments using their names in any order:
FO
59
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
60
2003 Cheltenham Courseware for Trainers
From the main menu, choose View > then select the elements you want to see in the editor
window:
In the Code view, the Object list box displays a list of all controls in the form or report:
FO
TR
IN
IN
In the Code view, the Procedure list box displays a list of all procedures in the module
object:
61
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
62
2003 Cheltenham Courseware for Trainers
Click the Editor Format tab to specify the appearance of the different types of text in the
editor window:
Click the General tab to set Form Grid Settings, Error Trapping and Compile options:
FO
TR
IN
IN
TR
IN
IN
63
2003 Cheltenham Courseware for Trainers
If you get the following message, you must install the Microsoft Visual Basic Help first. Click
on the Yes button, and follow the installation instructions:
FO
64
2003 Cheltenham Courseware for Trainers
The Microsoft Visual Basic Help window opens up. Here you can find extensive reference
for various Visual Basic topics:
FO
TR
IN
IN
65
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
OR right-click inside the statement and choose desired help from the popup menu:
66
2003 Cheltenham Courseware for Trainers
List Properties/Methods lists all properties and methods available for selected statement:
List Constants lists all intrinsic constants that are valid for a specific item in the argument
list.
Quick Info displays the complete syntax with the current item highlighted in bold:
Parameter Info displays the complete syntax with the current parameter highlighted in bold:
Complete Word automatically completes the word when you begin typing.
Review Questions
TR
IN
IN
FO
67
2003 Cheltenham Courseware for Trainers
TR
IN
IN
When you have completed this learning module you will have seen how to:
Use Data Access Pages
Create pages using the AutoPage
Create pages using the Page Wizard
Create pages using an Existing HTML Document
Create pages using the Design View
Choose a Theme
Add Text
Add Controls
Format Text and Labels
Align Content
Size Content
Add Images
Add Backgrounds
Sort Data
Summarize Data
Add a New Record
Delete a Record
Customize Navigation Bar
Protect Fields
FO
68
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
69
2003 Cheltenham Courseware for Trainers
Choose the table or query where the objects data comes from by selecting it from the
drop-down list:
FO
TR
IN
IN
70
2003 Cheltenham Courseware for Trainers
At the bottom of the data access page, you will notice the Record Navigation Bar.
From the main menu, choose File > Save to open the Save As Data Access Page dialog
box:
Select the location and name the data access page and click Save.
The new data access page is listed in the Pages section of Database window:
FO
TR
IN
IN
71
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
72
2003 Cheltenham Courseware for Trainers
IN
IN
FO
TR
OR from the Pages page of Database window, double-click on Create data access page by
using wizard:
73
2003 Cheltenham Courseware for Trainers
Under the Available Fields list, select one field and click [>] button to transfer it to the
Selected Fields:
FO
TR
IN
IN
74
2003 Cheltenham Courseware for Trainers
If you want to select all the fields, click on the [>>] button:
If you want to remove a field from the Selected Fields list, select the field and click on the [<]
button.
Repeat the same steps for other tables and/or queries from which you want to add fields to
the data access page. Once you have finished selecting fields, click Next button to continue.
IN
IN
FO
TR
75
2003 Cheltenham Courseware for Trainers
A new grouping level will be added to the data access page. If you want to choose the
grouping interval, click on the Grouping Options button:
The Grouping Intervals dialog box allows you to choose how you want to group the grouplevel field(s). Click OK to accept change or Cancel to close the dialog box:
FO
TR
IN
IN
76
2003 Cheltenham Courseware for Trainers
The default sorting order is ascending. If you want to change the sorting order, click the
Ascending button to change it into Descending:
FO
TR
IN
IN
Once you select all of the sorting fields, click on the Next button to continue.
77
2003 Cheltenham Courseware for Trainers
The last page of the wizard allows you to add a title to the page and set other options:
Open the page option takes you directly to the Page view.
Modify the pages design option takes you directly to the Design view.
Do you want to apply a theme to your page option allows you to add predefined styles to
the data access page.
Display Help on working with the page option gives you help while working on the page
design.
Click Finish. Depending on what you have selected, the page will be opened in either the
Page view or the Design view. This is a sample of the page in the Design view:
FO
TR
IN
IN
78
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
OR from the Pages page of the Database window, double-click on Edit Web page that
already exists:
79
2003 Cheltenham Courseware for Trainers
This will open the Locate Web Page dialog box where you can select the already existing
web page. Click Open to continue:
FO
TR
IN
IN
80
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
OR from the Pages page of the Database window, double-click on Create data access page
in Design view:
This will open the blank page in Design view. Simply drag and drop fields from the Field
List window to the page grid and use the Toolbox to add controls to the data access page:
TR
IN
IN
81
2003 Cheltenham Courseware for Trainers
FO
Choosing a Theme
In the Database window, click on the Pages tab.
Select the data access page you want to modify and click the Design button:
82
2003 Cheltenham Courseware for Trainers
Once the page is opened in Design view, from the main menu, choose Format > Theme.
This will open the Theme dialog box:
FO
TR
IN
IN
Under the Choose a Theme list, select the theme you want, and you will see an example in
the right pane:
FO
TR
IN
IN
83
2003 Cheltenham Courseware for Trainers
Note: If the theme you selected is not installed, the Install button is displayed on the right
pane. Click on the Install button to install the selected theme from the Office XP CD.
Vivid Colors option displays the text links and button colors with a brighter color scheme.
Active Graphics option refers to Animated GIF files.
Background Image option activates or deactivates the background image.
Set Default button sets the current theme as the default theme for all new data access
pages.
Click OK to apply the theme.
84
2003 Cheltenham Courseware for Trainers
TR
IN
IN
Adding Text
You can add text to the page areas above or below the grid section header.
Simply position the insertion point on the page and type the text:
The Grid section is the area generally used for data-related text and controls, as the
absolute positioning of the grid allows you to place fields in a structured layout.
FO
Adding Controls
Controls are objects that can be placed on data access pages that display data, perform
actions, or can be used for visual display.
The Toolbox contains controls that you can add to the page design:
85
2003 Cheltenham Courseware for Trainers
Click on a Button in the Toolbox and then click on the page to add this control to the page:
BUTTON
CONTROL
DESCRIPTION
Label
Bound Span
IN
Text Box
Scrolling Text
Option Button
Check Box
Command Button
Expand
TR
Drop-down List
List Box
IN
Option Group
Record Navigation
FO
Office PivotTable
Office Chart
Office Spreadsheet
Hyperlink
Movie
Image
Line
Hyperlink Image
Rectangle
86
2003 Cheltenham Courseware for Trainers
TR
IN
Aligning Content
In the page Design view, select the content you want to align.
From the main menu, choose Format > Align > alignment option:
IN
FO
OR right-click on the selection and select Align > alignment option from the popup menu:
87
2003 Cheltenham Courseware for Trainers
IN
IN
Sizing Content
In the page Design view, select the content you want to resize.
From the main menu, choose Format > Size > sizing option:
TR
OR right-click on the selection and select Size > sizing option from the popup menu:
FO
Adding Images
From the Toolbox, click on the Image button.
Place the Image control on the page:
This will open the Insert Picture dialog box. Select the image file you want to place and click
Insert.
88
2003 Cheltenham Courseware for Trainers
To change various image properties, right-click on the image and select Element Properties
from the popup menu. Under the Format tab, you can modify image border properties,
height, width, margins, etc:
IN
IN
TR
Adding Backgrounds
Data access page background can be displayed with flat color or a tiled image.
FO
89
2003 Cheltenham Courseware for Trainers
If you cannot see the whole text in the property box, right-click on the box and choose Zoom
from the popup menu to zoom it up:
FO
TR
IN
IN
Sorting Data
In the page Design view, select the group section bar.
Right-click the selection and choose Group Level Properties from the popup menu.
In the properties dialog box, enter the name of the field you want the records to be sorted by
in the DefaultSort property box:
As usual, if the field name includes a space, make sure to enclose the name with square
brackets [ ].
By default, the records are sorted in the ascending order. If you want to switch to descending
order, enter a space after the field name and then type DESC:
90
2003 Cheltenham Courseware for Trainers
IN
Summarizing Data
The AutoSum feature in the data access page Design view allows you to quickly add
calculated summaries to a page.
In the page Design view, select the bound span control you want to summarize:
Click on the AutoSum tool from the toolbar and choose from the list:
FO
TR
IN
91
2003 Cheltenham Courseware for Trainers
In data access pages, much the same as in the forms, you can use the Record Navigation
Bar to add, edit and delete records.
IN
IN
FO
TR
Deleting a Record
From the main menu, choose File > Web Page Preview.
Use the Next and Previous buttons on the Record Navigation Bar, to locate the record you
want to remove.
Click on the Delete button to remove the record:
If the data access page does not display the changes, refresh the browser window by
pressing the F5 key.
92
2003 Cheltenham Courseware for Trainers
IN
Right-click on selection and choose Navigation Buttons from the popup menu:
Uncheck any button you want to remove from the Record Navigation Bar. For example,
uncheck the New button to disable adding new records:
FO
TR
IN
If you want to add the control back to the Navigation bar, check the button again.
93
2003 Cheltenham Courseware for Trainers
Review Questions
TR
IN
IN
Protecting Fields
If you want to protect only certain fields from editing, you can change their properties.
In the page Design view, select the field you want to protect and open its properties:
FO
N
T
R
FO
IN
TR
IN
95
2003 Cheltenham Courseware for Trainers
IN
When you have completed this learning module you will have seen how to:
Convert Databases
Convert Database Objects
Enable Databases
Share Databases across various Access versions
Convert an Access 2002 database to an Access 97 database
Convert an Access 2002 database to an Access 2000 database
IN
FO
TR
Converting Databases
Before any conversion, first you should create a backup copy of your Access database.
If opened, close the database you want to convert.
If the database is used in a multiple-user environment, make sure that all users have closed
the database.
In an empty Access 2002 window, choose Tools > Database Utilities > Convert Database
> To Access 2002 File Format from the main menu.
In the Database to Convert From dialog box, select the database to be converted to Access
2002, then click on the Convert button:
96
2003 Cheltenham Courseware for Trainers
In the Convert Database Into dialog box, enter the database name in the File name field,
and then click on the Save button:
You will see the warning dialog box. Click on the OK button to proceed:
Note: If your Access database has linked tables, make sure these tables remain in the
original folder, so that the converted database can find them. If Access cannot find linked
databases, the converted database will not work properly. Linked tables are not converted
automatically; so you must convert them manually.
FO
TR
IN
IN
97
2003 Cheltenham Courseware for Trainers
In the Import Objects dialog box, select the object(s) and click on the OK button:
FO
TR
IN
IN
Enabling Databases
In some cases, you might want to open an older-version Access database in Access 2002
without converting it first. This may be necessary if some of the database users do not have
Access 2002.
By enabling a database, you can still add, modify and delete records, but you cannot modify
any existing objects or add new objects using Access 2002.
98
2003 Cheltenham Courseware for Trainers
TR
IN
IN
To enable a Database:
From the main menu, choose File > Open.
Select an older-version Access database and click Open.
In the Convert/Open Database dialog box, select the Open Database option and click OK:
Note: You cannot import or link an Access 2002 table into an enabled database.
FO
99
2003 Cheltenham Courseware for Trainers
In the Create Back-end Database dialog box, the File name will be automatically named
with suffix _be. Keep that name and click on the Split button:
FO
TR
IN
IN
Once you have split the database into front-end and back-end, delete the back-end database.
100
2003 Cheltenham Courseware for Trainers
From the main menu, choose Tools > Database Utilities > Linked Table Manager.
Link the new Access 2002 front-end to the tables in the older-version (back-end) database.
Click the Select All button, and then OK to link all tables:
IN
IN
TR
FO
101
2003 Cheltenham Courseware for Trainers
In the Project Properties dialog box, select the Protection tab and enter the password in
the Password field, then click OK:
FO
TR
IN
IN
102
2003 Cheltenham Courseware for Trainers
Review Questions
FO
TR
IN
IN
103
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
When you have completed this learning module you will have seen how to:
Set Access 2002 Options
Set View Options
Set General Options
Set Edit/Find Options
Set Keyboard Options
Set Datasheet Options
Set Forms/Reports Options
Set Pages Options
Set Advanced Options
Set International Options
Set Spelling Options
Set Tables/Queries Options
Set AutoCorrect Options
Exclude AutoCorrect Rules
Remove AutoCorrect Rules
Add Replace AutoCorrect Rules
Remove Replace AutoCorrect Rules
Open Customize Dialog Box
Customize Toolbars
Create Custom Toolbars
Remove Toolbars
Customize Commands
Add Buttons to Toolbars
Remove Buttons from Toolbars
Customize Options
104
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
105
2003 Cheltenham Courseware for Trainers
The cursor will change to include the question mark, ?. Simply click on the option name or
option selection item (checkbox, radio button, drop-down list, etc):
Now you can read the information for the selected option:
FO
TR
IN
IN
106
2003 Cheltenham Courseware for Trainers
If you have made any changes to the current tab options, you can apply those changes by
clicking on the Apply button. Then you can click on another tab to view/change more
options.
Otherwise, you can click on the OK button to apply changes and close the Options dialog
box.
The Show group allows you to specify what features you will see when you startup Access
2002:
Status bar option shows or hides the status bar at the bottom of the screen.
Startup Task Pane option shows or hides the opening Access side pane.
New object shortcuts option shows or hides shortcuts in the Database window that you can
use to start a new database object. For example, in the Tables page, the shortcut named
Create table in Design view will create a table in the Design view.
Hidden objects option shows or hides objects in the Database window that have the Hidden
property. If shown, objects will appear as dimmed icons.
System objects option shows or hides system tables as dimmed icons.
Windows in Taskbar option shows a button on the Windows taskbar for every open
database object or window. You must have Internet Explorer Active Desktop feature installed
for this option to work.
FO
TR
IN
IN
The Show in Macro Design group allows you to change what you see while working with
macros:
Names column option displays the Macro Name column in a macro sheet.
Conditions column option displays the Condition column in a macro sheet.
107
2003 Cheltenham Courseware for Trainers
The Click options in database window group controls how you work in the Database
window:
Single-click open option opens an object with single mouse click.
Double-click open option opens an object with a double mouse click. This is the default
setting.
The Print margins group allows you to change the margins compatible with your printer and
paper size: Left margin, Right margin, Top margin, and Bottom margin.
Recently used file list option specifies how many files are displayed when you choose File
from the main menu, or when the opening Task pane appears.
Provide feedback with sound option activates sound alerts.
Compact on Close option automatically compacts and repairs the database upon closing.
Remove personal information from this file option removes your name, company name or
any other personal information.
Default database folder option specifies the default folder where you will save new
databases.
FO
TR
IN
IN
The Use four-digit year formatting group allows you to apply the default format to This
database or All databases.
The Name AutoCorrect group allows you to correct any problems that occur when you make
changes in an object:
- Track name AutoCorrect info option stores the information it needs to correct naming
errors.
- Perform name AutoCorrect option repairs naming errors as they occur.
- Log name AutoCorrect changes option generates a log named AutoCorrect Log that
contains the changes.
108
2003 Cheltenham Courseware for Trainers
New database sort order option allows you to choose from a list of 15 languages that
change the default alphabetic sort order for new databases.
Web Options opens the dialog box where you can change the default Appearance for both
the Hyperlink color and the Followed hyperlink color. You can also specify if you want to
Underline hyperlinks:
TR
IN
IN
FO
109
2003 Cheltenham Courseware for Trainers
The Default find/replace behavior group specifies the extent of the search:
Fast search option searches the current field only and matches the entire field.
General search option searches all the fields and matches any part of the field.
Start of field search option searches the current field and matches only the beginning
characters in the field.
The Confirm group displays the message requiring confirmation from the user:
Record changes option requires confirmation when a record changes.
Document deletions option requires confirmation when you delete a database object.
Action queries option requires confirmation when you run an action query.
The Filter by form defaults for [current database] Show list of values in group allows you
to limit or expand the size of the value list displayed in the Filter By Form window:
Local indexed fields option limits the value list to the indexed fields in the current database.
Local nonindexed fields option includes the non-indexed fields in the current database.
ODBC fields option includes fields in a linked table in an external source.
Dont display lists where more than this number of records read option sets the
maximum number of records to be used to generate the list of unique values for the field.
IN
IN
FO
TR
The Move after enter group controls what happens when you press the ENTER key:
Dont move option keeps the insertion point in the current field.
Next field option moves the insertion point to the next field.
Next record option moves the insertion point to the next record in the table or form.
110
2003 Cheltenham Courseware for Trainers
The Behavior entering field group controls what happens when the insertion point enters
the field:
Select entire field option selects all of the characters in the field.
Go to start of field option moves the insertion point in front of the first character in the field
without selecting any characters.
Go to end of field option moves the insertion point to the end of the field after the last
character without selecting any characters.
IN
The Arrow key behavior group controls what happens when you press RIGHT ARROW and
LEFT ARROW keys:
Next field option moves the insertion point to the next field when you press the RIGHT
ARROW key or previous field when you press the LEFT ARROW key.
Next character option moves the insertion point to the next character when you press the
RIGHT ARROW key or to the previous character when you press the LEFT ARROW key.
IN
Cursor stops at first/last field option locks the inserting point within the current record and
stops the RIGHT ARROW and LEFT ARROW keys from moving the insertion point.
FO
TR
The Default colors group allows you to change the colors of the following:
Font option specifies the font color. Default setting is Black.
Background option specifies the background color. Default setting is White.
Gridlines option specifies the gridlines color. Default setting is Silver.
111
2003 Cheltenham Courseware for Trainers
The Default gridlines showing group allows you to show or hide the following:
Horizontal option shows or hides the horizontal gridlines in the datasheet.
Vertical option shows or hides the vertical gridlines in the datasheet.
Default column width option specifies the width of the columns in a new datasheet.
The Default cell effect group specifies the cell effect from Flat, Raised or Sunken.
IN
IN
FO
TR
Form template option specifies an existing form template for new designs.
Report template option specifies an existing report template for new designs.
Always use event procedures option takes you directly to the VB Editor window when you
click the Build button in the property sheet.
The Selection behavior group relates to the results of dragging a rectangle in the design
view to select controls.
Partially enclosed option selects all controls with any part within the drawn rectangle.
Fully enclosed option selects only controls fully within the drawn rectangle.
112
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
113
2003 Cheltenham Courseware for Trainers
Command-line arguments option specifies values you want the Command function to
return.
OLE/DDE timeout (sec) option specifies the time-period after which Access will re-attempt to
perform OLE or DDE operations.
Refresh interval (sec) option specifies the time-period for updating DDE links if Enable
DDE refresh option is checked. Enter a value between 1 and 32,766.
Number of update retries option specifies the number of times Access tries to save a
changed record locked by another user. Enter a value between 0 and 10.
ODBC refresh interval (sec) option specifies the time-period after which Access refreshes
records you are accessing through ODBC connection. Enter a value between 1 and 32,766.
Update retry interval (msec) option specifies the time-period after which Access tries to
save a changed record locked by another user. Enter a value between 0 and 1000.
The DDE operations group controls how the database interacts with other applications:
Ignore DDE requests option ignores Dynamic Data Exchange (DDE) requests from external
sources.
Enable DDE refresh option allows DDE links.
FO
TR
IN
IN
Default File Format option allows you to choose between Access 2000 and Access 2002 as
a default file format for new databases.
The Default open mode group allows you to choose how you work with the database on the
network:
Shared option allows others to open the database at the same time you have it opened.
Exclusive option gives you sole access to the database.
The Default record locking group allows you to choose how the database behaves while
shared on the network:
FOR USE AT THE LICENSED SITE(S) ONLY
Cheltenham Courseware for Trainers 1995-2003 - www.cctglobal.com
114
2003 Cheltenham Courseware for Trainers
Open databases using record-level locking option locks only one row or record instead of
locking an entire page that may have several records.
The Default direction group allows you to choose from two directions of the text:
Left-to-right option starts entering data in the left most column and places the next data in
the column to the right, etc.
Right-to-left direction option starts entering data in the right most column and places the
next data in the column to the left, etc.
FO
TR
IN
No locks option does not lock records while they are being edited.
All records option locks records in a form or datasheet as long as the form or datasheet is
open.
Edited record option locks only the record currently being edited.
IN
The General alignment group gives you a choice between two modes:
Interface mode option sets General alignment consistent with the user interface language.
For example, if the direction is left-to-right, the text is left-aligned.
Text mode option sets General alignment according to the direction of the first languagespecific characters it encounters.
The Cursor movement group controls the cursor moves within bidirectional text that has
various languages in the same sentence:
Logical option moves cursor within bidirectional text according to the direction of the
language it is encountering. For example, for English words the insertion point moves left-toright, for Arabic words the insertion point moves right-to-left.
Visual option moves cursor within bidirectional text by moving to the next adjacent character.
Use Hijri Calendar option to change the setting to the Middle Eastern calendar.
115
2003 Cheltenham Courseware for Trainers
The Language-specific group options are specific and apply to different languages.
AutoCorrect Options will be discussed later in this manual.
FO
TR
IN
IN
116
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
The Run permissions group specifies if others are permitted to view data retrieved by
queries or to run action queries:
Owners option allows all users to view or run the query, but only the owner can edit query.
Users option applies the permissions defined for that classification of user.
The SQL Server Compatible Syntax (ANSI 92) group formats queries exclusively in ANSI
92 standard syntax:
This Database option applies formatting for the current database.
Default for new databases option applies formatting for all new databases.
117
2003 Cheltenham Courseware for Trainers
IN
FO
TR
IN
OR
118
2003 Cheltenham Courseware for Trainers
IN
IN
In the Dont capitalize after field, type the abbreviation with the period at the end.
Click on the Add button to add this rule.
FO
TR
In the Dont correct field, type the word you want to add.
Click on the Add button to add this rule.
119
2003 Cheltenham Courseware for Trainers
In the Replace field, type a commonly misspelled word, or a word you want to use as a
shortcut to generate another word or symbol.
In the With field, type the correctly spelled word, or the wanted word or symbol.
Click Add button.
Click OK to close the AutoCorrect dialog box.
TR
IN
IN
FO
120
2003 Cheltenham Courseware for Trainers
IN
IN
FO
TR
Customizing Toolbars
Using any of the methods described above open the Customize dialog box.
Click on the Toolbars tab:
This will list all available Toolbars, both built-in and custom.
Check the check box for any toolbar you want displayed.
Uncheck the check box for any toolbar you want to hide.
Click Close when done.
121
2003 Cheltenham Courseware for Trainers
IN
FO
TR
IN
122
2003 Cheltenham Courseware for Trainers
Make sure that the new toolbar is selected, and click the Properties button:
FO
TR
IN
IN
Toolbar Name option displays the name of the toolbar. You can edit the name here.
123
2003 Cheltenham Courseware for Trainers
Type option allows you to choose what type of custom bar you want to create:
Menu Bar
Toolbar
Popup
Docking option specifies what kind of docking is allowed for this custom bar:
Allow Any
Cant Change
No Vertical
No Horizontal
Show on Toolbars Menu option displays the toolbar name in the list or popup menu.
Allow Customizing option allows changes to the toolbars appearance or behavior.
Allow Resizing option allows resizing of the floating toolbar.
Allow Moving option allows moving the toolbar between the floating and docked position.
Allow Showing/Hiding option allows showing or hiding the toolbar using these methods:
- Right-click a toolbar and check or clear the toolbar name in the popup menu.
- From the main menu, choose View > Toolbars and check or clear the toolbar name in the
list.
- Check or clear the toolbar name in the Customize dialog box, under the Toolbars tab.
FO
TR
IN
IN
124
2003 Cheltenham Courseware for Trainers
TR
IN
IN
Removing Toolbars
Using any of the methods described above open the Customize dialog box.
Click on the Toolbars tab.
Select the toolbar you want to remove and click on the Delete button:
FO
Customizing Commands
Once you created a new toolbar, you can add Commands and/or buttons to it.
Use any of the methods described above to open the Customize dialog box.
Click on the Commands tab:
Drag the button toward the toolbar until the cursor changes to the plus sign +:
FO
TR
IN
IN
125
2003 Cheltenham Courseware for Trainers
126
2003 Cheltenham Courseware for Trainers
TR
IN
IN
FO
OR right-click on the button and choose Delete from the popup menu:
127
2003 Cheltenham Courseware for Trainers
TR
IN
IN
Customizing Options
Using any of the methods described above open the Customize dialog box.
Click on the Options tab:
The Personalized Menus and Toolbars group allows you to customize your work with
Menus and Toolbars:
Show Standard and Formatting toolbars on two rows option displays the two default
toolbars on two rows when available.
Always show full menus option displays all commands on menus.
Show full menus after a short delay option displays the most used commands first. If you
rest the mouse pointer over the menu, it expands to show all commands.
Reset my usage data clears all automatically saved menu and toolbar settings
The Other group allows you to customize how command bars look and behave:
Large icons option displays larger button images.
List font names in their font option displays the drop-down list of fonts in their own font.
Show ScreenTips on toolbars option displays the name of the button when the mouse
pointer rests over the button.
Show shortcut keys in ScreenTips option displays the shortcut key combination with the
button name in the ScreenTip.
Menu animations option specifies whether or not menus are animated when displayed.
FO
128
2003 Cheltenham Courseware for Trainers
IN
IN
A
FO
TR
Review Questions
129
2003 Cheltenham Courseware for Trainers
The Table Analyzer helps you optimize a database by reducing data redundancy using a set
of related tables, suggesting additional optimization, adding more indexes, etc.
IN
IN
When you have completed this learning module you will have seen how to:
Use the Table Analyzer
Rename Tables
Add Key Fields
Use the Performance Analyzer
Use the Documenter Analyzer
Print Documentation
Export Documentation
FO
TR
130
2003 Cheltenham Courseware for Trainers
The first page of the wizard gives an introduction on how the Table Analyzer looks at the
problem. You can also click on the Show me an example buttons to view an example. Click
Next to continue.
The second page of the wizard gives an introduction on how the Table Analyzer solves the
problem. You can also click on the Show me an example buttons to view example. Click
Next to continue:
TR
IN
IN
The next page of the wizard allows you to select which Tables you want to analyze. To skip
the introductory pages of the wizard next time you run the Table Wizard, you should uncheck
the Show introductory pages option. Click Next to continue:
FO
131
2003 Cheltenham Courseware for Trainers
The next page of the wizard allows you to decide how to split up the data. You can let wizard
decide, or you can decide. Click Next to continue:
If you select the wizard to make a decision you might see the message containing the
wizards recommendation:
FO
TR
IN
IN
132
2003 Cheltenham Courseware for Trainers
The next page of the wizard represents a diagram of the suggested redistribution of
information:
You can see more instructions on how to handle the wizards suggestions by clicking the
Tips button:
FO
TR
IN
IN
133
2003 Cheltenham Courseware for Trainers
Read the Tips instructions to help you implement the wizards suggestions:
The wizard suggests that you create a Lookup Table for each field with a link from the
original Employees table (Table1) to Table2 and Table3:
FO
TR
IN
IN
134
2003 Cheltenham Courseware for Trainers
TR
IN
IN
Renaming Tables
Once you approve the table structures, you have to Rename the proposed tables. Select
each table and click on the Rename Table button:
FO
135
2003 Cheltenham Courseware for Trainers
TR
IN
IN
The field is now a primary key, marked with the key icon:
FO
136
2003 Cheltenham Courseware for Trainers
To undo the change, select the field and click on the Undo button:
If there is no field in the table that can be used as a primary key, you can assign a generated
key. Select the table without a primary key and click on the Add Generated Key button:
FO
TR
IN
IN
137
2003 Cheltenham Courseware for Trainers
The generated primary key field is added, marked with the key icon:
FO
TR
IN
IN
138
2003 Cheltenham Courseware for Trainers
The Performance Analyzer helps you optimize a database by analyzing all objects in the
database and suggesting ways you can improve the database performance.
Select the appropriate tab, or click on the All Object Types tab to list all database objects.
Check the check box besides the object(s) you want to analyze and click the OK button:
FO
TR
IN
IN
139
2003 Cheltenham Courseware for Trainers
To analyze the entire database, click on the All Object Types tab and click on the Select All
button to check all objects. Click OK to start analyzer:
At the end of the process, the Performance Analyzer displays the Analysis Results:
FO
TR
IN
IN
140
2003 Cheltenham Courseware for Trainers
Key icons specify what kind of information is contained in the finding list: Recommendation,
Suggestion, Idea or Fixed.
Analysis Notes pane describes the results for the selected list item.
If there are any Recommendations, you can click on the Optimize button to implement
analyzers recommendations.
Click Close to close the Performance Analyzer.
IN
The Documenter Analyzer helps you document databases, which is one of most important
tasks in a database management system.
Check the objects from each tab you want documented, or click the All Object Types tab
and click on the Select All button to document the whole database.
Click on the Options button.
FO
TR
IN
141
2003 Cheltenham Courseware for Trainers
The Include for Table group allows you to limit what table elements you want to print:
Properties
Relationships
Permissions by User and Group.
The Include for Fields Table group allows you to limit what field information you want to
print:
Nothing
Names, Data Types, and Sizes
Names, Data Types, Sizes, and Properties
The Include for Indexes group allows you to limit what index information you want to print:
Nothing
Names and Fields
Names, Fields, and Properties
FO
TR
IN
IN
142
2003 Cheltenham Courseware for Trainers
FO
TR
IN
IN
Printing Documentation
The report is opened in Print Preview:
Right-click on the report to open the popup menu where you can configure Page Setup and
other print options:
IN
IN
143
2003 Cheltenham Courseware for Trainers
FO
TR
Exporting Documentation
Once you have generated the report you can export the documentation data.
Right-click on the report to open the popup menu and select the Export option
OR from the main menu, choose File > Export.
This will open the Export Report dialog box were you can select the location, file name and
file type for export:
144
2003 Cheltenham Courseware for Trainers
IN
IN
You can save the report in various Excel, HTML Document, Text File, Rich Text Format,
Snapshot Format and XML Document formats.
Once you select the type under the Save as type field, click on the Export button:
FO
TR
Review Questions