[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Form.Repaint does not work while in a loop

Posted on 2005-05-10
Medium Priority
Last Modified: 2008-03-10

Form.Repaint to update a label while a procedure is running works just fine when the code runs from top to botomb without any kind of loops.

But once I loop through a recordset and try to updatre a label for each iteration by using the Form.Repaint at the end of each loop nothing happens.

Even worse is that the form label does not get updated even after the procedure is finished but rather I have to set the focus off the form to see the label update through all its previously set caption values 1 after the other.

I am trying to implement some kind of basic progress indicator but how can I make this work in access 97?
Question by:DaFou
  • 4
  • 3

Author Comment

ID: 13966735
also the form gets updates when i click on the cercord selector on the left side of the form when the procedure is done.

How can I emulate that part being clicked on so that the form might update?
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 13966765
I always repaint the label not the form.
I tend to spell it out for Access i.e.

Me.labelname.Caption = "Processing Record No " & RecordID

form.repaint is going to have to do every control, rather than just the label

Often the loop is faster than the video card can refresh the screen.
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 13966781
Ooops, confusing repaint with refresh. Looking back at some previous uses of this, I had used a textbox rather than a label to hold the values and repainted the form after repopulating the text box ( in conjunction with a refresh statement.

Apologies for the confusion
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 46

Assisted Solution

tbsgadi earned 400 total points
ID: 13966805
Make sure you haven't got Echo false anywhere.

Good Luck!


Author Comment

ID: 13966852
its even more strange!!

the procedure ( in a module ) that gets called from my form when i press a command button does not run until i set the focus to another control on the form or set the focus away from the form.

So infact the repainting does work but the procedure will NOT run until the focus is changed.

What is this???
LVL 22

Accepted Solution

Kelvin Sparks earned 1600 total points
ID: 13966870
Make sure you have the Event Procedure set to the On Click event for the button and not something like the On Lost Focus

Author Comment

ID: 13966879
kevin, you are right. i saw myself just now aswell. muhahahah may i need sleep. i am not seeing things
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 13966889
Easy done. All good Access developers are short of sleep.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question