Akhil
When you say...
result on clicking the button after 5 seconds is
12:00:05 AM
... are you referring to Me.Caption, as in
Code:
Private Sub Command1_Click()
Me.Caption = DateAdd("s", DateDiff("s", Start_Time, Now), "0:0:0")
End Sub
If so, perhaps you could, for troubleshooting purposes, break apart
that line of code, as in:
Code:
Private Sub Command1_Click()
v1 = DateDiff("s", Start_Time, Now)
v2 = DateAdd("s", v1, "0:0:0")
v3 = Now
v4 = DateAdd("s", v1, v3)
End Sub
If I understand what is happening, you'd get these results:
- v1 = 5 .... calculates the difference
- v2 = 12:00:05 AM .... adds said difference to a preset time, namely, "0:0:0"
- v3 = 5/21/2010 9:22:41 AM
- v4 = 5/21/2010 9:22:46 AM
Comments:
- No issue here
- The "problem" here is you are doing trying to add 5 seconds to "0:0:0"
(which is being interpreted as 12:00:00 AM). This seems to be the
where the breakdown in your logic flow is occurring. - Hypothetical value of NOW
- No DateAdd problem here, because you are adding 5 seconds to a time
(which also contains the date).
Does that help?
Spoo