Prevent Screen Updating (1 Viewer)

cosmarchy

Registered User.
Local time
Yesterday, 22:23
Joined
Jan 19, 2010
Messages
116
Hi,
Due to a recent post, where I found out that I am unable to create controls at runtime on an Access form, I now have to create all my controls (100+ textboxes and labels) at design time and then change their position and/or size to hide them or show them at the correct time.

When the form is first opened, there is a moment where all the controls are visible shortly before the screen updates after my initial code has run and they all disappear, which is very annoying.

I have code which is fired in the form open event which iterates through the controls and determines whether they are a label or a textbox before resizing them to a size which is not visible - the code will eventually reposition the boxes etc but this is just the first step.

What can I do to prevent the the flickering of controls as they are enabled/disabled en mass?

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:23
Joined
Oct 29, 2018
Messages
21,471
Hi. Have you tried setting all controls to Visible = No in Design View and then as the last action in your Open Event code to set Visible = True?
 

isladogs

MVP / VIP
Local time
Today, 06:23
Joined
Jan 14, 2017
Messages
18,218
As well as setting all controls hidden initially, you can minimize flicker by using Application.Echo = False before any code to set controls visible.
Make sure you set Application.Echo=True after that code has finished so the display is updated

Not sure why you need to resize controls if you are going to hide them!
 

CJ_London

Super Moderator
Staff member
Local time
Today, 06:23
Joined
Feb 19, 2013
Messages
16,610
assuming you are opening the form with code (docmd.openform) you can set the window mode to hidden,


when the form opens your code can shuffle its controls around and as a last action display the form (me.visible=true)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:23
Joined
Feb 19, 2002
Messages
43,266
I'm sure someone asked you what you were doing in the other thread so i don't want to belabor the point but Access is a RAD tool and RAD tools are based on bound forms and this form is obviously not bound so either it should be or you might want to think about a different toolset.

Please post a link to the earlier thread. Thanks
 

cosmarchy

Registered User.
Local time
Yesterday, 22:23
Joined
Jan 19, 2010
Messages
116
assuming you are opening the form with code (docmd.openform) you can set the window mode to hidden,


AcWindowMode enumeration (Access)

when the form opens your code can shuffle its controls around and as a last action display the form (me.visible=true)
Interesting. At present I am just opening the form by clicking on it as it is early days and not fully integrated enough for code but will give this a try when the time comes :)

As well as setting all controls hidden initially, you can minimize flicker by using Application.Echo = False before any code to set controls visible.
Make sure you set Application.Echo=True after that code has finished so the display is updated

Not sure why you need to resize controls if you are going to hide them!
Good question. Initially I tried to move the controls I didn't want to somewhere out of the way. I then thought I'd just make them so small I couldn't see them before just deciding on just hiding them. Strangely I never 'undid' the others when deciding to hide them!! :rolleyes:

Please post a link to the earlier thread. Thanks
Earlier post here
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:23
Joined
Feb 28, 2001
Messages
27,179
There is another possibility. Minimize the form, diddle with your controls, maximize the form. Nobody will notice the controls flickering. And it might look kind of neat for the "ready to go" form to maximize. But that's just me.
 

Users who are viewing this thread

Top Bottom