vb ado连接access 结果adodc1.recordset.movenext这句过不去
PrivateSubcmddjcdjs_Click()djnew=0:cdnew=0:pzbhnew=0:num18=0:num19=0:num20=0Adodc1.Re...
Private Sub cmddjcdjs_Click()
djnew = 0: cdnew = 0: pzbhnew = 0: num18 = 0: num19 = 0: num20 = 0
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
djnew = Adodc1.Recordset.Fields("pmdj")
cdnew = Adodc1.Recordset.Fields("pmcd")
num18 = num18 + Adodc1.Recordset.Fields("yljh")
num19 = num19 + Adodc1.Recordset.Fields("pmdj") * Adodc1.Recordset.Fields("yljh")
num20 = num20 + Adodc1.Recordset.Fields("pmcd") * Adodc1.Recordset.Fields("yljh")
Call js1
Adodc1.Recordset.MoveNext
Loop
End Sub
Private Sub js1()
If djnew = 1 Then
Adodc1.Recordset.Fields("dj1") = num18
ElseIf 1 < djnew <= 1.6 Then
Adodc1.Recordset.Fields("dj2") = Round(((djnew - 1) * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj1") = num18 - Adodc1.Recordset.Fields("dj2")
ElseIf 1.6 < djnew <= 2.3 Then
Adodc1.Recordset.Fields("dj2") = Round((0.4 * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj3") = Round(((djnew / 2 - 0.7) * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj1") = num18 - Adodc1.Recordset.Fields("dj3") - Adodc1.Recordset.Fields("dj2")
ElseIf 2.3 < djnew <= 2.7 Then
Adodc1.Recordset.Fields("dj2") = Round((0.35 * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj3") = Adodc1.Recordset.Fields("dj2")
Adodc1.Recordset.Fields("dj4") = Round(((djnew - 2.05) / 3 * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj1") = num18 - Adodc1.Recordset.Fields("dj2") - Adodc1.Recordset.Fields("dj3") - Adodc1.Recordset.Fields("dj4")
End If
End Sub 展开
djnew = 0: cdnew = 0: pzbhnew = 0: num18 = 0: num19 = 0: num20 = 0
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
djnew = Adodc1.Recordset.Fields("pmdj")
cdnew = Adodc1.Recordset.Fields("pmcd")
num18 = num18 + Adodc1.Recordset.Fields("yljh")
num19 = num19 + Adodc1.Recordset.Fields("pmdj") * Adodc1.Recordset.Fields("yljh")
num20 = num20 + Adodc1.Recordset.Fields("pmcd") * Adodc1.Recordset.Fields("yljh")
Call js1
Adodc1.Recordset.MoveNext
Loop
End Sub
Private Sub js1()
If djnew = 1 Then
Adodc1.Recordset.Fields("dj1") = num18
ElseIf 1 < djnew <= 1.6 Then
Adodc1.Recordset.Fields("dj2") = Round(((djnew - 1) * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj1") = num18 - Adodc1.Recordset.Fields("dj2")
ElseIf 1.6 < djnew <= 2.3 Then
Adodc1.Recordset.Fields("dj2") = Round((0.4 * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj3") = Round(((djnew / 2 - 0.7) * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj1") = num18 - Adodc1.Recordset.Fields("dj3") - Adodc1.Recordset.Fields("dj2")
ElseIf 2.3 < djnew <= 2.7 Then
Adodc1.Recordset.Fields("dj2") = Round((0.35 * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj3") = Adodc1.Recordset.Fields("dj2")
Adodc1.Recordset.Fields("dj4") = Round(((djnew - 2.05) / 3 * num18 + 0.5), 0)
Adodc1.Recordset.Fields("dj1") = num18 - Adodc1.Recordset.Fields("dj2") - Adodc1.Recordset.Fields("dj3") - Adodc1.Recordset.Fields("dj4")
End If
End Sub 展开
3个回答
展开全部
如果Do While 之前recordcount是为零, MoveNext是没有任何意议的,(本身就没有记录嘛!)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1
<
djnew
<=
1.6
1.6
<
djnew
<=
2.3
2.3
<
djnew
<=
2.7
vb中没有这种表达方式
要用这种方式。
djnew>1
and
djnew
<=1.6
djnew>1.6
and
djnew
<=2.3
djnew>2.3
and
djnew
<=2.7
<
djnew
<=
1.6
1.6
<
djnew
<=
2.3
2.3
<
djnew
<=
2.7
vb中没有这种表达方式
要用这种方式。
djnew>1
and
djnew
<=1.6
djnew>1.6
and
djnew
<=2.3
djnew>2.3
and
djnew
<=2.7
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询