Expand the range of your Access proficiency with VBA programming, using this guide designed specifically for Access power users. Learn VBA fundamentals, then discover how to connect Access and VBA through ActiveX Data Objects (ADO), and how to extract, manipulate, and retrieve data using SQL queries. Benefit from expert advice on error handling, get the most out of forms, reports, and tables, and save time with VBA coding and debugging tips. From the basics to advanced techniques, this comprehensive treatment provides you with the information you need to produce the exact results you desire.

  • Call up forms and reports using VBA
  • Build dynamic Data Access Pages
  • Program and assign record data sources to forms and reports
  • Learn the fundamentals of SQL and how to use it in VBA
  • Understand the ADO object model and its components
  • Use modules, declare variables, build looping and decision structures, use procedures and functions, and build arrays
  • Generate recordsets based on dynamic criteria
  • Use Office menus and toolbars to invoke your code
  • Develop applications that multiple users can run at the same time

About the Authors

Charles E. Brown has taught VBA programming to many beginner programmers, and has produced VBA code for Swiss Bank Corporation, the US government, NASA, and Price Waterhouse Accounting.

Ron Petrusha is a computer book author and editor with over 25 years of experience in developing computer applications.

Access VBAProgramming

Charles E. Brown
Ron Petrusha

McGraw-Hill/Osborne2100 Powell Street, 10th FloorEmeryville, California 94608U.S.A.

To arrange bulk purchase discounts for sales promotions, premiums, or fund-raisers, please contact McGraw-Hill/Osborne at the above address. For information on translations or book distributors outside the U.S.A., please see the International Contact Information page immediately following the index of this book.

Access VBA Programming

Copyright 2004 by The McGraw-Hill Companies. All rights reserved. Printed in the United States of America. Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication.

1234567890 FGR FGR 01987654

ISBN 0-07-223197-1

Brandon A. Nordin

Vice President & Associate Publisher
Scott Rogers

Editorial Director
Wendy Rinaldi

Project Editor
Carolyn Welch

Acquisitions Coordinator
Athena Honore

Technical Editor
David Schulz

Copy Editor
Judith Brown

Marian Selig

Claire Splan

Lucie Ericksen
John Patrus
Kelly Stanton-Scott

Kathleen Edwards
Melinda Lytle
Greg Scott

Series Design
Roberta Steele

Cover Design
Tom Slick

This book was composed with Corel VENTURA Publisher.

Information has been obtained by McGraw-Hill/Osborne from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill/Osborne, or others, McGraw-Hill/Osborne does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information.

About the Authors

Charles E. Brown is one of the most noted authors, teachers, and consultants in the computer industry today. His first two books, Beginner Dreamweaver MX and Fireworks MX: Zero to Hero, have received critical acclaim and are consistent bestsellers. This year, Charles will be releasing books on VBA for Microsoft Access, and the new Microsoft FrontPage environment. He is also a Fireworks MX contributor for the MX Developer’s Journal. In addition to his busy writing schedule, he conducts frequent seminars for Future Media Concepts, speaking about the Macromedia development environment. In 2004, he will also be involved in developing e-learning courses using Macromedia’s RoboDemo development environment.

When Charles is not writing and teaching, he is a consultant for many high-profile websites. This year, he is placing a lot of his web development efforts with the Flash MX 2004 Professional environment. He feels strongly that this is the future of web development.

Charles is also a noted classical organist, pianist, and guitarist who studied with such notables as Vladimir Horowitz, Virgil Fox, and Igor Stravinsky. It was because of his association with Stravinsky that he got to meet, and develop a friendship with, famed 20th-century artist Pablo Picasso.

Ron Petrusha has over 25 years of experience in the computer industry and is the author of ten computer books and numerous print and online articles. He is the principal of Howling Wolf Consulting Services, a company that provides editorial services to the publishing industry and also offers application and web development services using Microsoft technologies. He can be reached at