I am calculating shift duration from [Starttime] and {Endtime]. Everthing is great until my endtime is Midnight. Then I get negative value hh:mm. If a person starts work during the midnight hour and ends at say 7AM, I get the wrong value. Here's the query I have so far but I need help rewriting this to include the solution for this problem with the ending at midnight or starting during the midnight hour.
SELECT MasterSchedMain.MasterSchedID, MasterSchedMain.ClientID, State.State, MasterSchedMain.AuthID, MasterSchedMain.JobID, MasterSchedMain.ProgramID, MasterSchedMain.StartDate, MasterSchedMain.ExpireDate, MasterSchedMain.Starttime, MasterSchedMain.Endtime, (DateDiff("n",[Starttime],[Endtime])/60) AS Duration, [Duration]/0.25 AS Units, MasterSchedMain.MasterCancel, MasterSchedMain.MastCancelDate, MasterSchedMain.PayBill
FROM (State INNER JOIN [Client Table] ON State.StateID = [Client Table].State) INNER JOIN MasterSchedMain ON [Client Table].ClientID = MasterSchedMain.ClientID
WHERE (((MasterSchedMain.ClientID)=[Forms]![Authorization Client Form]![ClientID]) AND ((MasterSchedMain.MasterCancel)=No))
ORDER BY MasterSchedMain.MasterSchedID DESC;
Thanks for you help
SELECT MasterSchedMain.MasterSchedID, MasterSchedMain.ClientID, State.State, MasterSchedMain.AuthID, MasterSchedMain.JobID, MasterSchedMain.ProgramID, MasterSchedMain.StartDate, MasterSchedMain.ExpireDate, MasterSchedMain.Starttime, MasterSchedMain.Endtime, (DateDiff("n",[Starttime],[Endtime])/60) AS Duration, [Duration]/0.25 AS Units, MasterSchedMain.MasterCancel, MasterSchedMain.MastCancelDate, MasterSchedMain.PayBill
FROM (State INNER JOIN [Client Table] ON State.StateID = [Client Table].State) INNER JOIN MasterSchedMain ON [Client Table].ClientID = MasterSchedMain.ClientID
WHERE (((MasterSchedMain.ClientID)=[Forms]![Authorization Client Form]![ClientID]) AND ((MasterSchedMain.MasterCancel)=No))
ORDER BY MasterSchedMain.MasterSchedID DESC;
Thanks for you help