ListBox的WHERE子句中的VBA UPDATE错误

问题描述

我正在尝试更新一个表,其中ListBox.ItemData(intCount)等于表中的字段,但是我似乎无法弄清楚WHERE子句。

Private Sub btnAdd_Click()

    Dim intCount As Integer
    For intCount = 0 To DCount("PONum","tblBomreceiptDetails")
    If Me.lstBox.Selected(intCount) <> 0 Then

    DoCmd.Runsql "UPDATE tblBomreceiptDetails SET tblBomreceiptDetails.ContainerNumber = [Forms]![frmUnapprovedPOs_New]![txtContainerNumber],tblBomreceiptDetails.BOL = [Forms]![frmUnapprovedPOs_New]![txtBOL],tblBomreceiptDetails.ReceivedLocation = [Forms]![frmUnapprovedPOs_New]![txtReceivedLocation],tblBomreceiptDetails.SteamShip = [Forms]![frmUnapprovedPOs_New]![txtSteamShip],tblBomreceiptDetails.Trucker = [Forms]![frmUnapprovedPOs_New]![txtTrucker],tblBomreceiptDetails.Comments = [Forms]![frmUnapprovedPOs_New]![txtComments] WHERE tblBomreceiptDetails.LOTNum = " & Me.lstBox.ItemData(intCount) & ""

        End If
        Next
        Me.lstBox.Requery

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)