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


VBA ~ Form doesn't refresh while doing intense background processing...

Posted on 2011-05-13
Medium Priority
Last Modified: 2012-05-11
I have an MS Access form that is used for managing some file processing (under the hood, it's reading various text files and updating tables with data from those files). As it's processing each file, I have some code that updates a text box on the form to provide the status (e.g. "Processing file 3 or 9").

Before starting, I prompt them with a yes/no message box to confirm that they want to process their data (it can take awhile).

However, when they click "Yes" (continue), the message box doesn't go away and the status text box doesn't update until AFTER it's completed processing. Not exactly what I was looking for!

I'm sure it's because it is just crunching so hard in the background that it's not updating the form along the way.  I've added a 'refresh' command, but that didn't seem to help.

I know I've seen something on this before (possibly a magazine or something).  Maybe using a timer (am I getting warmer?).  I've done some searching online, but didn't find anything.  Time to call in the experts.

Thanks in advance for the help.
Question by:careybroph
  • 2
LVL 77

Accepted Solution

peter57r earned 500 total points
ID: 35754873
I'm surprised the msgbox doesn't disappear
You could try  

if msgbox() = vbYes then
me.textbox = "some value"
' then do the rest of your processing

or maybe

if msgbox() = vbYes then
me.textbox = "some value"
' then do the rest of your processing


Author Comment

ID: 35755022
repaint didn't work.

DoEvent did help.  After it completed the first cycle it repainted the screen.  I need to tinker around with it a bit to get the message box to disappear right away, but that shouldn't be too difficult.

THANKS for the quick help (and on a Friday even!).  Nice way to end the week!

Author Closing Comment

ID: 35755026

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

810 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