|
这个如何用case套用
Dim a, B, c, d, e, f, g, h, I, J, k, l, m, n, p, q, r, s, t As Single
Dim pr As Currency
pr = Nz(DLookup(Me.工序名称, "产品表", "[产品编号]=" & 产品代号.Value), 0)
a = DLookup("倍数", "样品计件参数", "[序号] = 1") '彩样
B = DLookup("倍数", "样品计件参数", "[序号] = 2") '彩样
c = DLookup("倍数", "样品计件参数", "[序号] = 3") '彩样
d = DLookup("倍数", "样品计件参数", "[序号] = 4") '彩样
e = DLookup("倍数", "样品计件参数", "[序号] = 5") '彩样
f = DLookup("倍数", "样品计件参数", "[序号] = 6") '彩样
g = DLookup("倍数", "样品计件参数", "[序号] = 7")
h = DLookup("倍数", "样品计件参数", "[序号] = 8")
I = DLookup("倍数", "样品计件参数", "[序号] = 9")
J = DLookup("倍数", "样品计件参数", "[序号] = 10")
k = DLookup("倍数", "样品计件参数", "[序号] = 11")
m = DLookup("倍数", "样品计件参数", "[序号] = 12") '100PC以上(彩样)
p = DLookup("倍数", "样品计件参数", "[序号] = 16") '3倍
q = DLookup("倍数", "样品计件参数", "[序号] = 17") '2倍
r = DLookup("倍数", "样品计件参数", "[序号] = 18") '1.5倍
s = DLookup("倍数", "样品计件参数", "[序号] = 19") '1.5倍
t = DLookup("倍数", "样品计件参数", "[序号] = 20") '1倍
订单量.Value = DLookup("订单量", "生产订单主档", "[产品代号]=" & 产品代号.Value & " And [订单号]='" & 订单号.Value & "'")
If IsNull(订单量) Then
MsgBox "此订单号中没有该产品,请检查订单号是否有错,否则不能显示订单量", vbExclamation, "提示"
Me.产品代号.SetFocus
End If
Me.单价 = Nz(DLookup(Me.工序名称, "产品表", "[产品编号]=" & 产品代号.Value), 0)
Me.产品名称 = DLookup("产品名称", "产品表", "[产品编号]=" & 产品代号.Value)
If Forms![计件单]![单据类型] = "CH" Or Forms![计件单]![单据类型] = "LY" Then
'========彩样室==========
If Me.样品单 = True Then
If Forms![计件单]![部门] = "8" Then
If Me.订单量 >= 1 And Me.订单量 <= 2 Then '1---2
Me.单价2 = pr * a
ElseIf Me.订单量 >= 3 And Me.订单量 <= 4 Then '3---4
Me.单价2 = pr * B
ElseIf Me.订单量 >= 5 And Me.订单量 <= 6 Then '5---6
Me.单价2 = pr * c
ElseIf Me.订单量 >= 7 And Me.订单量 <= 10 Then '7--10
Me.单价2 = pr * d
ElseIf Me.订单量 >= 11 And Me.订单量 <= 30 Then '11---30
Me.单价2 = pr * e
ElseIf Me.订单量 >= 31 And Me.订单量 <= 99 Then '31---99
Me.单价2 = pr * f
ElseIf Me.订单量 >= 100 Then '100以上
Me.单价2 = pr * m
End If
'=======================调油房===================================
ElseIf Forms![计件单]![部门] = "46" Then
If Me.订单量 >= 1 And Me.订单量 <= 2 Then '1---2
Me.单价2 = pr * a
ElseIf Me.订单量 >= 3 And Me.订单量 <= 4 Then '3---4
Me.单价2 = pr * B
ElseIf Me.订单量 >= 5 And Me.订单量 <= 6 Then '5---6
Me.单价2 = pr * c
ElseIf Me.订单量 >= 7 And Me.订单量 <= 10 Then '7--10
Me.单价2 = pr * d
ElseIf Me.订单量 >= 11 And Me.订单量 <= 30 Then '11---30
Me.单价2 = pr * e
ElseIf Me.订单量 >= 31 And Me.订单量 <= 99 Then '31---99
Me.单价2 = pr * f
ElseIf Me.订单量 >= 100 Then '100以上
Me.单价2 = pr * m
End |
|