|
以下代码运行速度很慢,在下是根据这个贴子改的
http://www.office-cn.net/forum.php?mod=viewthread&tid=32120&replyID=&skin=1
但效果不明显,故来请教高手了
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim p, f, b, t, m As Long
p = Nz(DLookup("lanQty", "roduceStatustwo", "roductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=1"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=1"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text56 = p: Me.Text80 = f: Me.Text11 = b: m = b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=2"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=2"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text57 = p: Me.Text81 = f: Me.Text13 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=3"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=3"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text58 = p: Me.Text82 = f: Me.Text14 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=4"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=4"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text59 = p: Me.Text83 = f: Me.Text15 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=5"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=5"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text60 = p: Me.Text84 = f: Me.Text16 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=6"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=6"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text61 = p: Me.Text85 = f: Me.Text17 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=7"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=7"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text62 = p: Me.Text86 = f: Me.Text18 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=8"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=8"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text63 = p: Me.Text87 = f: Me.Text19 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=9"), 0)
f = Nz(DLookup("FactQty", "ProduceStatustwo", "ProductionName='" & Me.ProductionName & "'and Nian='" & Me.Nian & "'and Yue=9"), 0)
b = IIf(f = 0, 0, f - p)
Me.Text64 = p: Me.Text88 = f: Me.Text20 = b: m = m + b
p = Nz(DLookup("PlanQty", "ProduceStatust |
|