Hey, I just tried that and it worked. Now to convert seconds to minutes, but I 
think that will be easier. Looks like all I had to do was use NOW() instead of 
TIME(). Whew.
 
Thanks,

--- On Thu, 12/4/08, Merrick S. Watchorn <[EMAIL PROTECTED]> wrote:

From: Merrick S. Watchorn <[EMAIL PROTECTED]>
Subject: Re: [Access VBA Central] DateDiff
To: [email protected]
Date: Thursday, December 4, 2008, 5:12 PM






Pablo,

The simplest solution would be to change the current code from 
timein = Time to timein = Now(), which would get the date and time 
into your variable. Then use the datediff function to calculate the 
elasped time. This website is a good start for dicussion. 
http://www.techonth enet.com/ access/functions /date/datediff. php

Private dteTime_In as Date
Private dteTime_Out as Date
Private intTotal_Time as Integer

Private Sub Command8_Click( )
dteTime_In = Now()
End Sub

Private Sub Command9_Click( )
dteTime_Out = Now()
End Sub

Private Sub Command10_Click( )
intTotal_Time = DateDiff("s" , dteTime_Out, dteTime_In)
End Sub

--- In AccessVBACentral@ yahoogroups. com, P S <discworld2004@ ...> 
wrote:
>
> Hello all. I am trying to code a database that calculates the time 
difference of TIMEIN and TIMEOUT. 
> 
> I am attaching a small database. There are 4 fields: ID#, TIMEIN, 
TIMEOUT, TOTALTIME. On the Form, there are 3 buttoms: Create TIMEIN, 
Create TIMEOUT, and Calculate TOTALTIME.
> 
> My VB code is as follows:
> Private Sub Command8_Click( )
> timein = Time()
> End Sub
> 
> Private Sub Command9_Click( )
> timeout = Time()
> End Sub
> 
> Private Sub Command10_Click( )
> Dim totaltime As Integer
> totaltime = DateDiff("s" , date1, date2)
> End Sub
> 
> I'm trying to calculate time difference in seconds and minutes but 
I can't get anything to appear in the TOTALTIME box. In the Table, 
Timein and Timeout are in DATE format. Totaltime is in NUMBER format. 
Any suggestions? 
> 
> Thanks,
> Pablo
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
>

 














      

[Non-text portions of this message have been removed]

Reply via email to