Screen Flicker

Snowflake68

Registered User.
Local time
Today, 17:10
Joined
May 28, 2014
Messages
464
I have been trying to solve a screen flicker for days now. Every time the form updates it flickers. I have combo boxes and check boxes and no matter which control is used the screen always flickers.

I have tried using the code below on the form load event and also on each of the controls after update event but it doesn't stop the flicker. On each of the controls after update event I have a macro that runs an update query. The macro also has the Echo set to No.

Code:
Application.Echo False

I have also ensured that there are no unassociated labels on the form which another forum suggested but this hasn't worked either. :banghead:

I am using Access 2013 (part of Office Professional Plus 2013) and windows 10 but dont think this has anything to do with it.

Can anyone suggest anything else to try please.

Thanks
 
Do you have any conditional formatting applied to the form ?

Edit - why would you run an update query after every update on the forms controls - that doesn't sound like very good design?
 
Do you have any conditional formatting applied to the form ?

Edit - why would you run an update query after every update on the forms controls - that doesn't sound like very good design?

Thanks for you reply.

No, I dont have any conditional formatting on the form. I did have one on a subform but I tested with it removed but it still happened.

Also I have an update query which totals the costs of all fields in another table.
Combo boxes are bound to a field in a table but each time a selection is made from one of the combo boxes or check boxes it sets the cost in its own field on a table. The update query then totals this up all the costs in each of these fields and then applies the value to a different table and displays the total on the form.
I must admit I am not that good at designing these things and to be honest Ii am still learning.

I have removed the update queries and tested again but still the screen flickers so its not the update query causing the issue.

Im at a loss with this one.:banghead:
 
You probably shouldn't be storing the results of all these calculations. As you have found storing the results means every time you update any value, any where on any form, you have to re-store the calculated value.

The normal route is to simply calculate the result on the fly whenever you need it, this way any changes to the underlying data are always reflected in the calculation.

Without seeing the flickering I don't know what would be causing it. Can you upload a example db with the problem visible?
 
I will try and cut down the db to exclude an sensitive data but it may take me a while.

Thanks for offering to help

:D
 
Check for having more than one explicit .Repaint, and check for more than one .Requery, both of which could do that.

Running frequent updates should not cause screen flicker on a bound form because it touches only one record, which should be current. That is, it should not flicker unless there is a cascade of .AfterUpdate events on individual controls, each of which can do something active and possibly trigger a second update. OR it could happen if your frequent update runs into something complex in the Form_Current event code, which is going to be triggered after each update is complete.
 
Check for having more than one explicit .Repaint, and check for more than one .Requery, both of which could do that.

Running frequent updates should not cause screen flicker on a bound form because it touches only one record, which should be current. That is, it should not flicker unless there is a cascade of .AfterUpdate events on individual controls, each of which can do something active and possibly trigger a second update. OR it could happen if your frequent update runs into something complex in the Form_Current event code, which is going to be triggered after each update is complete.

There is only ever one record serving the form so you are correct.
Also I do have cascading combo boxes therefore so I do a refresh on the form each time a selection is made which I could put up with a bit of screen flicker for this BUT there is definitely unnecessary screen flicker from my bad coding.

I am about to upload a copy of my application. It has been cut down to just the workings of the form in question. Everything works off of the combo box for Model and once this is selected I force the other combo boxes to select the first item in the list.
 
Below is a link to a copy of my application (It was too big to upload even zipped up if was 2.5mb). It has been cut down to just the workings of the form in question. Everything works off of the 'Model' combo box and once a model has been selected I force the other combo boxes to select the first item in the list. The cost needs to automatically calculate and display on the form as options are added/changed.

https://we.tl/U8boO5P7wM

If anyone could help with the screen flicker or give me some advice on a better design/way of doing things I am willing to listen and learn. I am still a novice at all this so I know for sure I don't use the best coding practice or chose the best way of doing things. I just try something until it works. :o
 
Some observations;
With almost every control you are setting a value on you are using the .Value property. This is the default property and on some controls can cause some unexpected side effects. Just as an experiment I removed every one (67 of them!) from the Model after update and the form appeared to still work fine. (Except for the flicker...)

The fact that you are setting so many things based on one field being updated does point to a possibly dodgy set up = but I haven't time right now to go through the form in detail unfortunately.

What I did just do was remove the refresh macro's, that stopped most of it!

Refresh is almost always not needed, unless you are doing something a bit odd.
 
Some observations;
With almost every control you are setting a value on you are using the .Value property. This is the default property and on some controls can cause some unexpected side effects. Just as an experiment I removed every one (67 of them!) from the Model after update and the form appeared to still work fine. (Except for the flicker...)

The fact that you are setting so many things based on one field being updated does point to a possibly dodgy set up = but I haven't time right now to go through the form in detail unfortunately.

What I did just do was remove the refresh macro's, that stopped most of it!

