标题: 怎样加快此代码运行速度?请支招多谢 [打印本页] 作者: zyz218 时间: 2005-12-6 19:12 标题: 怎样加快此代码运行速度?请支招多谢 If Year(Now()) > Me.lian Then
MsgBox "您输入的年份小于当前年份,系统不支持!"
'-----------------------------------------------------------------------------------------------------------
ElseIf Year(Now()) = Me.lian Then
If Month(Now()) = 1 Then
one Me
End If
If Month(Now()) = 2 Then
two Me
End If
If Month(Now()) = 3 Then
three Me
End If
If Month(Now()) = 4 Then
four Me
End If
If Month(Now()) = 5 Then
five Me
End If
If Month(Now()) = 6 Then
six Me
End If
If Month(Now()) = 7 Then
seven Me
End If
If Month(Now()) = 8 Then
eight Me
End If
If Month(Now()) = 9 Then
nine Me
End If
If Month(Now()) = 10 Then
ten Me
End If
If Month(Now()) = 11 Then
eleven Me
End If
If Month(Now()) = 12 Then
twelve Me
End If
If Me.yue = 1 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.zaiku = i
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 2 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 + Me.C1 + i
Me.zaiku = Me.Z1
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 3 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 + Me.C1 + i
Me.Z2 = Me.T2 - Me.S2 + Me.C2 + Me.Z1
Me.zaiku = Me.Z2
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 4 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 + Me.C1 + i
Me.Z2 = Me.T2 - Me.S2 + Me.C2 + Me.Z1
Me.Z3 = Me.T3 - Me.S3 + Me.C3 + Me.Z2
Me.zaiku = Me.Z3
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 5 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 + Me.C1 + i
Me.Z2 = Me.T2 - Me.S2 + Me.C2 + Me.Z1
Me.Z3 = Me.T3 - Me.S3 + Me.C3 + Me.Z2
Me.Z4 = Me.T4 - Me.S4 + Me.C4 + Me.Z3
Me.zaiku = Me.Z4
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 6 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 + Me.C1 + i
Me.Z2 = Me.T2 - Me.S2 + Me.C2 + Me.Z1
Me.Z3 = Me.T3 - Me.S3 + Me.C3 + Me.Z2
Me.Z4 = Me.T4 - Me.S4 + Me.C4 + Me.Z3
Me.Z5 = Me.T5 - Me.S5 + Me.C5 + Me.Z4
Me.zaiku = Me.Z5
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 7 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 + Me.C1 + i
Me.Z2 = Me.T2 - Me.S2 + Me.C2 + Me.Z1
Me.Z3 = Me.T3 - Me.S3 + Me.C3 + Me.Z2
Me.Z4 = Me.T4 - Me.S4 + Me.C4 + Me.Z3
Me.Z5 = Me.T5 - Me.S5 + Me.C5 + Me.Z4
Me.Z6 = Me.T6 - Me.S6 + Me.C6 + Me.Z5
Me.zaiku = Me.Z6
jh Me
sj Me
cy Me
ch Me
zk Me
End If
If Me.yue = 8 Then
i = Nz(DLookup("[库存数量]", "初始库存", "产品名称 ='" & Me.产品名称 & "'"), 0)
Me.Z1 = Me.T1 - Me.S1 作者: zyz218 时间: 2005-12-6 19:13
ElseIf Year(Now()) < Me.lian Then
Me.lian = Me.lian - 1
If Month(Now()) = 1 Then
one Me
End If
If Month(Now()) = 2 Then
two Me
End If
If Month(Now()) = 3 Then
three Me
End If
If Month(Now()) = 4 Then
four Me
End If
If Month(Now()) = 5 Then
five Me
End If
If Month(Now()) = 6 Then
six Me
End If
If Month(Now()) = 7 Then
seven Me
End If
If Month(Now()) = 8 Then
eight Me
End If
If Month(Now()) = 9 Then
nine Me
End If
If Month(Now()) = 10 Then
ten Me
End If
If Month(Now()) = 11 Then
eleven Me
End If
If Month(Now()) = 12 Then
twelve Me
End If