如何让access数据右移一列
求一代码:当combo1中的数据与rs2.Fields("特征A" & i)不同时(for i = 1 to 10),将combo1.text写入rs2.Fields("特征A1"),原rs2.Fields("特征A2")数据写入rs2.Fields("特征A3"),原rs2.Fields("特征A3")数据写入rs2.Fields("特征A4"),依次右移一格至rs2.Fields("特征A10"),原rs2.Fields("特征A10")被挤掉.下面是本人写的代码,但是不管用 请大家帮忙!!!!!
Private Sub 添加1()
rs2.Open "select * from 清单 where ID='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic
For i = 1 To 10
If Combo1.Text = rs2.Fields("特征A" & i) Then
'Exit For
End If
'Exit Sub
If Combo1.Text <> rs2.Fields("特征A" & i) Then
rs2.Fields("特征A10") = rs2.Fields("特征A9")
rs2.Fields("特征A9") = rs2.Fields("特征A8")
rs2.Fields("特征A8") = rs2.Fields("特征A7")
rs2.Fields("特征A7") = rs2.Fields("特征A6")
rs2.Fields("特征A6") = rs2.Fields("特征A5")
rs2.Fields("特征A5") = rs2.Fields("特征A4")
rs2.Fields("特征A4") = rs2.Fields("特征A3")
rs2.Fields("特征A3") = rs2.Fields("特征A2")
rs2.Fields("特征A2") = rs2.Fields("特征A1")
rs2.Fields("特征A1") = Combo1.Text
End If
Next
rs2.Update
rs2.Close
cnn.Close
Unload Me
End Sub
修改数据.zip
(178.43 KB)