I was looking around the internet to find a better way to calculate time difference between two values on my MS Access Table. And finally I found a good solution on how to calculate time difference that works over 24 hours time. See how this works for me:
So basically, I have three main columns. From, to and result which is the start time, end time and the time differences. Now, I can put the following code to calculate the time differences between from and to.
Private Sub result_GotFocus() On Error GoTo ErrCode Dim StartDate As Date Dim EndDate As Date StartDate = TimeValue(Me.from.Value) EndDate = TimeValue(Me.to.Value) Me.result.Value = Abs((EndDate - StartDate) - (StartDate > EndDate)) Exit Sub: ErrCode: MsgBox Err.Description End Sub