我试图过滤使用VBA从访问中提取的数据集,但是由于某些原因,此代码未返回过滤后的结果。
With BrokerData
.ActiveConnection = BrokerConn
.Source = "SELECT * FROM BP_Closed_Deals WHERE EMM_Name = 'JM' OR 'J-C E';"
.LockType = adLockReadOnly
.CursorType = adOpenForwardOnly
.Open
End With
答案 0 :(得分:2)
以下无效的SQL语法:
WHERE EMM_Name = 'JM' OR 'J-C E'
您要
WHERE EMM_Name = 'JM' OR EMM_Name = 'J-C E'
也可以用IN
运算符表示:
WHERE EMM_Name IN ('JM', 'J-C E')