|
Question : MS Access VBA - Timer To Trigger Event Every 15 minutes
|
|
I'm using the following code to auto-refresh a form's contents every 1.5 minutes.
Private Declare Sub sapiSleep Lib "kernel32" _ Alias "Sleep" _ (ByVal dwMilliseconds As Long)
Sub sSleep(lngMilliSec As Long) If lngMilliSec > 0 Then Call sapiSleep(lngMilliSec) DoEvents End If End Sub
Public Sub timeRefresh()
Const cTIME = 90000 'in MilliSeconds
Call sSleep(cTIME) DoEvents
Call cmdCalculate_Click
End Sub
My problem: Even with the DoEvents the code above prevents the user from using their system because the sleep routine basically hogs the processor.
I need to run an event every 1.5 minutes from MS. Access and I need the system's resources to be available to the user whilst the application is waiting.
|
|
Answer : MS Access VBA - Timer To Trigger Event Every 15 minutes
|
|
Use the form's OnTimer event and not the API stuff.
/gustav
|
|
|