I've run into this before. Previously I found mentions of it on a couple of different Access VBA forums after searching with Google, but now I cannot find any of these hits.
I've been fiddling with this for hours today. I tried a variety of code bits in various events, but as any of us know from running into this problem, the Report View
has vastly fewer event triggers than does Print Preview
. However, I did find a workaround and a couple of important discoveries regarding this irritating bug:
- The
TextBox
need not receive focus; simply accessing the .Value
property is sufficient to give it the kick in the pants that it needs to properly display its contents. As such, the .SetFocus
method isn't necessary.
- The
Section_Paint
event is sufficient for this purpose.
The following bit of code worked for me. Of course, change the section and control names to match those on your own report.
Fair warning: This causes screen flicker on my system when the report is scrolled. I did attempt to disable screen updates with Application.Echo
, but this only made the flicker worse. It seemed like each and every line of code added to the event, no matter what it was, made the flicker worse; it seems to be a timing issue:
Private Sub GrpGlacctFooter_Paint()
Dim DummyVar As Variant
'DummyVar can be reused for each control. We just need somewhere (anywhere) to
'stuff each .Value. Simply accessing .Value in any way is enough to trigger the
'TextBoxes to display their contents.
DummyVar = txtAcctSubtotalMessage.Value
DummyVar = txtAcctTotalSpent.Value
DummyVar = txtAcctRemainder.Value
End Sub