Office中国论坛/Access中国论坛
标题:
请看看这里
[打印本页]
作者:
lt1668
时间:
2004-11-9 23:11
标题:
请看看这里
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号罐时就不对了。
要怎么改呢?求助大虾。[attach]7545[/attach]
作者:
情比金坚
时间:
2004-11-10 22:13
你2#的"高度"是小数,已经不适用原来的公式了,须用循环获得输入值的上下偏差.
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3