Screen flicker using On Paint

mattcornish5

New member
Local time
Today, 05:35
Joined
Mar 28, 2012
Messages
5
Hi All

i am using the below vba code in the on paint event of the details section of a report.

the code works perfectly, except that the screen continuosly flickers and the code window says the code is running again and again.

is the fact that i am changing a image causing it to repaint thus entering an endless loop?

any ideas would be greatly appreciated.

CODE:

Code:
Private Sub Detail_Paint()
If Check42.Value = True Then

    Image38.Picture = "\\stor01-phys\AccDB\Tracker V2.0\Resources\check_ok_shield_tick.png"
    
ElseIf Check42.Value = False Then

    Image38.Picture = "\\stor01-phys\AccDB\Tracker V2.0\Resources\shield_exclamation.png"
    
End If

End Sub


Cheers guys
 
Hi All

i am using the below vba code in the on paint event of the details section of a report.

the code works perfectly, except that the screen continuosly flickers and the code window says the code is running again and again.

is the fact that i am changing a image causing it to repaint thus entering an endless loop?

any ideas would be greatly appreciated.
CODE:

Code:
Private Sub Detail_Paint()
If Check42.Value = True Then

    Image38.Picture = "\\stor01-phys\AccDB\Tracker V2.0\Resources\check_ok_shield_tick.png"
    
ElseIf Check42.Value = False Then

    Image38.Picture = "\\stor01-phys\AccDB\Tracker V2.0\Resources\shield_exclamation.png"
    
End If

End Sub
Cheers guys

Try using "DoCmd.Echo False" at the start of your code and then be sure to have "DoCmd.Echo True" at the end of the code.

Code:
DoCmd.Echo False

If Check42.Value = True Then

    Image38.Picture = "\\stor01-phys\AccDB\Tracker V2.0\Resources\check_ok_shield_tick.png"
    
ElseIf Check42.Value = False Then

    Image38.Picture = "\\stor01-phys\AccDB\Tracker V2.0\Resources\shield_exclamation.png"
   
End If
DoCmd.Echo True
 
Thanks for the reply

i have tried your suggestion, but, the screen flickers to begin with then stops but has changed all the images to the last record it came to.

then if you click ony where on the report it starts all over again.

thanks anyway
 
You might try moving your code to the On Format event of Detail section. The On Paint may be firing every time you change the position or zoom of the report.
 
On format only works if you use print preview, for report view its utterly useless.
 
ive heard alot of people saying double buffering stops this, but ive not seen it in relation to access or VBA?
 

Users who are viewing this thread

Back
Top Bottom