O'Reilly logo

Microsoft® Access® 2010 Programmer's Reference by Jerry Dennison, Geoffrey L. Griffith, Rob Cooper, Teresa Hennig

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 6. VBA Basics

WHAT'S IN THIS CHAPTER?

  • Laying the foundation for writing solid, reusable VBA code

  • Understanding the basic components of a VBA procedure

  • Naming and using variables

  • Using other VBA components

  • Working with VBA objects, properties, and methods

  • Writing code in modules and behind forms and reports

  • A few, easy-to-follow examples

Now that you know a bit about automating Access, using the various types of macros, and how VBA fits into the Access automation picture, you are almost ready to write some code. But before you launch into that, we will review some VBA basics to help ensure that we have a strong foundation to build on.

This chapter contains vital information that will help you to better understand and utilize what you'll learn in subsequent chapters. Veteran programmers may find a refresher helpful, but the chapter is mostly geared for those who are just delving into VBA, including those who may have experience with another programming language or VBScript. We'll examine the basic VBA programming objects, learn about variables and how to declare them, and review some of the VBA structures that you'll use in your code. Along the way, you'll build a few procedures, and you will soon gain the skill and confidence to modify those procedures as well as to create your own from scratch. All of the code snippets are provided on Wrox.com in the companion file for this chapter, ch6_VBABasics_Code.txt.

THE MINDSET OF A PROGRAMMER

Let's start by establishing a frame of reference ...

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