Chapter 27: Accessing Data with VBA Code
IN THIS CHAPTER
Working with Access data
Examining the ADO object model
Looking at DAO objects
Updating a table with VBA code
Data access and data management are at the core of any database application. Although you can do a fine job building applications with bound forms, using Visual Basic for Applications (VBA) code to access and manipulate data directly provides far greater flexibility than a bound application can. Anything that can be done with bound forms and controls can be done with a bit of VBA code using ActiveX data objects (ADO) or data access objects (DAO) to retrieve and work with data.
The VBA language offers a full array of powerful commands for manipulating records in a table, providing data for controls on a form, or just about anything else. This chapter provides some in-depth examples of working with procedures that use SQL and ADO to manipulate database data.
On the Web
In the Chapter27.accdb database, you'll find a number of forms to use as a starting point and other completed forms to compare to the forms you change in this example.
Working with Data
The first thing to note when discussing data access objects is that the DAO and ADO object models are separate from the Access object model. DAO and ADO represent the objects managed and “owned” by the Access database engines (ACE or Jet), which are software components installed along with Office. In the past, Excel (with the MSQuery add-on) and Visual Basic (the stand-alone ...