访问具有多个数字的VBA SQL语句Where条件

时间:2016-06-01 13:49:16

标签: access-vba

我有以下代码行导致运行时错误“3061”;参数太少。我确定错误是由于数字变量周围的语法,但我尝试了几个不同的引用和括号的安排没有运气。

Private Function ChangeWorkCenterAll(rId As Integer, newUserId As Integer, sId As Integer)    

Dim rs As DAO.Recordset
Dim q As String

q = "SELECT * FROM Schedules INNER JOIN Activities ON Schedules.ActivityId = Activities.ActivityId WHERE (Activities.RoleId = " & rId & " AND ShopOrders.ShopOrderId = " & sId & ");"
    Set rs = CurrentDb.OpenRecordset(q, dbOpenDynaset)

0 个答案:

没有答案