I have written some VBA Code with some sample data created in Excel and uploaded in Access. The sample code is given below:
Code:
Public Function TimeDiff()
Dim db As Database, rst As Recordset
Dim xstart As Double, xend As Double, diff As Double
Set db = CurrentDb
Set rst = db.OpenRecordset("Sheet1", dbOpenTable)
rst.Index = "idx"
xstart = rst![faulttime]
xend = xstart
rst.MoveNext
Do While Not rst.EOF
If (rst![faulttime] - xstart) > TimeValue("1:00:00") Then
xstart = rst![faulttime]
Else
xend = rst![faulttime]
diff = xend - xstart
rst.Edit
rst![diff] = diff
rst.Update
xstart = xend
End If
rst.MoveNext
Loop
rst.Close
The image of the sample data after running the above code with the result in a new column (diff) is attached for info. An index is created on the FaultTime field to order the data correctly. When the time difference between two dates is more than 1 hour the record is skipped forward assuming that the actual faulttime taken place some other time.
Since, only few records are tested there may be logical errors when large amount of data are involved. Correct the logic wherever you find it is failing by running the code on original file and manually checking the result.