Professional Documents
Culture Documents
Access 2003
LY
MANUAL - ADVANCED LEVEL
ON
North American Edition
E
PL
M
SA
PAGE 2 - MICROSOFT ACCESS 2003 - ADVANCED LEVEL MANUAL
© Cheltenham Courseware Ltd. 1995-2006 No part of this document may be copied without written permission from Cheltenham
LY
Courseware unless produced under the terms of a courseware site license agreement with Cheltenham Courseware.
All reasonable precautions have been taken in the preparation of this document, including both technical and non-technical proofing.
Cheltenham Courseware 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 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. 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
ON
highest possible standards.
Look for this icon for the New features of this software version.
Look for this icon for the Enhanced features of this software version.
M
SA
COURSE BASICS......................................................................................................................................................7
TOOLBARS .................................................................................................................................................................7
The Title Bar .......................................................................................................................................................7
The Menu Bar .....................................................................................................................................................7
The Tool Bar .......................................................................................................................................................8
INSTALLING THE SAMPLE FILES ................................................................................................................................8
USING THE NORTHWIND DATABASE ................................................................................................................9
INSTALLING THE NORTHWIND DATABASE .................................................................................................................9
LY
About Northwind.................................................................................................................................................9
Checking for Northwind ...............................................................................................................................9
Installing Northwind......................................................................................................................................9
REVIEW QUESTIONS ...............................................................................................................................................11
INTRODUCING STRUCTURED QUERY LANGUAGE .....................................................................................12
ON
WRITING SQL COMMANDS .....................................................................................................................................13
Structured Query Language (SQL) Bases ...................................................................................................13
Understanding SQL Statements ....................................................................................................................13
Understanding SQL Conventions ..................................................................................................................13
Understanding SQL Syntax ............................................................................................................................14
WRITING SQL QUERIES .........................................................................................................................................14
Using SELECT Statement ..............................................................................................................................14
Selecting All Data.............................................................................................................................................15
Selecting Specific Data ...................................................................................................................................15
E
Selecting Conditional Data .............................................................................................................................16
Using ORDER BY Statement .........................................................................................................................17
Sorting Data ......................................................................................................................................................18
Using Aggregate Functions ............................................................................................................................18
PL
LY
WORKING WITH MACROS ...................................................................................................................................36
AUTOMATING TASKS ...............................................................................................................................................36
Understanding Macros ....................................................................................................................................36
INTRODUCING THE MACRO DESIGN TOOLBAR .......................................................................................................37
The Macro Design Toolbar .............................................................................................................................37
Using the Macro Design Toolbar ...................................................................................................................38
ON
CREATING MACROS ................................................................................................................................................39
Creating New Macros ......................................................................................................................................39
TESTING AND DEBUGGING MACROS ......................................................................................................................42
Running a Macro ..............................................................................................................................................42
Stepping Through a Macro .............................................................................................................................43
MODIFYING MACROS ..............................................................................................................................................44
Modifying a Macro............................................................................................................................................44
CONDITIONAL PROGRAMMING IN MACROS .............................................................................................................45
Adding Conditions to Macros .........................................................................................................................45
E
Using the Expression Builder to create Conditions.....................................................................................46
Running Macros with Conditions ...................................................................................................................47
ADDING MACROS TO FORMS ..................................................................................................................................47
PL
Attaching Macros to a Form ...........................................................................................................................47
ADDING MACROS TO REPORTS ..............................................................................................................................50
Attaching Macros to a Report.........................................................................................................................50
FILTERING DATA......................................................................................................................................................52
Filtering Records ..............................................................................................................................................52
DOCUMENTING MACROS.........................................................................................................................................56
Commenting on Macros ..................................................................................................................................56
M
Using Arguments..............................................................................................................................................69
USING THE VISUAL BASIC EDITOR WINDOW ..........................................................................................................70
The Visual Basic Editor Window ....................................................................................................................70
Customizing the Visual Basic Editor Window ..............................................................................................70
Setting the Visual Basic Editor Options ........................................................................................................71
GETTING HELP WITH VISUAL BASIC .......................................................................................................................73
Using Microsoft Visual Basic Help ...........................................................................................................74
Getting Visual Basic Syntax Help ..................................................................................................................74
REVIEW QUESTIONS ...............................................................................................................................................75
USING DATA ACCESS PAGES............................................................................................................................77
LY
CREATING DATA ACCESS PAGES ...........................................................................................................................77
Using Data Access Pages ..............................................................................................................................77
Creating pages using the AutoPage..............................................................................................................78
Creating pages using the Page Wizard ........................................................................................................81
Creating pages using an Existing HTML Document ...................................................................................86
Creating pages using the Design View .........................................................................................................88
MODIFYING DATA ACCESS PAGES .........................................................................................................................89
ON
Choosing a Theme...........................................................................................................................................89
Adding Text .......................................................................................................................................................90
Adding Controls ................................................................................................................................................91
Formatting Text and Labels............................................................................................................................92
Aligning Content ...............................................................................................................................................92
Sizing Content ..................................................................................................................................................93
Adding Images..................................................................................................................................................94
Adding Backgrounds........................................................................................................................................94
SORTING DATA IN DATA ACCESS PAGES ...............................................................................................................95
E
Sorting Data ......................................................................................................................................................95
SUMMARIZING DATA IN DATA ACCESS PAGES .......................................................................................................96
Summarizing Data............................................................................................................................................96
PL
EDITING DATA IN DATA ACCESS PAGES ................................................................................................................97
Adding a New Record......................................................................................................................................97
Deleting a Record ............................................................................................................................................98
PROTECTING DATA IN DATA ACCESS PAGES.........................................................................................................98
Customizing Navigation Bar ...........................................................................................................................98
Protecting Fields...............................................................................................................................................99
REVIEW QUESTIONS .............................................................................................................................................100
M
LY
Setting Tables/Queries Options .............................................................................................................122
CONFIGURING AUTOCORRECT OPTIONS .............................................................................................................124
Setting AutoCorrect Options.........................................................................................................................124
Excluding AutoCorrect Rules .......................................................................................................................124
Removing AutoCorrect Rules.......................................................................................................................125
Adding Replace AutoCorrect Rules.............................................................................................................125
ON
Removing Replace AutoCorrect Rules .......................................................................................................126
CUSTOMIZING MENUS AND TOOLBARS.................................................................................................................126
Opening Customize Dialog Box ...................................................................................................................126
Customizing Toolbars....................................................................................................................................127
Creating Custom Toolbars............................................................................................................................127
Removing Toolbars........................................................................................................................................130
Customizing Commands ...............................................................................................................................130
Adding Buttons to Toolbars ..........................................................................................................................131
Removing Buttons from Toolbars ................................................................................................................132
E
Customizing Options......................................................................................................................................132
REVIEW QUESTIONS .............................................................................................................................................133
MANAGING AND MAINTAINING ACCESS DATABASES ............................................................................135
PL
Course Basics
Toolbars
LY
• The title bar is displayed along the top of almost all program, folder and dialog
box windows. It is used to display information such as the name of the
application (or folder) and the document you are working on. Information which
is displayed here may vary. The example shown illustrates the title bar for a
program called Microsoft Word, in which a document called Document1 has
ON
been opened or saved:
• In most cases, you are asked to use the mouse to execute a series of menu
commands (e.g., File > Save As). What this means is that you select File from
the main menu, followed by Save As:
SA
LY
Installing the Sample Files
ON
• Use Windows Explorer to create a folder called Access 2003 Advanced
Samples, in the My Documents folder.
• If you are installing the sample files from the CD-ROM, place the CD-ROM in the
CD drive and copy the files from the
access_2003_advanced_usa\exercise_files to the My Documents\Access
2003 Advanced Samples folder.
• If these files have been copied to your network server, then ask your
E
trainer/supervisor for more information about how to copy these files to your
PC’s hard disk.
PL
LY
About Northwind
• Northwind is a sample database which ships with Access 2003. It contains
ON
product and sales data for a fictitious company Northwind Traders.
• It is recommended that Northwind be installed to follow the lessons in this
manual.
• In the Search text box of the Basic File Search task pane, type Northwind.
In the Search in area of the task pane, choose Everywhere from the drop
down menu.
• Click Go.
M
Installing Northwind
• Insert the Microsoft Office 2003 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 2003 setup screen.
LY
•
•
Microsoft Office Access subtree.
ON
Under Choose update options for applications and tools, select the
• Click Update.
• Once the installer completes, click OK to finish.
• Once the Northwind database is installed, search for it again and open it.
Note: You may notice that the Northwind database utilizes the older Access
2000 file format. Please note that all pictures and examples in this training
manual will display the new Access 2002-2003 file format. If you wish, you can
convert Northwind into an Access 2002-2003 database. For more information,
please refer to the file conversion chapter later in this manual.
Review Questions
How would you:
• Check for Northwind?
• Install Northwind?
LY
ON
E
PL
M
SA
LY
• Use ORDER BY Statement
• Sort Data
• Use Aggregate Functions
• Calculate Data
• Use GROUP BY Statement
ON
• 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
E
• Create Outer Join
• Create Left Outer Join
• Create Right Outer Join
PL
LY
• A wide range of users can use SQL, including Database Administrators,
management personnel, application programmers, and other types of end users.
ON
Understanding SQL Statements
• SQL statement consists of reserved words and user-defined words:
Reserved words are a fixed part of SQL. They must be spelled exactly as
required and cannot be split across lines.
User-defined words are created by the user and represent names of various
database objects such as relations, columns, views, etc.
E
PL
• If clause has several parts, they should each appear on a separate line and be
indented under the start of clause.
SELECT { * | [column_name] [, …] }
LY
FROM table_name
ON
Using SELECT Statement
• Data is selected using the SELECT statement.
• Order of the clauses cannot be changed.
[HAVING group_condition]
[ORDER BY column_name] ;
LY
FROM staff;
SELECT *
ON
FROM staff;
LY
SG37 Ann Beech 1000.00
SG14 David Ford 1500.00
SA9 Mary Howe 750.00
SG5 Susan Brand 2000.00
SL41 Julie Lee 750.00
ON
• Example 5: Named Calculated Fields
In the example above, the 4th column is labeled col4. To name this column use
AS clause:
LY
The result table is:
sno fname lname position
SL21 John White Manager
SA9 Mary Howe Assistant
SG5 Susan Brand Manager
ON
SL41 Julie Lee Assistant
Sorting Data
• Example 9: Single Column Ordering
(list salaries for all staff, arranged in descending order of salary)
LY
sno fname lname salary
SL21 John White 30000.00
SG5 Susan Brand 24000.00
SG14 David Ford 18000.00
SG37 Ann Beech 12000.00
SA9 Mary Howe 9000.00
ON
SL41 Julie Lee 9000.00
• Each function operates on a single column of a table and returns single values:
- COUNT, MIN and MAX apply to numeric and non-numeric fields.
Calculating Data
• Example 11: Use of COUNT(*)
(find the total number of staff which have salary of 9000)
LY
WHERE salary = 9000;
ON
• Example 12: Use of COUNT and SUM
(find the total number of Managers and the sum of their salaries)
Grouping Data
• Example 14: Use of GROUP BY
(find number of staff in each branch and their total salaries)
LY
The result table is:
bno count sum
B3 3 54000.00
B5 2 39000.00
B7 1 9000.00
ON
Writing SQL Subqueries
• Some SQL statements can have a SELECT embedded within them.
• A subselect can be used in the WHERE clause of an outer SELECT, where it is
called a Subquery or Nested query.
E
PL
Creating a Subquery with Equality
• Example 15: Use of Subquery with Equality
(list the staff who work in the branch at ‘163 Main St’)
WHERE bno =
(SELECT bno
FROM branch
WHERE street = ‘163 Main St’);
SA
• 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:
LY
sno fname lname position
SG37 Ann Beech Snr Asst
SG14 David Ford Deputy
SL21 John White Manager
ON
Creating a Subquery with an Aggregate Function
• Example 16: Use of Subquery with Aggregate Function
(list all staff whose salary is greater than the average salary)
• 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:
LY
WHERE salary > ANY
(SELECT salary
FROM staff
WHERE bno = ‘B3’);
• Note: Inner SELECT produces the set {12000, 18000, 24000} and outer
ON
SELECT lists those staff whose salaries are greater than any of the values in this
set.
branch B3)
FROM staff
WHERE bno = ‘B3’);
LY
Creating a Simple Join
• Example 19: Use of Simple Join
ON
(list names of all renters who have viewed a property)
• Note: To obtain correct rows, include only those rows from both tables which
have identical values in the rno columns: r.mo = v.mo. These two columns are
E
the matching columns for two tables.
Sorting a Join
SA
LY
• With an inner join, if one row of a table is unmatched, the row is omitted from
the result table.
• Outer join retains rows which do not satisfy the join condition.
• Consider the following two simplified tables:
• BRANCH1
ON
bno bcity
B3 Seattle
B4 New York
B2 Atlanta
• PROPERTY_FOR_RENT1
pno pcity
E
PA14 Chicago
PL94 Atlanta
PG4 Seattle
PL
OR
• Note: The result table has two rows where the cities are the same. There are
no rows corresponding to the branches in New York and Chicago.
LY
The result table is:
bno bcity pno pcity
B3 Seattle PG4 Seattle
B4 New York NULL NULL
B2 Atlanta PL94 Atlanta
ON
• Note: Left outer join includes those rows of first (left) table which are
unmatched with rows from second (right) table. Columns from second table are
filled with NULLs.
• Note: Right outer join includes those rows of second (right) table which are
unmatched with rows from first (left) table. Columns from first table are filled
with NULLs.
LY
• Note: Full outer join includes those rows which are unmatched in both tables.
Unmatched columns are filled with NULLs.
ON
Inserting Data
• 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.
M
LY
INSERT INTO staff (sno, fname, lname, position, bno
VALUES (‘SG16’, ‘Alan’, ‘Brown’, ‘Assistant’, ‘B3’);
OR
ON
INSERT INTO staff
VALUES (‘SG16’, ‘Alan’, ‘Brown’, ‘Assistant’, ‘B3’, NULL);
Updating Data
UPDATE table_name
SET column_name1 = data_value1
[, column_name2 = data_value2 …]
[WHERE search_condition];
• SET clause specifies names of one or more columns which are to be updated.
LY
• 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.
ON
Updating All Rows
• Example 28: UPDATE All Rows
(give all staff a 3% pay increase)
UPDATE staff
E
SET salary = salary*1.03;
PL
UPDATE staff
M
• Note: WHERE clause finds rows that contain data for Managers. Update is
applied only to these particular rows.
UPDATE staff
Deleting Data
LY
Using DELETE FROM Statement
• Data is removed from the table using the DELETE FROM statement:
ON
• 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.
E
Deleting Specific Rows
• Example 31: DELETE Specific Rows
(delete all staff that hold a Manager position)
PL
• To view and/or edit SQL statements while creating a Query, switch from
Design View to SQL View:
LY
ON
To view a sample SQL statement
• For example, open the sample Northwind.mdb database.
• Click on the Queries button under the Objects pane of the Database window.
• Select a query named Employee Sales by Country:
E
PL
M
SA
LY
• This will open the Design View for the selected query:
ON
E
PL
• While in Design View, from the main menu, choose View > SQL View.
• This will open the SQL View:
M
SA
• The column names that contain spaces must be enclosed in square brackets
[ ].
LY
If the column name does not contain spaces, square brackets are not needed.
ON
• SQL Specific queries are queries that can only be created using SQL statements.
• In the New Query dialog box, select Design View and click OK:
LY
• In the Show Table dialog box, click Close without adding any table:
ON
E
• From the main menu, choose Query > SQL Specific > then select the type of
PL
LY
• In the Access Help task pane, type "SQL Queries" into the Search for field,
and click on the green Start Searching button:
ON
In the Search Results task pane, click on the appropriate link to find
information on SQL queries:
E
PL
M
SA
Review Questions
How would you:
• Use SELECT Statement?
• Select All Data?
• Select Specific Data?
• Select Conditional Data?
LY
• Use ANY and ALL Statements?
• Understand SQL Joins?
• Create a Simple Join?
• Sort a Join?
• Create an Outer Join?
• Create a Left Outer Join?
ON
• Create a Right Outer Join?
• Create a Full Outer Join?
• Use INSERT Statement?
• Understand INSERT Statement Rules?
• Insert Data using VALUES?
• Insert Data using Defaults?
E
• Insert Data using SELECT?
• Use UPDATE Statement?
• Update All Rows?
PL
LY
• Modify a Macro
• Add Conditions to Macros
• Use the Expression Builder to Create Conditions
• Run Macros with Conditions
• Attach Macros to a Form
ON
• Attach Macros to a Report
• Filter Records
• Comment on Macros
• Print Macro Definitions
• View Macro Definitions
E
Automating Tasks
PL
Understanding Macros
• Macros present a way of programming Access 2003 to perform a variety of tasks
and actions.
• Macros are easy to create - you simply select from the list of predefined actions
M
• 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:
LY
• Once macros are created, you can attach them to an Event property of any
object in your database.
ON
Note: Access macros differ from macros in Office 2003 and other applications,
as Access does not record the keystrokes.
LY
ON
Macro Name column is added to the macro sheet:
• Insert Rows button inserts one or more blank rows in the grid above the
selected row:
LY
OR from the main menu, choose Run > Run.
ON
• Single Step button runs the macro one action at a time, displaying
intermediate information:
Creating Macros
• Under the Action column, you will see the drop-down list which contains a list of
predefined actions for you to choose from:
LY
• The Comment column contains optional comments used for documenting
ON
macros.
• Once you select an Action, the pane on the bottom area displays the associated
Action Arguments:
E
PL
M
• 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:
SA
• Once the Object Type is selected, you can select an Object Name. Access will
list all available Forms in the current database:
LY
• The last argument is the Save option (required). Here, you can select what
type of actions Access should perform at the end:
ON
Note: The information pane at the bottom-right area of the Macro window
E
displays information about the part of the macro sheet that is currently active.
If you need more information, press the F1 key for help.
PL
• Close the Macro window and click Yes to save changes for your new macro:
M
• In the Save As dialog box, enter the name in the Macro Name field, then click
OK:
SA
• The new macro is now available in the Macros tab of the Database window:
LY
ON
Testing and Debugging Macros
Running a Macro
• Once you have created a macro, you will have to run it and see if it works.
E
• 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
PL
macro step-by-step to find where the error occurs, and fix it.
To run a macro
• Select the macro name from the Macros page of the Database window.
M
OR right-click the macro name and choose Run from the popup menu:
LY
Stepping Through a Macro
•
ON
If you have received an error while running a macro, you will have to step
through the macro in order to find the error and fix it.
E
To use the Single Step method to run a macro
PL
• Select the macro name from the Macros page of the Database window.
• Click Design button to open the Macro window:
M
SA
LY
•
•
macro. This is the default option.
The Halt button stops macro execution. ON
The Step button moves to the next action, if there are more actions in the
E
• The Continue button stops the Single Step mode and runs the rest of the macro
without stopping.
PL
Modifying Macros
M
Modifying a Macro
• Select the name of the macro you want to modify from the Macros page of the
Database window.
SA
LY
• Macro conditions are added in the Condition column on the macro sheet:
•
ON
By default, the condition only applies to the action on the same row in the
macro sheet.
E
• If the condition is not met, the next action (i.e. the next row) will be executed.
• To extend the condition to the next action, you must enter the ellipsis (…) in the
Condition column of the next row:
PL
M
SA
LY
Using the Expression Builder to create Conditions
ON
• Right-click inside the Condition field where you want to create a condition, and
select Build from the popup menu.
• In the Expression Builder dialog box, create the logical expression (for
example if the Total Pages number is greater than 0) and click OK:
E
PL
M
LY
subsequent actions that have an ellipsis (…) in the Condition column. Access
then moves to the next condition, if there is one:
ON
E
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
PL
records. Then Access continues to the next action with an ellipsis (…) SetValue
that will press in the All button.
• First select the form in the Forms page of the Database window and click on
the Design button:
LY
ON
To attach the macro to a form event
• From the main menu, choose Edit > Select Form
LY
To attach the macro to a control in the form
•
ON
Select the control (for example, the Exit Microsoft Access button):
E
PL
M
SA
OR right-click on the selection and select Properties from the popup menu
(available for section or control objects only).
• Click the Event tab to view a list of events that can occur for the selected
object.
• Select the event you want to run the macro (for example, On Exit).
• Choose the Macro name from the drop-down list of available macros (for
example, Close):
LY
ON
• Save and close the form design.
LY
ON
To attach the macro to a section of the report
• Click the section selector (for example, Page Header section):
E
PL
M
OR right-click on the selection and select Properties from the popup menu
(available for the section or control objects only).
• Click the Event tab to view a list of events that can occur for the selected
object.
• Select the event you want to run the macro (for example, On Format).
• Choose the Macro name from the drop-down list of available macros (for
example, Sales Totals by Amount):
LY
Filtering Data
ON
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.
• Click OK if the splash screen is displayed:
E
PL
M
SA
LY
• In the Database window, click on the Macros tab, then select the Customer
Phone List macro and click on the Design button:
ON
E
PL
• 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.
• Go back to the Database window, click on the Forms tab, and select
Customer Phone List:
LY
ON
• Double-click on the form name to open it:
E
PL
• 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
M
displayed.
• Click on the Design button to see the underlined programming for this form:
SA
• The row of Alphabetic buttons are actually an Option Group control named
CompanyNameFilters, which returns a value depending on 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:
LY
• The Alpha Buttons macro applies a filter to the list, based upon which button is
ON
pressed.
• For example, if the A button is pressed, the macro will filter for company names
that start with
• Pressing on the A button will result in this company list:
E
PL
M
• 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
SA
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 depress the All button in the
form:
LY
ON
Documenting Macros
Commenting on Macros
• To make programming and future updates easier, make sure you comment
E
macros using the Comment column in the macro sheet:
PL
M
SA
• In the Print Macro Definition dialog box, select what information you want to
print and click OK:
LY
• 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
ON
permissions.
Review Questions
How would you:
• 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?
LY
• Filter Records?
• Comment on Macros?
• Print Macro Definitions?
• View Macro Definitions?
ON
E
PL
M
SA
LY
• Understand Procedures
• Use Naming Rules
• Declare Variables
• Set Variable Scope
• Declare Constants
ON
• 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
E
Using Macros versus Visual Basic
PL
• In this manual, we will cover only the basics of Visual Basic programming
regarding its use in Access 2003.
• If you want to learn more about Visual Basic, refer to one of the numerous
manuals and books on this subject.
M
LY
To convert a Macro from the Database Window
• Click on the Macros tab in the Database window.
• Select a macro you want to convert to VB.
• From the main menu, choose Tools > Macro > Convert Macros to Visual
Basic
ON
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:
E
PL
• Check the Add error handling to generated functions and Include macro
comments options and click Convert.
SA
• The Convert macros to Visual Basic message box shows the conversion is
finished. Click OK.
• 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:
LY
ON
• Scroll to the end of the code window to view the whole Visual Basic code:
E
PL
M
• 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.
SA
LY
ON
To convert Form’s Macro from the Design View
• Click on the Forms tab in the Database window.
• Select a form whose macro you want to convert to VB.
• Click on the Design view button.
• From the main menu, choose Tools > Macro > Convert Form’s Macros to
Visual Basic.
• This will open up the Convert form macros: macro_name dialog box:
E
PL
• Click on the Code toolbar button to open the Visual Basic Editor window with
SA
LY
•
ON
Scroll to the end of the code window to view the whole Visual Basic code:
E
PL
M
• The Sub statement represents the local code, stored with a form.
• The DoCmd statement performs macro action in a Visual Basic procedure.
SA
• This will open up the Convert report macros: macro_name dialog box:
• Uncheck Add error handling to generated functions and check the Include
macro comments option and click Convert.
LY
• The Convert macros to Visual Basic message box shows the conversion is
finished.
Understanding Modules
•
•
ON
The Visual Basic module consists of declarations and procedures.
Modules are used to create event procedures that execute when an event
occurs.
E
• There are two types of modules:
Form and Report modules stored together with a form or report containing
procedures and functions associated with a single form or report.
M
Creating Modules
• Click on the Modules tab in the Database window.
SA
LY
ON
• The new module, named Module1, opens up in the Visual Basic Editor
window:
E
PL
M
SA
Declarations section
Procedure section(s)
• If you do not see the Option Explicit declaration, choose Tools > Options
from the Visual Basic Editor window’s main menu.
• In the Options dialog box, click on the Editor tab and check the Require
Variable Declaration option. Click OK to continue:
LY
ON
E
Understanding Module Declarations
• Declarations are listed in the first section of a module.
PL
• The Option Compare declaration specifies the default comparison method for
string data. This declaration requires an argument:
- Binary sorts string data based on the internal binary representation of
characters.
SA
• The Option Explicit declaration forces the declaration of variables used in the
module.
Understanding Procedures
• Procedures consist of statements and methods.
LY
• Executable statements used to trigger actions or jump to another location in
the procedure.
ON
• A sub procedure is a program code that does not return a value. It usually runs
as a separate program called by an event in a form or report.
• Example of a sub procedure:
This helps you and others understand and maintain your code.
• In Visual Basic, there are several naming rules and practices:
• The first character must be a letter.
• The name has a maximum of 255 characters.
• Avoid the use of special characters and spaces, periods, exclamation marks, etc.
• Avoid the use of Visual Basic keywords.
• Avoid the use of same names for multiple variables in same procedures.
• 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
Declaring Variables
• Variables are items with unique names containing data that can be changed
LY
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:
ON
Dim strName As String
Dim intAge As Integer, dteBirthday As Date, undeclared
• 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.
E
• The last variable has no data type declaration, so the type is Variant.
PL
• Private module level is set when the variable is declared with a Private
statement in the declarations module section. The variable is available only to
procedures in that module.
• Public module level is set when the variable is declared with a Public
statement in the declarations module section. The variable is available to all
procedures in the application.
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:
LY
• 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.
ON
Using Methods
• Methods are actions that database objects can perform, or procedures that
apply to database objects. Access 2003 modules can use nearly 160 methods
that apply to different database objects.
• Some examples of methods are:
- Opening or closing a form.
E
- Sounding a beep when a specific event occurs.
- Going to a specific field in a form.
- Filtering records for a report.
PL
• Methods have specific syntax that indicate the object and the action:
• In the example above, the method moves the cursor to the Company Name
field in the Customer Phone List form.
SA
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 an 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:
LY
Using the Visual Basic Editor Window
ON
The Visual Basic Editor Window
E
PL
M
SA
LY
• In the Code view, the Object list box displays a list of all controls in the form or
report:
ON
E
• In the Code view, the Procedure list box displays a list of all procedures in the
module object:
PL
M
LY
ON
• The Code Settings group controls the code editing:
Auto Syntax Check option checks for syntax errors as you type the code.
Auto List Members option displays a list of keywords as you type the code.
E
Auto Quick Info option displays syntax when you type a method or procedure
name.
PL
Auto Data Tips option displays the current value of a variable when you rest
your mouse pointer on the name.
Auto Indent option indents a line of code to match the previous line.
M
Tab Width option sets the number of characters for TAB key.
Default to Full Module view option shows all procedures in the module by
default.
• Click the Editor Format tab to specify the appearance of the different types of
text in the editor window:
LY
• Click the General tab to set Form Grid Settings, Error Trapping and
Compile options:
ON
E
PL
OR click on the Microsoft Visual Basic Help [?] button on the toolbar:
LY
• 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:
•
ON
The Microsoft Visual Basic Help task pane opens up. Here you can find
extensive reference for various Visual Basic topics:
E
PL
M
SA
LY
OR right-click inside the statement and choose desired help from the popup
ON
menu.
• List Properties/Methods lists all properties and methods available for selected
statement:
E
PL
• 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:
M
• Parameter Info displays the complete syntax with the current parameter
highlighted in bold:
SA
• Complete Word automatically completes the word when you begin typing.
Review Questions
How would you:
• Use Visual Basic Modules?
LY
• Declare Constants?
• Use Methods?
• Use Arguments?
• Customize the Visual Basic Editor Window?
• Set the Visual Basic Editor Options?
• Use Microsoft Visual Basic Help?
ON
• Get Visual Basic Syntax Help?
E
PL
M
SA
LY
• Choose a Theme
• Add Text
• Add Controls
• Format Text and Labels
• Align Content
ON
• Size Content
• Add Images
• Add Backgrounds
• Sort Data
• Summarize Data
• Add a New Record
• Delete a Record
E
• Customize the Navigation Bar
• Protect Fields
PL
LY
ON
E
• In the New Data Access Page dialog box, select AutoPage: Columnar:
PL
M
SA
• Choose the table or query where the object’s data comes from by
selecting it from the drop-down list:
LY
• Click OK to create a data access page:
ON
E
PL
M
• 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
SA
LY
• Select the location and name the data access page and click Save.
• You may be asked whether you want to set the current folder as the default
location for data access pages. Click Yes to accept, or No to decline.
ON
• You may also see a warning dialog box. Click OK:
E
PL
• The new data access page is listed in the Pages section of Database window:
M
SA
LY
ON
E
PL
Creating pages using the Page Wizard
• Another way to create data access pages is using the Page Wizard.
• The Page Wizard allows additional options for creating a data access page. For
example, you can choose fields from more than one table or query, grouping,
selecting multiple fields for sorting, etc.
M
button.
• In the New Data Access Page dialog box, select Page Wizard and click OK to
continue:
LY
OR from the Pages page of Database window, double-click on Create data
access page by using wizard:
ON
E
PL
• Under the Available Fields list, select one field and click the [>] button to
transfer it to the Selected Fields:
LY
• If you want to select all the fields, click on the [>>] button:
ON
E
• If you want to remove a field from the Selected Fields list, select the field and
PL
• Select the field you want to group by, and click on the [>] button:
LY
ON
• 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:
E
PL
• The Grouping Intervals dialog box allows you to choose how you want to
M
group the group-level field(s). Click OK to accept change or Cancel to close the
dialog box:
SA
LY
ON
• The default sorting order is ascending. If you want to change the sorting order,
click the Ascending button to change it into Descending:
E
PL
M
SA
• Once you have selected all of the sorting fields, click on the Next button to
continue.
• The last page of the wizard allows you to add a title to the page and set other
options:
LY
• Open the page option takes you directly to the Page view.
• Modify the page’s design option takes you directly to the Design view.
ON
• 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:
E
PL
M
SA
LY
ON
OR from the Pages page of the Database window, double-click on Edit Web
page that already exists:
E
PL
• This will open the Locate Web Page dialog box where you can select the
M
LY
To create a data access page using an Existing Web page
• In the Database window, click on the Pages tab, and then click on the New
button.
• In the New Data Access Page select Design View and click OK to continue:
ON
E
OR from the Pages page of the Database window, double-click on Create data
PL
• 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:
M
SA
Note: If the Field List pane is not automatically displayed when opening the
page, from the main menu, select View > Field List.
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:
LY
•
ON
Once the page is opened in Design view, from the main menu, choose Format
E
> Theme.
• This will open the Theme dialog box:
PL
M
SA
• Under the Choose a Theme list, select the theme you want, and you will see an
example in the right pane:
LY
ON
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 2003 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.
E
• Set Default button sets the current theme as the default theme for all new data
access pages.
PL
• Click OK to apply the theme.
Adding Text
• You can add text to the page areas above or below the grid section header.
M
• Simply position the insertion point on the page and type the text:
SA
• 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.
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.
LY
• The Toolbox contains controls that you can add to the page design:
ON
ICON CONTROL DESCRIPTION
Label Used to display text on a page. Labels are useful for descriptive or
instructional text. Labels are not associated with a data source.
Bound Span Used to display data from a field in the database or result of an
expression.
Text Box Used to input data on a page. Text boxes are unbound to accept
E
input or display a calculation.
Scrolling Text Used to add a marquee for displaying scrolling text.
PL
Check Box Used to set Yes/No values from an underlying query or table.
M
Record Used to add a Record Navigation bar that contains buttons for
Navigation display, edit, delete, sort, and filter.
Office Used to add a PivotTable. PivotTables can be associated with a data
PivotTable source.
Office Chart Used to add a Chart. Used for analyzing data.
LY
Image Used to insert an image on a page.
ON
sections within a page.
Special Effect:
M
Aligning Content
SA
• In the page Design view, select the content you want to align.
• From the main menu, choose Format > Align > alignment option:
LY
OR right-click on the selection and select Align > alignment option from the
popup menu:
ON
E
Sizing Content
• In the page Design view, select the content you want to resize.
• From the main menu, choose Format > Size > sizing option:
PL
M
SA
OR right-click on the selection and select Size > sizing option from the popup
menu:
LY
Adding Images
• From the Toolbox, click on the Image button.
• Place the Image control on the page:
•
ON
This will open the Insert Picture dialog box. Select the image file you want to
E
place and click Insert.
PL
• 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:
M
SA
Adding Backgrounds
• Data access page background can be displayed with flat color or a tiled image.
LY
ON
To add a Background Picture
• From the main menu, choose Format > Background > Picture.
• This will open the Insert Picture dialog box. Locate your background image
and click Insert.
• The picture will automatically fill in the background in a tiled style.
E
Sorting Data in Data Access Pages
PL
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.
M
• In the properties dialog box, enter the name of the field you want the records to
be sorted by in the DefaultSort property box:
SA
• 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:
LY
• 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 ascending order. If you want to switch to
ON
descending order, enter a space after the field name and then type DESC:
• The AutoSum feature in the data access page Design view allows you to add
calculated summaries quickly to a page.
• In the page Design view, select the bound span control you want to summarize:
M
• Click on the AutoSum tool from the toolbar and choose from the list:
SA
• From the main menu, choose File > Web Page Preview to see the summary
result:
LY
Editing Data in Data Access Pages
ON
E
• In data access pages, much the same as in the forms, you can use the Record
Navigation Bar to add, edit and delete records.
PL
LY
Deleting a Record
ON
• 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:
E
• If the data access page does not display the changes, refresh the browser
PL
• The easiest way to protect the data in data access pages is to limit the Record
Navigation Bar functionality.
• In the page Design view, select the Navigation control:
• Right-click on selection and choose Navigation Buttons from the popup menu:
LY
• Uncheck any button you want to remove from the Record Navigation Bar. For
example, uncheck the New button to disable adding new records:
ON
If you want to add the control back to the Navigation bar, check the button
again.
E
Protecting Fields
• If you want to protect only certain fields from editing, you can change their
PL
properties.
• In the page Design view, select the field you want to protect and open its
properties:
M
SA
Review Questions
How would you:
• Use Data Access Pages?
• Create pages using the AutoPage?
• Create pages using the Page Wizard?
• Create pages using an Existing HTML Document?
• Create a page using the Design View?
• Choose a Theme?
LY
• Add Text?
• Add Controls?
• Format Text and Labels?
• Align Content?
• Size Content?
ON
• Add Images?
• Add Backgrounds?
• Sort Data?
• Summarize Data?
• Add a New Record?
• Delete a Record?
E
• Customize the Navigation Bar?
• Protect Fields?
PL
M
SA
LY
• Convert an Access 2003 database to an Access 2000 database
ON
• In Microsoft Access, incompatibility exists between different versions of Access.
Therefore, you will need to convert your database(s) to Access 2003 in order to
work on them.
• You can convert databases created with Access 2.0 or later to Access 2003.
Note: You do not need to convert 2002 databases in order to work on them in
Access 2003, as they both use the same file format.
E
PL
Converting Databases
• Before any conversion, you should first 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.
M
• In an empty Access 2003 window, choose Tools > Database Utilities >
Convert Database > To Access 2002-2003 File Format from the main
menu.
SA
LY
• In the Convert Database Into dialog box, enter the database name in the File
ON
name field, and then click on the Save button:
E
PL
• You will see the warning dialog box. Click on the OK button to proceed:
M
SA
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.
LY
• From the main menu, choose File > Get External Data > Import.
• In the Import dialog box, select the older-version database and click on the
Import button:
ON
E
• In the Import Objects dialog box, select the object(s) and click on the OK
PL
button:
M
SA
Enabling Databases
• In some cases, you might want to open an older-version Access database in
Access 2003 without converting it first. This may be necessary if some of the
database users do not have Access 2003.
• 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 2003.
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:
LY
ON
Note: You cannot import or link an Access 2003 table into an enabled
database.
E
PL
• In the Database Splitter dialog box, click on the Split Database button:
LY
ON
• 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:
E
PL
M
• Once you have split the database into front-end and back-end, delete the back-
end database.
• From the main menu, choose Tools > Database Utilities > Linked Table
Manager.
SA
• Link the new Access 2003 front-end to the tables in the older-version (back-
end) database.
• Click the Select All button, and then OK to link all tables:
LY
Converting from Access 2003 to Access 97
ON
Converting an Access 2003 database to an Access 97 database
When converting an Access 2003 database to an Access 97 database, you will
lose any features and functionalities specific to the Access 2003 version.
E
To convert an Access 2003 to an Access 97 database
PL
• Before any conversion, you should first create a backup copy of your Access
database.
• If the database is used in a multiple-user environment, make sure that all users
have closed the database.
• Open the Access 2003 database.
• If the database has password protection for the code, open the Visual Basic
M
Editor first.
• From the main menu, choose Tools > Macro > Visual Basic Editor
• In the Visual Basic Editor, choose Tools > Database_name Properties from
the main menu:
• In the Project Properties dialog box, select the Protection tab and enter the
password in the Password field, then click OK:
LY
•
•
•
ON
Close the Visual Basic Editor to return to the Access window.
From the main menu, choose Tools > Database Utilities > Convert
Database > To Access 97 File Format.
In the Convert Database Into dialog box, enter the database name in the File
E
name field, and then click on the Save button.
PL
• When converting an Access 2003 database to an Access 2000 database, you will
lose any features and functionalities specific to the Access 2003 version.
SA
• From the main menu, choose Tools > Database Utilities > Convert
Database > To Access 2000 File Format.
• In the Convert Database Into dialog box, enter the database name in the File
name field, and then click the Save button.
Review Questions
LY
How would you:
• Convert Databases?
• Convert Database Objects?
• Enable Databases?
• Share Databases across various Access versions?
ON
• Convert an Access 2003 database to an Access 97 database?
• Convert an Access 2003 database to an Access 2000 database?
E
PL
M
SA
LY
• Set Datasheet Options
• Set Forms/Reports Options
• Set Pages Options
• Set Advanced Options
• Set International Options
ON
• Set Error Checking Options
• Set Spelling Options
• Set Tables/Queries Options
• Set AutoCorrect Options
• Exclude AutoCorrect Rules
• Remove AutoCorrect Rules
• Add Replace AutoCorrect Rules
E
• Remove Replace AutoCorrect Rules
• Open the Customize Dialog Box
• Customize Toolbars
PL
• Customize Options
SA
LY
ON
• 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):
E
PL
M
SA
• Now you can read the information for the selected option:
LY
ON
• 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.
E
Setting View Options
PL
• The Show group allows you to specify what features you will see when you
startup Access 2003:
• Status bar option shows or hides the status bar at the bottom of the screen.
• Startup Task Pane option shows or hides the 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
LY
Desktop feature installed for this option to work.
• 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.
ON
• 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.
E
Setting General Options
PL
• 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.
LY
removes your name, company name, or any other personal information.
• Default database folder option specifies the default folder where you will save
new databases.
ON
• 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.
E
- Log name AutoCorrect changes option generates a log named AutoCorrect
Log that contains the changes.
PL
• New database sort order option in Access 2003 now allows you to choose
from a list of 33 languages that change the default alphabetic sort order for new
databases.
• The Web Options button opens the dialog box where you can change the
default Appearance for both the Hyperlink color and the Followed hyperlink
M
LY
ON
• 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.
E
• The Confirm group displays the message requiring confirmation from the user:
• Record changes option requires confirmation when a record changes.
PL
• The Filter by form defaults for [current database] Show list of values in
M
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.
SA
• 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.
• Don’t display lists where more than this number of records is read option
sets the maximum number of records to be used to generate the list of unique
values for the field.
LY
• The Move after enter group controls what happens when you press the ENTER
ON
key:
• Don’t 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.
• The Arrow key behavior group controls what happens when you press the
RIGHT ARROW and LEFT ARROW keys:
• Next field option moves the insertion point to the next field when you press the
E
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
PL
you press the RIGHT ARROW key or to the previous character when you press
the LEFT ARROW key.
• 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
M
current record and stops the RIGHT ARROW and LEFT ARROW keys from moving
the insertion point.
• Datasheet IME Control option sets the East Asian IME Mode set to "No
Control" when entering data into a table datasheet. (Note: The IME Mode
applies to all East Asian languages, and allows you to set the properties that
control the behavior of a field in a table, or a control in a form).
LY
ON
• 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.
• The Default gridlines showing group allows you to show or hide the following:
• Horizontal option shows or hides the horizontal gridlines in the datasheet.
M
• The Default cell effect group specifies the cell effect from Flat, Raised or
Sunken.
LY
ON
• 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.
E
• Form template option specifies an existing form template for new designs.
• Report template option specifies an existing report template for new designs.
PL
• Always use event procedures option takes you directly to the VB Editor
window when you click the Build button in the property sheet.
• Show Smart Tags on Forms option - a new Access 2003 feature - shows a
Smart Tag Action button when moving to a control with an attached Smart Tag.
• Use Windows Themed Controls on Forms option - a new Access 2003
M
feature - applies the Windows display theme that is currently set to Access
forms.
SA
LY
ON
• The Default Designer Properties group controls the sections’ design:
• Section Indent option specifies the default indent for each section.
• Alternate Row Color option specifies the color to display in alternate rows of
the group header and footer sections.
• Caption Section Style option specifies the default style for the caption section.
• Footer Section Style option specifies the default style for the footer section.
E
• The Default Database/Project Properties group controls the properties:
• Use Default Page Folder option specifies the default page folder. If checked,
enter the folder to use as a default page folder.
PL
• Use Default Connection File option specifies the default connection file. If
checked, enter the ODC or Microsoft Data link to use as a default connection file.
LY
• The DDE operations group controls how the database interacts with other
applications:
ON
• Ignore DDE requests option ignores Dynamic Data Exchange (DDE) requests
from external sources.
• Enable DDE refresh option allows DDE links.
Access tries to save a changed record locked by another user. Enter a value
between 0 and 1000.
• Default File Format option - enhanced in Access 2003 - allows you to choose
SA
between Access 2000 and Access 2002-2003 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:
- 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.
• Open databases using record-level locking option locks only one row or
record instead of locking an entire page that may have several records.
LY
Setting International Options
• From the main menu, choose Tools > Options.
• From the Options dialog box, click on the International tab:
ON
E
PL
• 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.
M
• 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.
• The General alignment group gives you a choice between two modes:
SA
• 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
language-specific 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-to-right, 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.
LY
Setting Error Checking Options
• The Automatic Error Checking feature is new to Access 2003. Its function is
simple - to flag errors in report and form designs, and offer suggestions for
remedying them.
• From the main menu, choose Tools > Options.
ON
• From the Options dialog box, click on the Error Checking tab:
E
PL
• The Settings group allows you to activate error checking in Access, as well as
the manner in which error messages are displayed.
• Enable error checking option enables automatic error checking when checked.
M
• Error indicator color option allows you to choose the color of the error
indicator, which will appear in the upper-left comer of the error-causing control.
SA
• The Form/Report Design Rules group allows you to set specific guidelines
that dictate how a form or report can or cannot be designed. These include:
• Unassociated label and control option specifies that you cannot select a label
and a control that are not associated with one another.
• New associated labels option specifies that you cannot add a label to a form
or report that is not associated with another control.
• Keyboard shortcut errors option specifies that you cannot select a control
that demonstrates an invalid shortcut key.
• Invalid control properties option specifies that you cannot select a control
with invalid property values.
• Common report errors option specifies that you cannot have a report with
invalid sorting and grouping definitions, and that the report cannot exceed the
paper width.
LY
ON
E
• Dictionary Language option specifies the language. English (U.S.) is default.
PL
• Add words to option specifies the dictionary file to which to add words.
• Suggest from main dictionary only option tries to suggest corrections only
from the main dictionary. If you want the spell check to use the custom
dictionary as well, uncheck this option.
• Ignore words in UPPERCASE option ignores uppercase words while
spellchecking.
M
• Ignore words with numbers option ignores words with numbers while
spellchecking.
• Ignore Internet and file addresses option ignores internet or file addresses
SA
while spellchecking.
• The Language-specific group options are specific and apply to different
languages.
• AutoCorrect Options will be discussed later in this manual.
LY
• The Table design area includes:
• The Default field sizes group specifies the size for the Text data type fields,
ON
and the size for the Number data type fields.
• Default field type option sets the default data type.
• AutoIndex on Import/Create option sets automatic indexing for all fields that
start or end with the characters typed in this option box.
• The Show Property Update Options buttons allows you the discretion of
propagating property changes made in a table/query to controls that are bound
E
to that particular field.
• Show table names option displays the table names in the Table row of the
query grid.
• Output all fields option displays all the fields in a query’s underlying tables and
queries when you run the query.
• Enable AutoJoin option automatically creates an INNER JOIN between two
tables in the query grid – if and only if they have fields with the same name and
M
same data type, and one of these fields is the primary key field for its table.
• The Run permissions group specifies if others are permitted to view data
SA
• 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.
• The Query design font group - new in Access 2003 - allows you to set the
default font and font size for the results of your queries.
• Font option allows you to set the query result font type. The default is Tahoma.
• Font Size option allows you to set the query result font size. The default is 8.
LY
Setting AutoCorrect Options
• AutoCorrect options will automatically correct misspelled words as you type.
• From the main menu, choose Tools > AutoCorrect Options
ON
OR from the main menu, choose Tools > Options.
LY
• In the Don’t capitalize after field, type the abbreviation with the period at the
end.
• Click on the Add button to add this rule.
ON
• Click on the INitial CAps tab:
E
PL
• In the Don’t correct field, type the word you want to add.
• Click on the Add button to add this rule.
M
delete.
• Click on the Delete button to remove the rule.
LY
• 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.
OR right-click anywhere on the toolbar or menu bar and select Customize from
the popup menu:
Customizing Toolbars
LY
• Using any of the methods described above open the Customize dialog box.
• Click on the Toolbars tab:
ON
E
PL
• 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.
M
• Using any of the methods described above, open the Customize dialog box.
• Click on the Toolbars tab.
• Click on the New button:
LY
• ON
Make sure that the new toolbar is selected, and click the Properties button:
E
PL
M
SA
LY
• Toolbar Name option displays the name of the toolbar. You can edit the name
here.
• Type option allows you to choose what type of custom bar you want to create:
- Menu Bar
ON
- Toolbar
- Popup
E
• Docking option specifies what kind of docking is allowed for this custom bar:
PL
- Allow Any
- Can’t Change
- No Vertical
- No Horizontal
M
SA
• Show on Toolbars Menu option displays the toolbar name in the list or popup
menu.
• Allow Customizing option allows changes to the toolbar’s 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.
Removing Toolbars
LY
• 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:
ON
E
PL
Customizing Commands
• Once you create 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.
M
LY
• The cursor will change into an x:
ON
E
PL
• Drag the button toward the toolbar until the cursor changes to the plus sign +:
M
SA
LY
ON
Removing Buttons from Toolbars
• With the Customize dialog box open, drag the button off the toolbar:
E
PL
OR right-click on the button and choose Delete from the popup menu:
M
Customizing Options
SA
• Using any of the methods described above, open the Customize dialog box.
• Click on the Options tab:
LY
• The Personalized Menus and Toolbars group allows you to customize your
work with Menus and Toolbars:
ON
Show Standard and Formatting toolbars on two rows option displays the
two default toolbars on two rows – when available.
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
E
show all commands.
Reset my usage data clears all automatically saved menu and toolbar settings.
PL
• 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
M
displayed.
Review Questions
How would you:
• Set Access 2003 Options?
• Set View Options?
• Set General Options?
LY
• Set Spelling Options?
• Set Tables/Queries Options?
• Set AutoCorrect Options?
• Exclude AutoCorrect Rules?
• Remove AutoCorrect Rules?
• Add Replace AutoCorrect Rules?
ON
• Remove Replace AutoCorrect Rules?
• Open Customize Dialog Box?
• Customize Toolbars?
• Create Custom Toolbars?
• Remove Toolbars?
• Customize Commands?
E
• Add Buttons to Toolbars?
• Remove Buttons from Toolbars?
• Customize Options?
PL
M
SA
LY
• Print Documentation
• Export Documentation
• Use the Object Dependencies tool
ON
Optimizing Databases with Table Analyzer
• 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.
E
Using the Table Analyzer
• From the main menu, choose Tools > Analyze > Table.
PL
• 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 an example. Click Next to continue:
LY
•
ON
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
E
Next to continue:
PL
M
SA
• 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:
LY
ON
• If you select the wizard to make a decision you might see the message
containing the wizard’s recommendation. If so, click OK.
• The next page of the wizard represents a diagram of the suggested
redistribution of information:
E
PL
M
SA
• You can see more instructions on how to handle the wizard’s suggestions by
clicking the Tips button at the top right-hand corner of the dialog box:
• Read the Tips instructions to help you implement the wizard’s suggestions:
LY
• The wizard suggests that you create a Lookup Table for each field with a link
ON
from the original Employees table (Table1) to Table2 and Table3:
E
PL
M
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:
SA
LY
ON
• Enter the new Table Name and click OK:
E
• When you finish renaming tables, click on Next to continue.
PL
• If there is a field that can be used as a primary key, select that field in the table
and click on the Set Unique Identifier button:
SA
LY
ON
• The field is now a primary key, marked with the key icon:
E
• To undo the change, select the field and click on the Undo button:
PL
M
SA
• 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:
LY
• The generated primary key field is added, marked with the key icon:
•
ON
After adding primary key fields, click on Next to continue.
E
• On the final page, the wizard offers to create a query for you that looks like your
original table and has the same name. Letting the wizard create a query
ensures that you can continue to work with all the forms and reports created
PL
LY
• The Performance Analyzer dialog box opens, containing tabs for each type of
database object:
ON
E
• Select the appropriate tab, or click on the All Object Types tab to list all
database objects.
PL
• Check the check box besides the object(s) you want to analyze and click the OK
button:
M
SA
• 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:
LY
• A Performance Analyzer message box displays the analyzing process:
ON
At the end of the process, the Performance Analyzer displays the Analysis
Results:
E
PL
M
SA
• 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 analyzer’s recommendations.
• Click Close to close the Performance Analyzer.
LY
object:
ON
E
• 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.
PL
• The Include for Table group allows you to limit what table elements you want to
print:
- Properties
- Relationships
• The Include for Fields 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
LY
want to print:
- Nothing
- Names and Fields
- Names, Fields, and Properties
ON
• The Status Bar displays the analysis progress.
Printing Documentation
• The report is opened in Print Preview:
E
PL
M
SA
• Right-click on the report to open the popup menu where you can configure Page
Setup and other print options:
LY
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
ON
OR from the main menu, choose File > Export.
• This will open the Export Report dialog box where you can select the location,
file name and file type for export:
E
PL
M
• 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
SA
button:
LY
objects that your object relies upon.
ON
AutoCorrect feature, which tracks information about object interdependency.
• From the main menu, select Tools > Options.
• In the Options dialog box, click on the General tab:
E
PL
M
SA
• Click on the Track name AutoCorrect info checkbox, and in the displayed
dialog box, click OK:
LY
• From the main menu, select View > Object Dependencies
OR right-click on the object, and select Object Dependencies from the menu:
ON
E
• The Object Dependencies task pane will display a list of the objects that are
dependent on the object that you selected. To see a list of objects that your
object relies on, select the Objects that I depend on option button:
PL
M
SA
• You can also click on an expand (+) icon to see a complete list of object
elements:
Review Questions
How would you:
• Use the Table Analyzer?
• Rename Tables?
• Add Key Fields?
• Use the Performance Analyzer?
LY
• Use the Documenter Analyzer?
• Print Documentation?
• Export Documentation?
• Use the Object Dependencies tool?
ON
E
PL
M
SA