批量加入实现了,但是有一个赋值的问题 , 红字的部分我怀疑是不是有问题。把是否字段的值置为true.但是只有第一行加入的值置为了true,其他的都失效了。
Set rst1 = CurrentDb.OpenRecordset("tblYhxx", dbOpenDynaset)
Set rst2 = CurrentDb.OpenRecordset("tblYxxxfp", dbOpenDynaset)
For I = 0 To List0.ListCount
If List0.Selected(I) = True Then
rst1.Edit
rst1("sffp") = True
rst1.Update
rst2.AddNew
rst2("fpId") = acchelp_autoid("F", 10, "tblYxxxfp", "fpId")
rst2("fpsj") = Me.fpsj
rst2("zycp") = Me.cpdm
'营销分配表中主营产品zycp等于产品代码
rst2("yggh") = Me.yggh
rst2("ygxm") = Me.ygxm
rst2("yhbh") = List0.Column(0, I)
rst2.Update
List0.Selected(I) = False
End If
Next
'End If
DoCmd.Close
MsgBox "保存成功!", vbInformation, "提示"