12
Access Access The L Line The L Line The Express Line to Learning The Express Line to Learning 2007 2007 L Line L © Wiley Publishing. 2007. All Rights Reser

Access The L Line The Express Line to Learning 2007 L Line L © Wiley Publishing. 2007. All Rights Reserved

Embed Size (px)

Citation preview

AccessAccess

The L LineThe L LineThe Express Line to LearningThe Express Line to Learning

20072007

L Line

L

© Wiley Publishing. 2007. All Rights Reserved.

Automating Access with Macros

11

* Learning to automate with macros* Programming without coding* Creating a Switchboard* Using a macro group* Putting on the finishing touches

Stations Along the Way

Adding Macros to Your Toolkit

Macros… Help you perform repetitive tasks Work with Access forms, reports, queries,

and tables Have a base in Visual Basic for

Applications (VBA) Automatically interface with VBA

(programming savvy not required!) Are easy to build and use

Anatomy of a Macro Macro

ComponentMust

Have?What It Is / Does

Action Yes Identifies purpose

Arguments Yes Identifies objects involved

Condition No Sets a filter or limitation

Comment No Describes the macro’s action

Name Yes Names the macro within a group

Types of Macros

Embedded: o Are part of a form or report

o Often appear as command buttons

Stand-alone:o Exist as independent database objects

o Can be executed from a form, report, or control

o Appear in the left navigation pane

The Classic Switchboard

Acts as the database’s index page

Usually consists of a form with buttons

Offers user navigation to all other forms and reports

Typically opens with the database

Can contain an Exit button

Building a Switchboard

Start with the Switchboard Manager under Database Tools

Add action-related buttons as Switchboard entries

Avoid too many entries on one Switchboard form

Design to separate entries by function

Edit like any other form in Layout View or Design View

Embedded VersusStand-Alone Macros

Use Embedded Use Stand-Alone

For one-off situations On multiple forms or reports

When you copy forms or reports to other databases

When you execute outside of forms or reports

To create macro groups

Multi-Step Macros

Can be embedded or stand-alone

Are single macros that perform multiple, sequential steps

Require a defined data source

Macro Groups

Contain named, stand-alone macros Save related macros in a single file Organize macros by function or

usage Require a group plus individual

naming convention

Group_Name.Macro_Name

Macro Finishing Touches

Close Access: Adds a professional touch

RunApp: Runs an external application from within Access

AutoExec: Automatically executes when a database opens

Discussion Topics• Why should I use macros?

• How do I create a Switchboard?

• Can I run external applications and programs from within Access?

• What’s the best type of macro to use?

• What’s the difference between embedded and stand-alone macros?