Re: Date Time Difference

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

From: RK (anonymous_at_discussions.microsoft.com)
Date: 04/08/04


Date: Wed, 7 Apr 2004 21:38:14 -0700

Created
Test Boxes - txtEndTime, txtCountDown
Created Funtion (below) modCountDown
In the forms timer interval = 120

?? Me.txtCountDown = CountDown(txtEndTime), doesn't
compile
What am I messing up?

Thanks

>-----Original Message-----
>Hi RK
>
>Probably the best method is to write a function to
calculate the difference
>in seconds and then format the string:
>
>Public Function CountDown(EndTime as Variant) as String
>Dim lTemp as long
>Dim D as Integer, H as Integer, M as Integer, S as
Integer
>If Not IsDate(EndTime) then Exit Function
>lTemp = DateDiff("s", Now, EndTime)
>S = lTemp Mod 60
>lTemp = lTemp \ 60
>M = lTemp Mod 60
>lTemp = lTemp \ 60
>H = lTemp Mod 24
>D = lTemp \ 24
>CountDown = D & " days, " & H & " hours, " _
> & M & " minutes, " & S & " seconds"
>End Function
>
>Now, all you need is a textbox or label on your form and
a Timer event which
>updates it every second:
>
>Me.txtCountDown = CountDown(txtEndTime)
>--
>Good Luck!
>
>Graham Mandeno [Access MVP]
>Auckland, New Zealand
>
>
>
>"RK" <anonymous@discussions.microsoft.com> wrote in
message
>news:1a04e01c41d17$f5d951d0$a101280a@phx.gbl...
>> How can I create a Count down clock on a form. ie put
in
>> an end date and time and based off the current time
would
>> display the number of days, hours, minutes to the end
>> date. I tried to experiment with an excel spread sheet
>> with some success but cand't get it to work in Access.
>> Any thoughts?
>>
>> Thank you.
>>
>>
>
>
>.
>



Relevant Pages

  • Re: PRODUCT calculation in queries
    ... The Microsoft Jet database engine could not find the input table or query ... After pasting it into the code window, choose Compile on the Debug menu. ... Function Product(strField As String, strTable As String, _ ... Dim dblResult As Double ...
    (microsoft.public.access.queries)
  • Re: Help a beginner - simple lowercase to uppercase and so on function
    ... can understand everything but it should take shape with more practice ... it compiles and returns uppercase letters ... in this string!" ... to compile on both. ...
    (comp.lang.c)
  • Re: Compile time string literal substitution to external data file
    ... and these string literals may expose sensitive information ... > I want to use the compile time macros for file name, line number, and ... I'd put a macro and a function like: ...
    (microsoft.public.vc.language)
  • Re: "Ada Gems": Constructor functions
    ... I use Ada 95 to compile and did not receive the BUG ERROR ... function Create_Object (Name: in String) return Object; ... function Construct return Object is ...
    (comp.lang.ada)
  • Re: Error when WebMethod returns a jagged array
    ... compiled the project, and the compile failed. ... assign string[] to a string, ... and see that their code generates Collections instead of jagged arrays. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)