回复24楼,包裹一下
If e.Row.Index > 0 Then
If Tables("煤焦油油耗跟踪表").Current.IsNull("日期") Or Tables("煤焦油油耗跟踪表").Current.IsNull("读数时间") Then
MessageBox.Show("没有输入日期或读数时间")
Else
Dim tp1 As TimeSpan = e.Row("日期")-e.Table.Rows(e.Row.Index-1)("日期")
Dim tp As TimeSpan = e.Row("读数时间")-e.Table.Rows(e.Row.Index-1)("读数时间")
Dim tp3 As TimeSpan = tp1+tp
e.Row("间隔小时数")= tp3.Days & "天" & tp3.Hours & "小时" & tp3.Minutes & "分"
End If
If Tables("煤焦油油耗跟踪表").Current.IsNull("油表读数") Then
MessageBox.Show("没有输入油表读数")
Else
e.Row("读数差") = e.Row("油表读数")-e.Table.Rows(e.Row.Index-1)("油表读数")
End If
Dim tp4 As TimeSpan = e.Row("日期")-e.Table.Rows(e.Row.Index-1)("日期")
Dim tp5 As TimeSpan = e.Row("读数时间")-e.Table.Rows(e.Row.Index-1)("读数时间")
Dim tp6 As TimeSpan = tp4+tp5
Dim sz As Double = tp6.TotalHours
Dim s1 As Double = e.Row("油表读数")-e.Table.Rows(e.Row.Index-1)("油表读数")
e.Row("每小时油耗容量") = s1\sz
End If