@dullster - Let's clarify something. Where does VBA code go? Basically, it goes only in a limited number of places as starting points. Why the limit? Because MSACCESS.EXE is the MAIN program. All you can ever do is supply module-based data (variables and structures), functions, and subroutines. The first part of the answer is that VBA code goes in modules, with two flavors of most importance - general modules (usually where you put general utility routines) and class modules (associated with specific actions in forms or reports.) In either case, you put the VBA code in a module. But that only defines the code. How do you get to it?
Obviously, a rhetorical question... Access does things based on "Events" which are standardized points where some critical action happens. The event name usually tells you what the event is all about. For example, Form_Open - meaning the object used to store the specification of the form gets opened; Form_Load - meaning the contents of the form specification get loaded; Form_Current - meaning the moment when the form's current record is determined and used to load up bound controls. Look up "Events" online for a long lost.
On a form or report, when you open the Properties panel, one of the tab options is the Events panel, which lists the places / actions for which you are allowed to provide supplemental code that augments or even changes what the "standard" Access action would be. VBA code "behind" an event is how you customize or automate the behavior of your form or report. Some events are called with the option to CANCEL an event. For example, you can CANCEL the Form_Open event if you determine that the current user shouldn't be using that form. You can CANCEL an update if you don't think the data on the form is accurate. You can CANCEL an Unload if you decide you aren't ready to start closing down the form.
How do you actually activate VBA code elements? Two places where your VBA code becomes significant are at the entry points for events, and for those cases of public functions that can be called during execution of a query. You can click on one of the Event properties to select the option [Event Procedure], which automatically builds a nearly empty shell and opens the VBA page for you. The other method is to build a PUBLIC function that uses VBA code to return a function value. Has to be public for SQL to see VBA code, and has to be a function because SQL code cannot call a true subroutine. It requires a return value, which means "must be a function."
This is a "steep learning curve" topic so I cannot tell you everything there is to know about VBA. But this might help orient you into seeing WHY VBA is useful.