Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 10: VBA Programming Fundamentals


411


Auto Indent
Auto Indent causes code to be indented to the current depth in all successive lines of code. For
example, if you inserted four spaces (or tabs) in front of the current line of code, each line of code
following the current line will be automatically indented four spaces.

Auto Syntax Check
When the Auto Syntax Check option is selected, Access checks each line of code for syntax errors
as you enter it in the code editor. Many experienced developers find this behavior intrusive and
prefer to keep this option disabled, instead letting the compiler point out syntax errors. Most of the
syntax errors caught by Auto Syntax Check are the most obvious spelling errors, missing commas,
and so on.

Break on all Errors
Break on All Errors causes Access to behave as if On Error GoTo 0 is always set, regardless of any
error trapping you might set up in code. When this option is selected, Access stops on every error,
making it easier to debug the code.

Require Variable Declaration
This setting automatically inserts the Option Explicit directive into all VBA modules in your
Access application. This option is not selected by default in recent versions of Access.

Tip
When you get used to having Option Explicit set on every module (including global and class modules),
the instances of rogue and unexplained variables (which, in reality, are almost always misspellings of declared
variables) disappear. With Option Explicit set in every module, your code is more self-explanatory and
easier to debug and maintain because the compiler catches every single misspelled variable.


Compile on Demand
Compile on Demand instructs Access to compile modules only when their procedures are required
somewhere else in the database. When this option is unchecked, all modules are compiled anytime
any procedure is called.

Auto List Members
This option pops up a list box containing the members of an object’s object hierarchy in the code
window. In Figure 10.11, the list of Application objects appeared as soon as I typed as the period
following Application in the VBA statement. You select an item from the list by continuing to
type it in or scrolling the list and pressing the spacebar.

Auto Quick Info
When Auto Quick Info has been selected Access pops up syntax help (refer to Figure 10.12) when
you enter the name of a procedure (function, subroutine, or method) followed by a period, space,
Free download pdf