Assistance needed in fixing the time format

Voyager

Registered User.
Local time
Today, 16:51
Joined
Sep 7, 2017
Messages
95
Hi Team,
I have a field "taskpick" in mm/dd/yy hh:nn format and another field "tasktime" in decimal format with 2 decimal points. Here is the issue
1) I need to add taskpick field with tasktime field and get a new field "freeat" which should be in mm/dd/yy hh:nn format

I use the below code but it gives me incorrect answer how to fix it

e.g. Taskpick (01/10/19 11:15) + Tasktime (81.00) gives the answer as (01/11/19 3:10) but I want the correct result as (1/13/2019 20:15)

How can I fix the error in the line ![freeat]

Code:
 Do While Not rsTask.EOF
                     .Edit
                        !employee = rsemp!ename
                        ![avlto] = rsemp![avlto]
                        ![freeat] = DMax("[freeat]", "ests", "[Ename]='" & rsemp!ename & "'") + Nz(rsTask![tasktime])
 
Try
Code:
 ![freeat] = DateAdd("h",Nz(rsTask![tasktime],DMax("[freeat]", "ests", "[Ename]='" & rsemp!ename & "'") )

however that does not seem to take into account parts of an hour, so perhaps best to convert to minutes, or even seconds if it has to be that accurate. :D

Code:
 ![freeat] = DateAdd("n",Nz(rsTask![tasktime]*60,DMax("[freeat]", "ests", "[Ename]='" & rsemp!ename & "'") )
 
you can also use the timeserial to turn hours, min, sec into a time prior to adding.
 
Thank you Gasman, It works as I wanted.
Thanks for the valuable advice Majp
 

Users who are viewing this thread

Back
Top Bottom