Hi! I have put a "Total Time" field in a form to calculate the difference in minutes from the "Start Time" to the "End Time". I was worried about getting the incorrect time span when the time crossed over midnight. Well, I got that part right, but when I enter times in the same day (1:15pm-1:30pm) it gives me the time difference PLUS 1440 minutes. Please tell me what I need to do to fix this! Thank you!
Total Time:
=DateDiff("n",[Date]-IIf(1-[Start Time]>[End Time],0,1)+[Start Time],[Date]+IIf(1-[Start Time]>[End Time],1,0)+[End Time])
Assuming the dates are sequential, this would work for those over midnight items.
EXPR1: (IIf([End Time]<[Start Time],[End Time]-[Start Time]+24,[End Time]-[Start Time]))
You could also just add a previous date difference expression and use it in the formula in place of the simple "24" - if the difference in days was called [Days apart] then that value would be [Days apart]*24
That's right
Just multiply the result*24*60
The formula would be
EXPR1: (IIf([End Time]<[Start Time],[End Time]-[Start Time]+24,[End Time]-[Start Time]))*1440
Thank you!! I am working on a database that is a little more involved than ones I usually work on, so I will probably be posting again. Thanks for your help!!
A forum community dedicated to tech experts and enthusiasts. Come join the discussion about articles, computer security, Mac, Microsoft, Linux, hardware, networking, gaming, reviews, accessories, and more!