asked on
CASE WHEN Shift_From_Hour IS NULL OR Shift_To_Hour IS NULL THEN 0 WHEN Shift_From_Hour < 0 OR Shift_From_Hour > 24 OR Shift_From_Minute < 0 OR Shift_From_Minute > 59 THEN 0 WHEN Shift_To_Hour < 0 OR Shift_To_Hour > 24 OR Shift_To_Minute < 0 OR Shift_To_Minute > 59 THEN 0 WHEN Shift_From_Hour > Shift_To_Hour THEN ((24 - Shift_From_Hour) + Shift_To_Hour) * 60 + (Shift_To_Minute - Shift_From_Minute) ELSE (Shift_To_Hour - Shift_From_Hour) * 60 + (Shift_To_Minute - Shift_From_Minute) END
Duration2: CInt(IIf([duration]=0,1440,[duration])/60)
(Code taken from Access query).