基本的SQL UPDATE和Access 2007 vba问题。有人可以向我解释为什么该查询还会更新BoxType
“ 60ct托运人托盘”,而不仅仅是WHERE
语句中声明的60ct托运人件吗?谢谢!
ElseIf Me!txtBoxType = "60ct Shipper Tray" Then
'Cases that use a 60tray are more complicated. They use 1 each of the base, header, and display
'aswell as 3 shelves.
qdf.SQL = "UPDATE tblBoxList Set Qty = (Qty+(" & Me!txtQtyChange & ")) WHERE BoxType = '60ct Shipper Base' OR '60ct Shipper Header' OR '60ct Shipper Display';"
qdf.Execute dbFailOnError
您需要在每个条件中都包括字段名称OR
。使用SELECT
查询来计算WHERE
子句逻辑。
SELECT *
FROM tblBoxList
WHERE
BoxType = '60ct Shipper Base'
OR BoxType = '60ct Shipper Header'
OR BoxType = '60ct Shipper Display'
您可能更喜欢这种方法。
WHERE BoxType IN
(
'60ct Shipper Base',
'60ct Shipper Header',
'60ct Shipper Display'
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句