Very High processor usage for this code.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A botton is pressed which brings up a seperate form to allow the user to
enter some text. The "calling" code waits until a button on the "seperate
form" is pressed before continuing. Whilst waiting it chews up huge processor
usage. Any suggestions.

************* calling code
' Wait for Send or Cancel button
Do
DoEvents
Call DelaySeconds(0.5)
Loop Until Forms!EmailBody.blnSend Or Forms!EmailBody.blnCancel

*************
Public Sub DelaySeconds(Seconds)

Dim StartDelay
Dim EndDelay

Seconds = Seconds * 1000

StartDelay = GetTickCount()

Do
DoEvents
EndDelay = GetTickCount()
Loop Until EndDelay - StartDelay > Seconds

End Sub
 
Back
Top