From VBA I’m setting a series of text boxes to have DSum controlSources:
Me.Oct.ControlSource = "=DSum('GBPValue', _
'MF YTD Actual Income & Adret', _
'Month=10 AND Org_Type=[Key]')"
Me.Nov.ControlSource = "=DSum('GBPValue', _
'MF YTD Actual Income & Adret', _
'Month=11 AND Org_Type=[Key]')"
and then running Me.Recalc to get the values to show up once set. This works fine for the text boxes that are on-screen when the form loads but for ones on the same (very wide) form that are not currently on screen the Recalc seems to do nothing. If I scroll across the form and select the blank fields the values then show up. Is there any way to get the values for every text box on-screen or off to be there on form load or, at worst, when the user scrolled across?
I can guess why this must be happening: it’s likely that Recalc doesn’t repaint controls that are not currently visible. So even though the value of the controls has in fact changed, their cached visual appearance still appears empty when the scrolling windows reveals them.
Here’s what I’d recommend: create a member function on your form like this:
The control source for the text boxes can then be set to “=GetMonthValue(1)” and so on. This means that each control’s source is declared statically and there’s no need to change anything when the form loads. When the current record changes, the value should track, although I haven’t verified this with testing.