Microsoft Office Tutorials and References
In Depth Information
Enabling VBA Code
Enabling VBA Code
As with any programming language, people use VBA to create code that does
good things and code that does bad things. Whenever you open a database
that contains code, Access displays a warning in the Security bar. The
warning doesn’t mean that the database contains bad code; it just means that
the database does contain code. Access has no way of determining whether
code is beneficial or malicious; only a human can make that judgment call.
If you trust the source of that code, click the Enable Content button to make
the code executable. Otherwise, the code is disabled, as are many features
of Visual Basic Editor.
All modules organize their code with a Declaration section at the top
followed 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
executed, performs a specific set of steps.
Figure 1-6:
consist of
Chapter 1
Procedures in a module fall into two major categories: sub procedures and
function procedures. Both types of procedures use VBA code to perform
some task. The next sections outline some subtle differences in how and
where these procedures are used.
Sub procedures
A sub procedure consists of one or more lines of code that make Access
perform a particular task. Every sub procedure starts with the word Sub,
Search JabSto ::

Custom Search