O'Reilly logo

Access™ 2007 Bible by Gavin Powell, Joseph C. Stockman, Jennifer Reardon, Michael R. Groh, Michael R. Irwin, Cary N. Prague

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Accessing Data with VBA Code

IN THIS CHAPTER

  • Viewing and using SQL Statements

  • Using ADO

  • Updating tables

  • Updating a calculated field

  • Adding new records

  • Deleting records

  • Creating code that finds a record by using a form field

  • Creating code that uses a bookmark to find a record

  • Using a form's filter options

  • Using a form to filter records

  • Creating a parameter query

  • Interfacing a parameter query to a form dialog

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 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 ADO (ActiveX Data Objects) to retrieve and work with data.

The Visual Basic for Applications (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.

Note

In the Chapter14.accdb database, you will 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. All of the examples in this chapter use modified versions of the frmProducts form and tblProducts.

Understanding SQL

Many of the VBA procedures that you write for working with Access data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required