I have a report/form that has many textboxes with the ControlSource of each corresponding to the sum of a Field in a table. Below is the code I have, which works but it is very repetitive and difficult to maintain when I need to make changes, and I have to do similar projects with many more fields. I've read into arrays and loops but I just do not understand it enough to create code that works. Anyway, if you can please show me how to make the code below more efficient. Thank you very much.
' Nombre d'enfant ayant frequente le centre au cours du mois
Reports!rptTest!NoHosp.ControlSource = "=DSum('[No_frequente_Hos]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!NoVac.ControlSource = "=DSum('[No_frequente_Vac]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!NoCon.ControlSource = "=DSum('[No_frequente_Con]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!totFreq.ControlSource = "=DSum('[Tot_frequente]', 'qryFiche', mod1_setMySQL())"
' Nombre total depiste au cours du mois
Reports!rptTest!dep02.ControlSource = "=DSum('[No_depiste_0_2]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!dep35.ControlSource = "=DSum('[No_depiste_3_5]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!dep614.ControlSource = "=DSum('[No_depiste_6_14]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!depHosp.ControlSource = "=DSum('[No_depiste_Hos]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!DepVac.ControlSource = "=DSum('[No_depiste_Vac]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!depCon.ControlSource = "=DSum('[No_depiste_Con]', 'qryFiche', mod1_setMySQL())"
Reports!rptTest!totDep.ControlSource = "=DSum('[Tot_depiste]', 'qryFiche', mod1_setMySQL())"