Re: Time of day message
From: Rob Oldfield (blah_at_blah.com)
Date: 11/20/04
- Next message: Rob Oldfield: "Re: linked combo boxes"
- Previous message: Steve Schapel: "Re: What is wrong with this code"
- In reply to: Steve Schapel: "Re: Time of day message"
- Next in thread: Steve Schapel: "Re: Time of day message"
- Reply: Steve Schapel: "Re: Time of day message"
- Messages sorted by: [ date ] [ thread ]
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.
> >
- Next message: Rob Oldfield: "Re: linked combo boxes"
- Previous message: Steve Schapel: "Re: What is wrong with this code"
- In reply to: Steve Schapel: "Re: Time of day message"
- Next in thread: Steve Schapel: "Re: Time of day message"
- Reply: Steve Schapel: "Re: Time of day message"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|