Refresh is almost always not needed, unless you are doing something a bit odd.

Thanks. I have removed all of the .values and all appears to still work ok.
As for the refresh macro I have commented out all of the lines with that code apart from the very first one on the after update event on the cboModel as it wasnt updating the other combo boxes.

For example if you choose Model 1 you can see that the last three combo boxes are all n/a and then if you change it to Model 8 then they still say 'n/a' when there should actually be other options to choose from.

Having the refresh on the cboModel after update event appears to keep everything working.

The flicker has reduced considerably so thank you for this.
For some reason I had the refresh on everything because Im sure as I was building it things werent working without it so I will keep on testing it.

Thanks again, you have helped a damsel in distress once again. ;)
 
Thanks. I have removed all of the .values and all appears to still work ok.
As for the refresh macro I have commented out all of the lines with that code apart from the very first one on the after update event on the cboModel as it wasnt updating the other combo boxes.

For example if you choose Model 1 you can see that the last three combo boxes are all n/a and then if you change it to Model 8 then they still say 'n/a' when there should actually be other options to choose from.

Having the refresh on the cboModel after update event appears to keep everything working.

The flicker has reduced considerably so thank you for this.
For some reason I had the refresh on everything because Im sure as I was building it things werent working without it so I will keep on testing it.

Thanks again, you have helped a damsel in distress once again. ;)

I take that back. It would appear that I do need the refresh after all as it is not seeing the changes I make to the other selections and therefore is applying incorrect prices. I previously tried using the
Code:
DoCmd.RunCommand acCmdSaveRecord
command but I then kept getting the drop changes pop up.

This is driving me nuts now. Just wish I was better at designing these things.
:confused:
 
If you are making changes to other selections based on one control's selection, you are doing something odd anyway.

Take a look at this link from MSDN on the topic of refreshing a form.

https://msdn.microsoft.com/en-us/library/office/ff836021.aspx

You are in essence doing a writeback of the information currently on the form. That means you are committing changes that you might not yet have completed because of the way you talk about your multiple combo boxes. You can be risking a partially updated record.

It would appear that I do need the refresh after all as it is not seeing the changes I make to the other selections and therefore is applying incorrect prices.

It is your problem and I would not presume to tell you that you are wrong to compute something involving multiple contributions. However, I might respectfully suggest that recomputing some final result before you have defined all the possible inputs might not be the best choice here.

Take a look at the description of Repaint in this link.

https://msdn.microsoft.com/en-us/library/office/ff834494.aspx

Note in particular the boxed comparison on this link that shows the difference between a Repaint and a Refresh. You would use a Refresh when you want OTHERS to see your changes before you are done with them (and for shared databases, if you want to see changes by others before they are done.)

You need to carefully think about whatever it is that you REALLY want to see. The flicker merely tells me that whatever you are doing, something really complex is going on behind the scenes, a massive computation of some kind that seems a bit much for an update of a single record.
 
If you are making changes to other selections based on one control's selection, you are doing something odd anyway.

Take a look at this link from MSDN on the topic of refreshing a form.

https://msdn.microsoft.com/en-us/library/office/ff836021.aspx

You are in essence doing a writeback of the information currently on the form. That means you are committing changes that you might not yet have completed because of the way you talk about your multiple combo boxes. You can be risking a partially updated record.



It is your problem and I would not presume to tell you that you are wrong to compute something involving multiple contributions. However, I might respectfully suggest that recomputing some final result before you have defined all the possible inputs might not be the best choice here.

Take a look at the description of Repaint in this link.

https://msdn.microsoft.com/en-us/library/office/ff834494.aspx

Note in particular the boxed comparison on this link that shows the difference between a Repaint and a Refresh. You would use a Refresh when you want OTHERS to see your changes before you are done with them (and for shared databases, if you want to see changes by others before they are done.)

You need to carefully think about whatever it is that you REALLY want to see. The flicker merely tells me that whatever you are doing, something really complex is going on behind the scenes, a massive computation of some kind that seems a bit much for an update of a single record.

Thanks for this. I did previously read these topics and tried just using the 'Repaint' option but it didn't see the changes on the selection. The only thing that seems to work for me is the refresh so I'm just going to have to stick with that and put up with the screen flicker.

Just to add, I did remove the query that is totaling everything up but the screen still flickered so the query is not causing any issues for me. Some of prices of the controls options are based upon another selection so it needs to refresh/save whatever it takes to be up to date when the next selection is made I order to apply the correct price.

I really appreciate all your help and advice and that you took the time out to help me.

Thanks again. :)
 
the old "flicker" problem was a mouse-rollover effect caused by unassociated labels within tab controls.

I think a different "true" flicker might be caused by form values changing very fast, causing controls, or maybe the form borders/header etc to need to resize imperceptibly.

Having said that turning off the screen repaint ought to suppress that.
 

Users who are viewing this thread

Back
Top Bottom