You put the code in the Format procedure for the section that contains those controls in the Design view. If the controls are in the Detail section, that would be Detail_Format.
----------
This next part is kind of lengthy, but it's not easy to explain.
----------
The code in the report Format sections is event driven, but Access is doing the "driving". When the report is run, Access runs the Report_Open. Then each section (vertically), as you've defined it in the design, is "printed", first by interpreting any controlsources defined for fields on the report layout, and then by running any code in the Format procedure for that section. When the formatting procedure has completed, any code in the Print procedure will then run. After the report has finished printing, any code in the Report_Close (e.g. query deletion, file closing, etc.) will run.
The Format-Print,Format-Print cycle is run each time a new record is read from the RecordSource for the report, when that record forces activation of the section. The Detail section is run for every record, but the other sections will only be run if the header or footer is triggered by the data. Headers/Footers will run each time the grouping associated with that header/footer changes. The header runs on the new value and the footer on the previous value.
When you make a section invisible (or have a height of 0), it will still format, but the Print routine will not run. If the section is visible but the control is invisible, the Format and Print routines will run, but that control will just not be physically printed.
Depending on what you're doing in the report and how you've designed the layout, the Format procedure may run mutiple times for each print of the section.
For example, suppose at some point in the formatting, Access decides you're beyond the page margins and a new page is needed. The Print routine will run as usual after the Format, but the Format will then automatically restart, since the entire section could not be formatted on the first pass. (The Print routine may also be forced to run multiple times but that's much rarer.)
This is the reason why the Format procedure has an automatic variable passed in (FormatCount) on the procedure line. Print has as PrintCount. These will tell you what iteration you're on, if the procedure was forced to reiterate. When the routines are done with any iterating, the counts automatically reset to 1 for the next time.
Usually you don't have to worry about the FormatCounts but you still need to be aware of them.
Similarly, the other Report routines are run when needed. The Page routine runs each time a new page is detected, etc.