如何接近第一个记录集以从cbox获取另一个值



我有这个代码,我从列表中获得一些值,是可以的,我想从cbox中获得另一个值,我试图关闭记录集,但我有一个错误:

Private Sub cmdAñadir_Click()
Dim VARITEM
Dim RS As DAO.Recordset
Set RS = CurrentDb.OpenRecordset("SELECT TipoProducto, Descripcion, Proveedor, RefSap, RefProveedor FROM tblCarrito")
For Each VARITEM In Me.Lista0.ItemsSelected
RS.AddNew 
RS!TipoProducto = Me.Lista0.Column(1, VARITEM)
RS!Descripcion = Me.Lista0.Column(2, VARITEM)
RS!Proveedor = Me.Lista0.Column(3, VARITEM)
RS!RefSap = Me.Lista0.Column(4, VARITEM)
RS!RefProveedor = Me.Lista0.Column(7, VARITEM)
RS.Update
RS.Close    
Next

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("tblCarrito")
With rst
.AddNew
.Fields("destino") = Cuadro_combinado70.Value
.Update
End With
End Sub

问题解决了,我使用bucle for each来捕获cbox的值和list的值。感谢您的关注

相关内容

  • 没有找到相关文章