Controlling Access through VBA

In This Chapter

^ Working with objects and collections ^ Understanding properties and methods ^ Using properties and methods in VBA code ^ Help with objects, properties, and methods sing Visual Basic for Applications (VBA) in Access is all about writing code to manipulate Access objects, which is just about everything you see on your screen in Access. Coming up with a simple example is difficult because virtually everything is an object. Every table, query, form, report, macro, and module is an object. Every record and field in every table and query is an object. Every control on every form and report is an object. Even the Access Ribbon is an object that you can manipulate with VBA. (See a pattern here?)

Every object in a database has a unique name. Most objects have properties and methods that VBA can manipulate. The properties and methods exposed by an object are the steering wheels, if you will, that allow VBA to grab hold of an object and take control. The names that define all the objects that VBA can manipulate are organized into an object model.

Using VBA in Access is largely a matter of manipulating database objects to achieve a goal. In this chapter, we walk you through the basics of objects that Access exposes to VBA. Access has so many objects, properties, and methods that we have no hope of explaining them all in a single book. You have no real hope of ever memorizing them all, either, because there's just too darn many of them. What you really need is the skill of being able to find the information you need, exactly when you need it. Thus, much of this chapter focuses on that skill.

0 0

Post a comment