|
Private Sub 验收水高_AfterUpdate()
Dim n, a, b, c, d As Long
Dim m, x, y As Double
x = Round(Me![验收水高], 2)
n = Fix(Me![验收水高])
If [罐号] = "1" Then
a = DLookup("高度", "1", "高度=" & n)
b = DLookup("高度", "1", "高度=" & n + 1)
c = DLookup("升数", "1", "高度=" & n)
d = DLookup("升数", "1", "高度=" & n + 1)
End If
If [罐号] = "2" Then
a = DLookup("高度", "2", "高度=" & n)
b = DLookup("高度", "2", "高度=" & n + 1)
c = DLookup("升数", "2", "高度=" & n)
d = DLookup("升数", "2", "高度=" & n + 1)
End If
If x <= 0 Then
y = 0
Else
y = c + (d - c) / (b - a) * (x - a)
End If
Me![净水容积] = y
Me.验收升数 = 油水总升数 - 净水容积
End Sub
Private Sub 验收油水总高_AfterUpdate()
Dim n, a, b, c, d As Long
Dim m, x As Double
x = Round(Me![验收油水总高], 2)
n = Fix(Me![验收油水总高])
If [罐号] = "1" Then
a = DLookup("高度", "1", "高度=" & n)
b = DLookup("高度", "1", "高度=" & n + 1)
c = DLookup("升数", "1", "高度=" & n)
d = DLookup("升数", "1", "高度=" & n + 1)
End If
If [罐号] = "2" Then
a = DLookup("高度", "2", "高度=" & n)
b = DLookup("高度", "2", "高度=" & n + 1)
c = DLookup("升数", "2", "高度=" & n)
d = DLookup("升数", "2", "高度=" & n + 1)
End If
If x <= 0 Then
m = 0
Else
m = c + (d - c) / (b - a) * (x - a)
End If
Me![油水总升数] = m
Me.验收升数 = 油水总升数 - 净水容积
End Sub
在罐号:输入1号罐时公式没有问题,输入2号罐时就不对了。
要怎么改呢?求助大虾。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|