|Writing VBA Code - The Basics|
|The VBA Editor|
|Create a Simple Program|
Writing Access VBA Code - The Basics
To begin writing VBA code, you need to understand how VBA fits into the structure of Microsoft Access. In an Access database, VBA code is stored in modules. A module is simply a container of VBA code. This VBA code can be called upon to perform a specified task.
A module can be one of 2 types:
- Standard:contains code that can be accessed by all database objects. You can always see standard modules in the Modules group on the Navigation pane
- Class: contains code that's associated with either a form or a report object. An example of a form module is an event procedure, such as the click event for a button on a form. Class modules can also be also be associated with a custom object. We'll focus on form and report modules for now and will look at custom objects later on.
We'll explore the differences between the 2 types of module in later tutorials.
1. All standard modules are found here in the Navigation pane. Some class modules can also appear here but not all. Some class modules are hidden behind form or report objects. You may not have any modules listed here if you have not created any.
2. In the Objects Explorer in the VBA Editor Modules are grouped into standard (Modules) and Class Modules
3. VBA code contained in the PurchaseOrders module in the VBA Editor