I have several functions in which I turn on the display of the hourglass when the function starts running and turn it off when complete. That in itself is not a problem.
However sometimes I might reuse that function elsewhere, inside another function in which I also turn on/off the hourglass. This leads to premature turnoff for the hourglass. Its a bit hard to explain, so I will try to illustrate with this example:
Now imagine that VeryLongRunning Function1 takes 2 secs to execute and it is set to turn the hourglass on when it starts and off when it finishes.
Also imagine that the CalculateStuff takes 1 ms to run, so there is no need to turn the hourglass on inside that function, but ofc, running it 100.000 times takes time (10s), and is the reason I used the hourglass in the first place.
Now when the entire Main function runs, the hourglass will only be shown for the first 2 seconds, since Main switches it on, VeryLongRunning Function1 swithces it on (no difference) and then after running for 2 secs, switching it off, leaving it off for the next 10 secs.
The same type of issues I also have when using Docmd.Echo Off/On
I hope that was explanation enough, and now finally on to the question:
Do you guys have any good method of handling this? I can see several ways of doing this, but I wanted to see if someone allready had thought of a neat way before I start over-complicating things.
However sometimes I might reuse that function elsewhere, inside another function in which I also turn on/off the hourglass. This leads to premature turnoff for the hourglass. Its a bit hard to explain, so I will try to illustrate with this example:
Code:
Private Function Main
Docmd.Hourglass True
Call VeryLongRunningFunction1
For intI=1 to 100000
CalculateStuff
Next intI
Docmd.Hourglass false
Also imagine that the CalculateStuff takes 1 ms to run, so there is no need to turn the hourglass on inside that function, but ofc, running it 100.000 times takes time (10s), and is the reason I used the hourglass in the first place.
Now when the entire Main function runs, the hourglass will only be shown for the first 2 seconds, since Main switches it on, VeryLongRunning Function1 swithces it on (no difference) and then after running for 2 secs, switching it off, leaving it off for the next 10 secs.
The same type of issues I also have when using Docmd.Echo Off/On
I hope that was explanation enough, and now finally on to the question:
Do you guys have any good method of handling this? I can see several ways of doing this, but I wanted to see if someone allready had thought of a neat way before I start over-complicating things.
Comment