Screen Updating

garywood84

Registered User.
Local time
Today, 08:42
Joined
Apr 12, 2006
Messages
168
I have a button on a form which closes the form and opens a different one. This causes the screen to "flash" as one is closed, the main menu becomes visible very briefly and then the new form opens.

In Microsoft Excel I used to use the VBA code:

Application.ScreenUpdating = False

to prevent this and only allow the final state to be displayed. I've tried this with Access and it doesn't seem to work.

Is there an equivalent?

Gary
 
Look up Echo in help (A2000)

Docmd.Echo False 'to turn off screen repainting

Docmd.Echo True 'to turn it back on

I would also include Docmd.Echo True in the error handling routine, else the app will appear to freeze if an error occurs.

Dave
 
Dave,

Thanks for this. However, I am struggling to get it to work. I have added:

DoCmd.Echo False

to the start of the code behind the button, and have also put code in the error handling, as suggested.

The screen is still updating as the code runs, however, so I see the form the button is on close, the main menu appear very briefly and then the second form open up.

Can you advise me further?

Cheers,

Gary
 
garywood84 said:
I have a button on a form which closes the form and opens a different one.

Why not open the second form first, then close the first form ?

When I first read the post, I thought you were closing and then opening the first form.

Dave
 
Dave,

That could work well, since the form being closed would be behind the active one.

How do I close a form other than the active one? The DoCmd.Close which I was using before closes the active form, and so using this after opening the second form causes the wrong one to be closed.

Gary
 
Read up in VBA Help on

DoCmd.Close

to discover its arguments.
 
Yeah, you're right. We should just give out the answers, not try to teach people how to figure things out for themselves. :rolleyes:
 
pbaldy said:
Yeah, you're right. We should just give out the answers, not try to teach people how to figure things out for themselves. :rolleyes:

:eek: Actually have to search?

You mean doing the work yourself, rather than sitting back and letting someone else do it for you..... never :p
 
I do agree, but the help in A2000 misses the mark so many times, that knowing what to search for is nigh impossible.

Dave
 
Is there any equivalent for Modal forms?

Hi,

I messed about with this until I realized that 'echo' does not work with modal forms. The form I want to use this feature on is modal and pop up.

I tried to find something like repaint = off or me.repaint false but it looks like repaint does not have a negative use.

Is there any other way of stopping updates for a modal form?

If there isn't, and I think there might not be as that is probably the point of modal forms, this minor problem wil have to wait until version 2 of my database as I use modal forms instead of the more complicated methods of hiding the database window and disabling various features.

Regards,
 
Oldsoftboss said:
Look up Echo in help (A2000)

The help file actually says that the echo doesn't work with model forms:

The Echo method doesn't suppress the display of modal dialog boxes, such as error messages, or pop-up forms, such as property sheets.

Note: Don't confuse the Echo method with the Repaint method. The Echo method turns screen repainting on or off. The Repaint method forces an immediate screen repainting.

Thus the reason the repaint method has no arguments.
 
Oldsoftboss said:
The help file actually says that the echo doesn't work with model forms:

Thanks Oldsoftboss,

I noticed that in post 12 of this thread and got further clarification from the other site referenced in post 13.

Now that I understand a bit more of this, I think the whole point of modals & pop-ups is that they force themselves to the front, so to speak, and there is unlikely to be any way of suppressing that.

I shall solve this problem in V2 of my database by not using a modal form. :)
 

Users who are viewing this thread

Back
Top Bottom