|
-
Jun 15th, 2006, 08:11 AM
#1
Thread Starter
Member
[RESOLVED] Date Change
I am trying to recognize a change in date from todays. Basically, when the date changes at midnight or 12:01...(whatever it is on the pc). Here is what I have so far...this is not working though, the message box pops up immediately. Thanks in advance
VB Code:
Private Sub Timer1_Timer()
Static smi_date As Integer
If smi_date <> Day(Now) Then
MsgBox ("Hello, New Day")
smi_date = Day(Now)
End If
End Sub
-
Jun 15th, 2006, 08:15 AM
#2
Re: Date Change
The first time the timer is triggered, the variable has value 0, so it has a different value then the current day.
VB Code:
Private Sub Timer1_Timer()
Static smi_date As Integer
If smi_date = 0 Then smi_date = Day(Now)
If smi_date <> Day(Now) Then
MsgBox ("Hello, New Day")
smi_date = Day(Now)
End If
End Sub
-
Jun 15th, 2006, 08:18 AM
#3
Thread Starter
Member
Re: Date Change
That would make sense, I forgot it isn't inititalized...Thank you Frans!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|