0

我在我的列表视图VAT中添加了另一个列标题,它从另一个表加载并填充到列表视图中。到目前为止,一切正常。现在,我试图将列表视图中的信息保存到另一个表,这被证明是困难的。

我已经在网上搜索了一个星期,但徒劳无功的是我加载到 listview 的代码。

Public Sub cmdLookup_Click()
On Error GoTo SearchError

With Connect.rsitem
 .Filter = "Itemno = '" & txtSearch.Text & "' or desc1 like '" & txtSearch.Text & _
     "*' or desc2 like '" & txtSearch.Text & "*' or upc = '" & txtSearch.Text & "'"
  
     .Open
    If .RecordCount > 1 Then
       FrmSearch.Show vbModal
   End If
   If .RecordCount > 0 Then
      QtyRemain = !onhandqty
   If QtyRemain > 0 Then
         Set x = ListView.ListItems.Add(, , !itemno)
            x.SubItems(1) = !desc1
            x.SubItems(2) = !desc2
            x.SubItems(3) = !Size
            x.SubItems(4) = 1
            x.SubItems(5) = FormatNumber(!unitprice)
            x.SubItems(6) = FormatNumber(!unitprice)
            x.SubItems(7) = !upc
            x.SubItems(8) = !Vat
            x.EnsureVisible
            x.Selected = True

保存部分

Public Sub SaveSales()
Dim i As Integer
i = 1
 Do Until i = (ListView.ListItems.Count + 1)
 With ListView.ListItems(i)
       Connect.AddSales txtinvoice.Text, .Text, .SubItems(4), .SubItems(6), txtdate.Text, txtSubTotal.Text, _
                     txtDiscount.Text, txtTotal.Text, frmPayment.txtCash.Text, _
                     CDbl(frmPayment.txtCash.Text) - CDbl(txtTotal.Text), "Open", frmLogin.Cashier
 End With
i = i + 1
   Loop
End Sub
4

1 回答 1

0

最后它正在工作,从数据环境调整 SQL 参数以包括 'Vat',即 '.subitems(8)'。谢谢乔治

于 2013-07-25T23:47:13.383 回答