Access VBA Macro Programming

(Joao Candeias) #1

To remove this procedure, simply delete all the lines for it or delete the line MsgBox
"Hello World" by pressing theDELETEkey. Another way to prevent code from running is to
turn it into a comment by putting the single quote (') character in front of the line:' MsgBox
"Hello World". This line will then turn green and will not be used. Comments are also used
to place explanations and descriptions of your code inside a macro so it can be understood at
a later date.


More Exploring of the VBA Project Window


Going back to the Project Explorer and the tree showing the project (in the top left-hand
corner of screen), there are also objects for forms and reports that have VBA modules
attached to them. Every form and report is a separate object and is represented as such in the
Project tree.
Modules that you insert via the VBE do not have events, but modules related to forms and
reports do. These can range from the form being opened to the user making a data change.
These events give the VBA programmer places to set code up to intercept the user’s actions.
This is more fully explained in Chapter 9.


Chapter 1: The Basics 11


Figure 1-6 Hello World message box

Free download pdf