缺于用于更新或刷新的基本表信息
以下代码就是把Datagrid显示的记录“zt”字段设为“退休”然后再把这条记录的某部分字段插入到另一个表sdtx中,处理完后,再依次处理下一条记录,直到处理所datagird里的所有记录,但在标记红色处提示:缺于用于更新或刷新的基本表信息,怎么解决啊
Private Sub Command2_Click()
Dim cn As New ADODB.Connection
intRecCount = Adodc1.Recordset.RecordCount
a = MsgBox("确认批量退休吗!", vbYesNo + vbQuestion, "退休确认")
If a = vbYes Then
Adodc1.Recordset.MoveFirst
For intCounter = 1 To intRecCount
Adodc1.Recordset.Fields("zt") = "退休"
Adodc1.Recordset.Fields("tbsj") = Format(Date, "yyyy-mm-dd")
a = Adodc1.Recordset.Fields("bh").Value
b = Adodc1.Recordset.Fields("xm").Value
c = Adodc1.Recordset.Fields("xb").Value
d = Adodc1.Recordset.Fields("id").Value
e = Adodc1.Recordset.Fields("geren").Value
f = Adodc1.Recordset.Fields("cun").Value
g = Adodc1.Recordset.Fields("zhen").Value
H = Adodc1.Recordset.Fields("shi").Value
i = Adodc1.Recordset.Fields("shi75").Value
j = Adodc1.Recordset.Fields("tbsj").Value
k = Adodc1.Recordset.Fields("ys").Value
l = (Adodc1.Recordset.Fields("geren").Value + Adodc1.Recordset.Fields("cun").Value + Adodc1.Recordset.Fields("lx").Value) / Adodc1.Recordset.Fields("ys").Value
l = Round(l, 2) '设置小数为数为2位
m = (Adodc1.Recordset.Fields("zhen").Value + Adodc1.Recordset.Fields("shi").Value + Adodc1.Recordset.Fields("shi75").Value) / Adodc1.Recordset.Fields("ys").Value
m = Round(m, 2)
n = Adodc1.Recordset.Fields("je").Value + Adodc1.Recordset.Fields("lx").Value
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
cn.Execute ("insert into sdtx (bh,xm,xb,id,geren,cun,zhen,shi,shi75,txsj01,ys,grzh,tczh,tczh1,zhzje) values ('" & a & "','" & b & "','" & c & "','" & d & "','" & e & "','" & f & "','" & g & "','" & H & "','" & i & "',#" & j & "#,'" & k & "','" & l & "','11.67','" & m & "','" & n & "')")
Adodc1.Recordset.MoveNext Adodc1.Refresh
Next intCounter
Adodc1.Refresh
MsgBox "个人账户和统筹账户批设置成功", 64, "账户设置"
End If
End Sub