Modules are best described as containers for holding VBA code. Modules can contain declarations and procedures. VBA code that is placed in one or more modules can be called from an Access application to perform a specified task. I discuss this in greater detail throughout.
Figure 2-1 shows a sample module displayed in the Visual Basic Editor.
Note that the previous figure has four areas labeled. Each one will now be mentioned briefly.
Object navigation box – Use to select the object to work with
Declarations/Procedure navigation box – Use to navigate to the general declarations section or to a particular procedure
Declarations – Contains the declarations for the module
Procedures – Contains the sub procedures and functions for the module
When you select the Declarations/Procedure navigation box, a list appears that displays the existing procedures of the module, as shown in Figure 2-2.
Now that you have a basic idea of what a module is (container for code), let's turn to the different types of modules.