• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

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

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.
0
careybroph
Asked:
careybroph
  • 2
1 Solution
 
peter57rCommented:
I'm surprised the msgbox doesn't disappear
You could try  

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

or maybe

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

0
 
careybrophAuthor Commented:
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!
0
 
careybrophAuthor Commented:
THANKS Again!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now