Sql ListBox的WHERE子句中出现VBA更新错误
我试图更新一个表,其中ListBox.ItemData(intCount)等于表中的一个字段,但我似乎无法理解where子句Sql ListBox的WHERE子句中出现VBA更新错误,sql,vba,ms-access-2016,Sql,Vba,Ms Access 2016,我试图更新一个表,其中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
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
Private Sub btnAdd_Click()
Dim intCount为整数
对于intCount=0到DCount(“PONum”、“tblBOMReceiptDetails”)
如果选择了Me.lstBox.0(intCount),则
DoCmd.RunSQL“更新tblBOMReceiptDetails集tblBOMReceiptDetails.ContainerNumber=[Forms]![frmUnapprovedPOs\u New]![txtContainerNumber],tblBOMReceiptDetails.BOL=[Forms]![frmUnapprovedPOs\u New]![frmUnapprovedPOs\u New]![txtReceivedLocation],tblBOMReceiptDetails.SteamShip=[Forms]![frmUnapprovedPOs_New]![txtSteamShip],tblBOMReceiptDetails.Trucker=[Forms]![frmUnapprovedPOs_New]![txtTrucker],tblBOMReceiptDetails.Comments=[Forms]![frmUnapprovedPOs_New]![txtComments]其中tblBOMReceiptDetails.LOTNum=“&Me.lstBox.ItemData(intCount)&”
如果结束
下一个
Me.lstBox.Requery
更新错误是什么?请尝试删除最后一个符号和引号:和“
”。