Read an Excerpt
- What's in the Book
- This Book's Special Features
- The Examples Used in the Book
So, you've been using Access for a little while. Now that you have used Access to build databases for yourself, and maybe some friends and/or colleagues, you are ready for the next step: developing automated database applications. If you want quicker, easier, and more accurate data entry; faster searching; better reporting; the ability to manipulate data behind the scenes; and much more, this book is for you.
With Microsoft Office Access 2007 VBA we show you how to unleash the power of Access using Visual Basic for Applications (VBA). VBA is a superset of the Visual Basic programming language that combines Visual Basic command syntax and a rich assortment of functions with the capability to control objects in your application (hence the "A" in "VBA").
This book shows you VBA in action with real-world examples. We introduce you to programming and its use within Access and hold your hand every step of the way. With the information provided in this book you will explore commands, functions, properties, and methods and how to use them to make your applications dance to your tune and jump through hoops.
What's in the Book
This book isn't meant to be read from cover to cover, although you may find that you can't put it down! Instead, most of the chapters are set up as self-contained units that you can dip into and extract whatever nuggets of information you need at will. If you're a relatively new Access user, I suggest starting with the first one or two chapters in each of the book's four main parts to ensure you have a solid foundation in the fundamentals of working with data in Access tables by using queries, forms, and reports.
The book is divided into four main parts. To give you the big picture before diving in, here's a summary of what you find in each part:
- Part I, "The Building Blocks"The nine chapters in Part I introduce you to the building blocks you use to build VBA modules. We start by explaining the advantages of using VBA. From there we introduce you to the Visual Basic Editor (VBE). This is where you enter, edit, and test all your code. In Chapter 3, "Using Variables, Constants, and Data Types," we talk about the various ways you assign and identify data. And Chapter 4, "Using Built-in Functions," moves on to a discussion of the many functions that Access and VBA provide. In Chapter 5, "Building Procedures," the topic is procedures in their various forms and modules, the containers for your code. Chapter 6, "Conditional and Looping Statements," gets into the meat of coding as we go over important syntax for branching using conditions and repeating code with looping. We follow that with a chapter on using arrays. And then Chapter 8, "Object and Event-Driven Coding," explains how to launch your programs using object and event-driven coding. Part I closes with a chapter on scope, which covers lifetime and visibility of variables and procedures.
- Part II, "Working Within the User Interface"This part shows you how to use VBA to create a great user interface. You learn to work with form and report design and understand their components such as controls and sections. We introduce you to the wide variety of different controls available and show you how to use them. You learn what events are and how they are triggered and discover how to create different menus and use VBA to navigate through your application. Part II ends with a discussion of collections and how to reference Access objects.
- Part III, "Working with Data"This part of the book deals with working directly with data. You will learn the two main ways to get at data: Data Access Objects (DAO) and ActiveX Data Objects (ADO). DAO and ADO are presented in a comparative fashion. We cover these object models as they apply to the Access Connectivity Engine (ACE), the database engine under the hood of Access. ACE is the successor to the Joint Engine Technology (JET) database engine, so you will see JET and ACE terminology where appropriate. You will learn not only how to find, add, edit, and remove data, but also how to create and modify the structure of how data is organized (the shema). With DAO, ActiveX Data Objects eXtentsion (ADOX), and Data Definition Language (a subset of SQL), you can modify and create databases, tables, fields, indexes, relationships, and queries. This section also touches on some of the more advanced topics of database analysis, such as retrieving a list of all the relationships in your database or discovering all the computers that are connected to your database.
- Part IV, "Advanced VBA"In this final section, you encounter working with other types of data files such as Excel spreadsheets, Word documents, and flat files. You also learn the basics of automation with other Office applications. Finally, we show you how to call on the Windows Application Programming Interface (API).
- AppendixThis includes a great reference on Structured Query Language (SQL) in its many different flavors and shows how to integrate SQL into your applications.
Microsoft Office Access 2007 VBA is organized to give you a firm foundation for using VBA in a logical manner that builds your knowledge step by step. We have also made the book a functional reference for VBA techniques.
- StepsThroughout the book, each Access task is summarized in step-by-step procedures.
- Code linesLines of VBA code, commands, and statements appear in a monospace typeface.
- Required TextAny text you need to enter will be boldfaced.
- ItalicsTechnical terms being defined appear in italic, such as RecordSet Property.
- SyntaxWithin code statements certain arguments will be italicized to denote where you will need to substitute values relevant to your task. Brackets () are used to indicate optional arguments.
This book also uses the following elements to draw your attention to important (or merely interesting) information.
Note - Notes are used to provide sidebar information about the topic being discussed. They provide extra insights that help you understand the concepts being covered.
Tip - Tips tell you about Access methods that we have found to make coding with Access easier, faster, or more efficient.
Caution - Caution elements warn you about potential pitfalls waiting to trap your code, such as common errors that might occur, and how to avoid or fix them.
→ Cross-reference elements point you to related material elsewhere in the book.
Case Study - You'll find case studies throughout the book based on an Inventory Tracking application. They are designed to show you how to apply what you've learned.
The Examples Used in the Book
All the tables, objects, and code samples referred to in this book can be found at http://www.quepublishing.com. There will be a folder for each chapter. The files build on the examples from the previous chapters. The Introduction file will be pretty bare bones and just have the objects that don't pertain to specific lessons we cover. You can build on the Introduction files or use the files that already have the examples coded for you.
© Copyright Pearson Education. All rights reserved.