Dim c As Double
Dim s As TimeSpan
For Each h As DataRow In DataTables("业务").DataRows
For Each dr As DataRow In DataTables("租息调整表").DataRows
If h("起始日期")>=dr("调整起日") And h("起始日期")<dr("调整止日") And h("到期日期")>dr("调整止日") Then
s=dr("调整止日")-h("起始日期")
c=s.TotalDays*dr("日租金")
End If
If h("起始日期")<dr("调整起日") And h("到期日期")>dr("调整止日") Then
s=dr("调整止日")-dr("调整起日")
c=c+s.TotalDays*dr("日租金")
End If
If h("起始日期")<=dr("调整起日") And h("到期日期")<dr("调整止日") And h("到期日期")>dr("调整起日") Then
s=h("到期日期")-dr("调整起日")
c=c+s.TotalDays*dr("日租金")
End If
If h("起始日期")>=dr("调整起日") And h("到期日期")<=dr("调整止日") Then
s=h("到期日期")-h("起始日期")
c=c+s.TotalDays*dr("日租金")
End If
Next
h("租息")=c*h("金额")
Next
去掉这行的“=”号,你再看看对不对。