Part II

Programming Microsoft Access

This part explains the art and science of Visual Basic for Applications (VBA) programming. Very few professional-quality Access applications have been written without liberal use of the VBA programming language and its capabilities. VBA provides you with powerful tools for adding capabilities and flexibility to your applications.

VBA is a fully qualified programming language and is used in many other Microsoft products, including all the main members of the Microsoft Office suite (Word, Excel, and PowerPoint), in addition to Microsoft Access.

Many user requirements simply cannot be implemented without using VBA code. VBA code provides functionality that goes far beyond simply opening forms and reports and controlling the user interface. You’ll use VBA code to validate data, as well as transform and combine data in new and interesting ways. VBA code is used to import and export data, respond to user input, and handle the mistakes inevitably made by users.

VBA code enables you to seamlessly integrate with the other applications in Microsoft Office. For instance, using a surprisingly small amount of code, you can implement a very powerful mail-merge system by combining Access data with Word document templates. (We discuss application integration in Part III of this book, but we wanted to give you a preview of what’s coming up next!)

As you’ll see in this part, VBA is a large and somewhat complex programming language. If you aren’t already using VBA, you’ll want to carefully read the chapters in this part and work the examples until you’re comfortable creating VBA modules and composing programming statements.

These chapters provide you with the essential skills necessary to become comfortable writing VBA code. You’ll learn where VBA code lives within an Access application, how to compose VBA statements, and how to hook up VBA code to your forms and reports.

We can’t overemphasize how important VBA programming skills are to professional database developers. Because VBA is used in so many different platforms (Access, Word, Excel, and so on), your programming skills are transferable to many situations beyond database development. Also, the VBA programming language is very similar to the languages used in Microsoft Visual Studio. Quite frankly, there is no limit to what you can accomplish with the skills you develop in learning Access VBA.