Re: Timer interval limitation
From: Rick Rothstein (rickNOSPAMnews_at_NOSPAMcomcast.net)
Date: 02/27/04
- Next message: Dos-Man: "Re: Form1.hdc apparently causing form_load error on XP"
- Previous message: Otis: "Re: 3 Tier Application"
- In reply to: Ralph: "Re: Timer interval limitation"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 27 Feb 2004 10:35:49 -0500
> IF both are recorded and 'full date' VB routines are used. Unfortunately
> that 'if' is often not taken into consideration. Any routine that is
> expected to work pass midnight should be tested for 'midnight' - if OK,
then
> fine, no additional code is needed.
>
> The programmer that doesn't validate for midnight for his particular timer
> does so at his (or rather his client's) perl.
You are setting an "interval" timer, not an alarm clock. Simply set the
ending time as the amount of time past Now. There are several ways to
approach that. Here's one way where a CommandButton is used to start a 15
minute timer (as was the OP's original request). Note that it will work
across midnight with no trouble.
Rick - MVP
Dim TimeIsUp As Date
Private Sub Command1_Click()
' Start the timer for 15 minutes
TimeIsUp = DateAdd("n", 15, Now)
Timer1.Interval = 250
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If Now >= TimeIsUp Then
' Code to "Sound the Alarm"
Timer1.Enabled = False
End If
End Sub
- Next message: Dos-Man: "Re: Form1.hdc apparently causing form_load error on XP"
- Previous message: Otis: "Re: 3 Tier Application"
- In reply to: Ralph: "Re: Timer interval limitation"
- Messages sorted by: [ date ] [ thread ]