Assistance needed in fixing the time format (1 Viewer)

Voyager

Registered User.
Local time
Today, 05:06
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])
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:36
Joined
Sep 21, 2011
Messages
14,310
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 & "'") )
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:36
Joined
May 21, 2018
Messages
8,529
you can also use the timeserial to turn hours, min, sec into a time prior to adding.
 

Voyager

Registered User.
Local time
Today, 05:06
Joined
Sep 7, 2017
Messages
95
Thank you Gasman, It works as I wanted.
Thanks for the valuable advice Majp
 

Users who are viewing this thread

Top Bottom