Where VBA Fits In

In This Chapter

^ Describing Access ^ Discovering VBA ^ Seeing where VBA lurks ^ Understanding how VBA works

7his is a book about using Visual Basic for Applications (VBA), which is a programming language that helps you program, tweak, and squeeze productivity from Access. VBA, which is embedded in Access, is a sophisticated set of programming tools that you can use to harness the power of a packaged application like Access. Just like you need to know how to walk before you can run, you need to know Access before you can start to use Access VBA.

Maybe you want to use Access to manage a large mailing list. Maybe you need Access to manage your whole business, including customers, products, and orders. Perhaps you need to manage enrollments in courses or events. Whatever your reason for using Access, your first step will always be to create the tables for storing your data. From there, you can then create queries, forms, reports, and macros to help manage those data. All these steps take place before you even get into VBA. So in this book, I have to assume that you're already an experienced Access user who needs more than what queries, forms, reports, and macros can provide. If you're new to Access, this is not a good place to start. If you need to brush up further on Access, Access 2003 For Dummies (John Kaufeld, Wiley) or Access 2003 All-in-One Desk Reference For Dummies (Alan Simpson, Margaret Levine Young, and Alison Barrows; Wiley) would be a good place to start.

Although Access has progressed through many versions over the years, VBA has remained relatively unchanged. I used both Access 2002 and Access 2003 to create this book, but the code examples presented in this book should work fine in just about any version of Access. So now, before launching into VBA, take a moment to discuss what tables, queries, forms, and reports are all about, and how VBA fits into the overall scheme of things.

Taking a Look at Access

Access, part of the Microsoft Office suite, is a huge database management system that you work by using modern object-oriented methods. (The term object-oriented stems from the fact that everything you create in Access — a table, form, report, or whatever — is considered an object.

The Access database window, as shown in Figure 1-1, is the main container in which you store all the main objects that make up a single database. The left column of the database window is the Object list, and each name in the list represents a type of object, as summarized here.

Figure 1-1:

The Access database window.

Figure 1-1:

The Access database window.

VBA Dummies : Database (Access 2000 file ... 0ÍÜJÍ3

? Run HH Design ^ New | X | Iff

Objects O Tables Hp Queries ËU Forms É2I Reports •fa] Pages ¿2 Macros


^ iModulell

^ Modules


¡^ Tables: Tables contain the raw data that all other object types display and manage. Data in tables is stored in records (rows) and fields (columns).

¡^ Queries: Use queries to sort and filter data as well as define relationships among multiple related tables.

¡^ Forms: Access forms are similar to printed fill-in-the-blank forms, but they allow you to view and change data stored in Access tables.

¡^ Reports: Reports are objects that define how data should be presented on printed reports.

¡^ Pages: Pages are similar to forms, but users can access data in tables through a Web browser rather than directly through Access.

¡^ Macros: Macros provide a means of automating certain aspects of Access without programming.

The Modules container, as you'll soon discover, is one of the places where you store VBA code. If you're not already familiar with modules, that's fine. Modules are what this book is really all about. Groups, of course, aren't really separate objects but rather just collections of existing objects. Sort of Access's version of Favorites.

One of the most important things to understand is that you don't use VBA "instead of" other objects like tables and forms. You use VBA to enhance the capabilities of other object types. Therefore, it makes no sense to even try VBA until you have a firm grasp of the purpose and capabilities of those other object types in Access.

0 0

Post a comment