DoEvents and CPU usage

G

Guest

I have the following loop:

Do Until <something happens>
Do Events
Sleep 50 'refers to Private Declare Sub sapiSleep Lib "kernel32"
Loop

I added Sleep because I don't like 100% CPU usage that DoEvents alone would
cause (e.g., because of overheating in my dynamically switched Centrino).
Written as above, the CPU usage is almost 0, and all my other Access windows
still react to my clicks. But the calculated controls in other windows now
take FOREVER to calculate :(

Is there a way to do something like "DoEvents 1000", which would let the
rest of Access and OS to do what it wants for 1000 milliseconds, and only
THEN return control back to the current subroutine?

Thank you!
 
A

Albert D. Kallal

What you could do is build a form with a timer event...and set that timer
event to run once ever second or when every....

that way you would not effect the rest of the operation of ms-access, and
would not have a loop, nor have code that has to "sleep"..and the code halts
during that time...

So, use a form with a timer event to fire you code every second....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top