General

6.9 An Alternative to DoEvents.
  Dev Ashish, Applied Technologies, AT&T Labs of Edison, New Jersey USA.
More than a few people have asked me if an alternative to DoEvents exists to implement a wait period in Access. (DoEvents yields execution so that the operating system can process other events.)

The answer is yes, the Sleep API can be used for this. Look at the sample sTestSleep Sub. When you run it, you'll notice a delay before the Msgbox appears on screen. The duration can be increased/decreased by changing the constant cTime to a corressponding higher/lower value.

For normal use from within your code, simply place a call to the sSleep sub with an appropriate time in milliseconds.
Private Declare Sub sapiSleep Lib "kernel32" _
               Alias "Sleep" (ByVal dwMilliseconds As Long)

Sub sSleep(lngMilliSec As Long)
   If lngMilliSec > 0 Then
      Call sapiSleep(lngMilliSec)
   End If
End Sub

Sub sTestSleep()
   Const cTIME = 1000 'in MilliSeconds
   Call sSleep(cTIME)
   MsgBox "Before this Msgbox, I was asleep for " & cTIME & " Milliseconds."
End Sub


Se pensate di avere del materiale freeware interessante e volete pubblicarlo, allora leggete qui.