Chapter 18: Automating Your Application with Macros


Overview

In Microsoft Office Access 2007, you can define a macro to execute just about any task you would otherwise initiate with the keyboard or the mouse. The unique power of macros in Office Access 2007 is their ability to automate responses to many types of events without forcing you to learn a programming language. The event might be a change in the data, the opening or closing of a form or a report, or even a change of focus from one control to another. Within a macro, you can include multiple actions and define condition checking so that different actions are performed depending on the values in your forms or reports.

Macros are particularly useful for building small, personal applications or for prototyping larger ones. As you’ll learn in Chapter 19, “Understanding Visual Basic Fundamentals,” you probably should use Microsoft Visual Basic for complex applications or for applications that will be shared by several users over a network. However, even if you think you’re ready to jump right into Visual Basic, you should study all the macro actions first. You’ll find that you’ll use nearly all of the available macro actions in Visual Basic, so learning macros is an excellent introduction to programming in Access in general.

Note 

image from book The examples in this chapter are based on the Wedding List Macro (WeddingMC.accdb) sample database on the companion CD included with this book. The results you see from the samples in this chapter might not exactly match what you see in this book if you have changed the sample data in the files. Also, all the screen images in this chapter were taken on a Microsoft Windows Vista system with the display theme set to Blue. Your results might look different if you are using a different operating system or a different theme.

In this chapter, you will

  • Learn about the various types of actions you can define in macros

  • Tour the macro design facility and learn how to build both a simple macro and a macro with multiple defined actions

  • Learn how to manage the many macros you need for a form or a report by creating a macro group

  • See how to add conditional statements to a macro to control the actions Access performs

  • Learn about the new macro features in Access 2007 including embedded macros, error trapping in macros, temporary variables, and macro actions that are not trusted.

  • Learn how to reference other form and report objects in macros

  • Understand some of the actions automated with macros in the Wedding List Macro sample database

Note 

image from book In Article 6, “Macro Actions,” on the companion CD, you’ll find summaries of the macro actions and of the events that can trigger a macro. You might find that article useful as a quick reference when you’re designing macros for your applications.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

Similar book on Amazon
Access 2007: The Missing Manual
Access 2007: The Missing Manual
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoft Office Access 2007 Forms, Reports, and Queries
Microsoft Office Access 2007 Forms, Reports, and Queries
Alison Balter's Mastering Microsoft Office Access 2007 Development
Alison Balter's Mastering Microsoft Office Access 2007 Development

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net