troubleshooting Question

MS Access VBA - Timer To Trigger Event Every 15 minutes

Avatar of advlegals
advlegals asked on
Microsoft Access
4 Comments1 Solution975 ViewsLast Modified:
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.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros