Access VBA Macro Programming

(Joao Candeias) #1

Many users are unaware that, in addition to the database application of Access, there is an
extremely powerful programming language built into Access that you can use to design your
own applications. You can use VBA code to write macro applications in VBA that do some
very powerful things. Amacro applicationis a procedure written in VBA code that performs
certain tasks. This could be something like outputting a text file from a table or creating or
editing a query. Whatever you decide to do with them, macros automate tasks and make life
easier for you and the users of your database.
The language works in conjunction with object structures and hierarchies, and you can
even create your own objects by using class modules (see Chapter 21). Some people may
argue that VBA is not an object-oriented language, but it certainly has all the features of one.
These VBA projects can be accessed through a companion program called the Visual
Basic Editor (VBE). PressALT-F11to see the window shown in Figure 1-3. You can also click
Create on the Access menu bar and then use the drop-down on the Macro/Module icon in the
“Other” group of the ribbon. However, this creates a new module in addition to any others
you have, so you may not wish to do this.


Chapter 1: The Basics 5


Figure 1-2 The standard Access database screen

Free download pdf