Datasheet

Book VIII
Chapter 1
What the Heck
Is VBA?
Enabling VBA Code
575
Enabling VBA Code
Like any programming language, people can use VBA to create code that
does good things or code that does bad things. Whenever you open a data-
base that contains code, Access displays a warning in the Security bar. The
warning doesn’t mean that there’s “bad code” in the database; it just means
that there
is code in the database. Access has no way of determining
whether the code is beneficial or malicious. That’s a judgment call only a
human can make.
If you trust the source of that code, you have to click the Enable Content
button to make the code executable. Otherwise, the code is disabled, as are
many features of the Visual Basic Editor.
How code is organized
All modules organize their code into a Declaration section at the top, fol-
lowed by individual procedures, as shown in Figure 1-6. The
Declaration
section contains options, written in code format, that apply to all procedures
in the module. Each procedure is also a chunk of VBA code that, when exe-
cuted, performs a specific set of steps.
Declarations
Sub procedure
Function procedure
Figure 1-6:
Modules
consist of
declarations
and
procedures.
38_036494 bk08ch01.qxp 11/17/06 8:34 AM Page 575