Re: Time of day message

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rob Oldfield (blah_at_blah.com)
Date: 11/20/04


Date: Sat, 20 Nov 2004 22:54:19 -0000

Agree with Steve that using Access to control this is probably going to be
unreliable.... but one slight improvement... set the timer interval value
when the form gets loaded instead of running every hour (or whatever)....
something like...

Private Sub Form_Load()
Me.TimerInterval = DateDiff("s", Now, Date + #02:00:00 PM#) * 1000
End Sub

(that is, if you're convinced it's going to be opened before 2pm, but a
couple of Ifs and a DateAdd should get you around that)

...and then set the timer interval for the next time around in the timer
event itself.

"Steve Schapel" <schapel@mvps.org.ns> wrote in message
news:e$1RfS0zEHA.1296@TK2MSFTNGP10.phx.gbl...
> Steve,
>
> It may be worth considering using Windows Task Manager, or a third party
> scheduling utility, for this purpose, rather than running it from
> Access. The only way I know of to run it from Access is to use the
> Timer event of a form which is always open. You can set the Timer
> Interval property of the form to 1000 (i.e. 1 minute), and then on the
> On Timer event property, code the equivalent of...
> If Format(Time, "hh:nn") = "14:00" Then
> MsgBox "ding dong!"
> End If
>
> If you want to reduce some overhead, so the event is not being triggered
> every minute for the whole day, you could set the Timer Intgerval of the
> form to 60000 (i.e. 1 hour), and then on the Timer you can do something
> like this...
> If Hour(Now) = 13 Then
> Me.TimerInterval = 1000
> ElseIf Format(Time, "hh:nn") = "14:00" Then
> MsgBox "ding dong!"
> Me.TimerInterval = 60000
> End If
>
> --
> Steve Schapel, Microsoft Access MVP
>
> Steve wrote:
> > Good day.
> >
> > Looking for ideas of how to have a form or module check
> > the time of day and when it hits 2:00 p.m, for example,
> > to give me a msgBox or an alert of some kind.
> >
> > Any ideas?
> >
> > Thank you.
> >



Relevant Pages

  • RE: Timer updated on form
    ... Since we need to keep the timer running while the form is ... is in progress and we update the time display; ... I don't see two Private Sub From_Timerevents. ... This variable will tell the Timer event to update the time display ...
    (microsoft.public.access.formscoding)
  • Re: Scrolling text in a stationary label help needed
    ... I had to add a check in the timer event to ... Dim xposition As Long ... Private Sub Form_KeyPress ... In your example the code isn't runnng in a Timer at ...
    (microsoft.public.vb.general.discussion)
  • Re: Timer Count Down
    ... Doug Steele, Microsoft Access MVP ... Private Sub Form_Open ... Inside the form's Timer event, ...
    (microsoft.public.access.formscoding)
  • Re: Hide Loading Image Dialog
    ... I copied the function/module and have this code on the timer ... > event of each form with a linked image. ... > Private Sub Form_Timer ... > My guess is that the timer event of 200 is firing the function to hide the ...
    (microsoft.public.access.formscoding)
  • Re: Wierd menu crash
    ... > No timer in it where in you create bitmaps everytime new which have a ... and if I display these in a listview my app uses ... Steve ...
    (microsoft.public.dotnet.languages.vb)