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.techonthenet.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 [email protected], P S <[EMAIL PROTECTED]> 
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]
>


Reply via email to