Microsoft Access 2010 Bible

(Rick Simeone) #1

Part II: Programming Microsoft Access


418


In addition to variables, I take a look at code editor options, working with VBA procedures and
passing parameters to procedures.

Introducing the Access VBA Editor


Because I’ll be writing quite a bit of code in this chapter, and in the following chapters, this seems
a good place to discuss a few options when using the VBA code editor and writing VBA code.

The Access code editor supports a number of important features to help you write and manage
VBA code. For example, any line of code ending in an underscore character preceded by a space is
recognized as a statement that is continued on the next line, making it easy to see all the parts of
very long VBA statements. Notice the statement that starts out If SysCmd in Figure 11.1. This
statement actually occupies two lines of code: the one containing the If statement and the line
immediately under it.

FIGURE 11.1

The continuation character is a welcome feature in the Access VBA Editor.


Tip
When you use continuation characters, it is a good idea to indent the continued lines of code. Being able to
recognize continued lines of code without having to keep track of the continuation characters is important.


The Access VBA statement continuation is quite powerful. You can split long declarations such as
Windows API declares, and you can even split long strings into multiple lines.

Cross-Reference
The Windows API is discussed in detail in Chapter 27.

Free download pdf