Solved DateDiff to calculated min (1 Viewer)

Alvein17

New member
Local time
Tomorrow, 04:19
Joined
Sep 2, 2021
Messages
29
Dear All,

hello i need some advice to fix my trouble.
i have a table, there is CuciMesinStart, CuciMesinEnd and Column A as a Calculated result from CuciMesinEnd - CuciMesinStart. with condition Shift 3, it's mean start from 11:00 PM until 07:00 AM.
so my question how to get a result from CuciMesinEnd-CuciMesinStart
1631242567334.png


this is my querry.

1631242918848.png
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:19
Joined
Oct 29, 2018
Messages
21,454
Hi. Not sure I understand your question. Can you maybe post some mockup using Excel to show the current data and the result you from them? Thanks.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:19
Joined
May 7, 2009
Messages
19,229
Code:
A: IIf(TimeValue([CuciMesinEnd])<TimeValue([CuciMesinStart]),
DateDiff("n",[CuciMesinStart],DateAdd("d",1,[CuciMesinEnd])),
DateDiff("n",[CuciMesinStart],[CuciMesinEnd]))\60 & ":" &
(IIf(TimeValue([CuciMesinEnd])<TimeValue([CuciMesinStart]),
DateDiff("n",[CuciMesinStart],DateAdd("d",1,[CuciMesinEnd])),
DateDiff("n",[CuciMesinStart],[CuciMesinEnd])) Mod 60)
 

Alvein17

New member
Local time
Tomorrow, 04:19
Joined
Sep 2, 2021
Messages
29
1631247805993.png

Hi. Not sure I understand your question. Can you maybe post some mockup using Excel to show the current data and the result you from them? Thanks.
hello, this i attached mockup by excel file. actually i have do it by excel, but when i move to Access querry i got some toruble with this.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:19
Joined
May 7, 2009
Messages
19,229
Code:
A: IIf(IsNull([CuciMesinStart]+[CuciMesinEnd]),
0,
DateDiff("n",CDate(Date() & " " & [CuciMesinStart]),
CDate(Date()-([cuciMesinStart]>[CuciMesinEnd]) & " " & [CuciMesinEnd])))
 

Sun_Force

Active member
Local time
Tomorrow, 06:19
Joined
Aug 29, 2020
Messages
396

Alvein17

New member
Local time
Tomorrow, 04:19
Joined
Sep 2, 2021
Messages
29
Code:
A: IIf(TimeValue([CuciMesinEnd])<TimeValue([CuciMesinStart]),
DateDiff("n",[CuciMesinStart],DateAdd("d",1,[CuciMesinEnd])),
DateDiff("n",[CuciMesinStart],[CuciMesinEnd]))\60 & ":" &
(IIf(TimeValue([CuciMesinEnd])<TimeValue([CuciMesinStart]),
DateDiff("n",[CuciMesinStart],DateAdd("d",1,[CuciMesinEnd])),
DateDiff("n",[CuciMesinStart],[CuciMesinEnd])) Mod 60)
Hello Arnelg, thank you for your help. it's work so well.
 

Users who are viewing this thread

Top Bottom