How to Trigger MS Access Code based on specific time of day rather than every second or minutes

前端 未结 3 1414
小鲜肉
小鲜肉 2021-01-25 02:10

I have been trying to pull this off and maybe I am getting close. I have some code in Access I need to Run at a specific time of day. I do not want to use Windows Task Scheduler

3条回答
  •  -上瘾入骨i
    2021-01-25 02:22

    Do the time checking in the form's timer event procedure.

    Private Sub Form_Timer()
        If TimeValue(Now()) >= #15:30:00# Then
            ' run your job, then turn off the timer
            Me.TimerInterval = 0
        End If
    End Sub
    

    An approached based on the above code should allow you to avoid sending an email each time you do your time check.

    If yours is not a single user application, this situation may be more complicated. If 2 or more users have the form open at 3:30 PM, should they all attempt to run the job? Can they? OTOH, if the job is user-specific, that may be what you want.

提交回复
热议问题