Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long processing weirdness

Status
Not open for further replies.

gymbeef

Technical User
Sep 18, 2002
33
0
0
US
I have an application that sometimes has some pretty heavy processing going on that might take up to several minutes to complete. And some odd things are going on that I'm hoping someone can explain.

The routine itself is pretty simple - its just searching a matrix for a particular value and reporting back on which "cell" its in. As long as the searches are simple and the matrix relatively small, then the processing completes within several seconds and everything is fine. Its when the same routine is run under more complex conditions (e.g. floating point numbers instead of integers) and when the matices are large, that things change.

When a complex search has been running for several seconds, an Access bar will open up in the task bar at the bottom of the screen and the cursor goes to an hourglass (this happens automatically, its not something I programmed).

If you open the windows task manager during this time, it shows Access and my app as "not responding", but I know they're still running because they eventually complete the processing OK. When processing is complete, the cursor goes back to a pointer and the Access task bar closes.

And now a new bit of weirdness: I added a "progress meter" so the user can tell the app is still running OK. Its just a simple counter bound to a text box on a periodically repainted pop-up form. The form updates fine for the first several seconds, but when Access goes into its "state", the form stops updating. After the operation is complete, the form will jump to the value it would have otherwise had.

Its like Access goes into some kind of "mode" where all its doing is background vba processing and not doing any screen or form updating. I don't get any errors and the app otherwise runs like its supposed to, but I don't get whats going on. It seems to only happen when the program takes longer than some critical (but unknown) time, then it kicks into its "mode".

Any of this make any sense? Whats goin on?

Thanks in advance

 
Hi,

The DoEvents() function maybe your answer.

Regards,

Darrylle

"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
You should put the DoEvents in some processing loop somewhere and call it about every 100, or 200, or 500 times around. Experiment a little and see what works.

What you saw is this: when Access is running a compute-intensive piece of code, it hogs all the CPU cycles it can get. The Task Manager is not lying when is says Access is "Not Responding" because it looks like it has gone out to lunch, not answering any "knocks" from the Task Manager, when really, it is just ignoring the rap at the door. The DoEvents call forces Access to take a breath, so to speak.

You don't actually need the DoEvents call, but using it periodically unlocks your machine while the process is running, giving Windows a chance to do its thing once in a while.

Peleg
PelegNOSPAM@PStrauss.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top