Hi
I am struggling with this query. The message box simply returns the sql text itself, not the count result. All I need is the count of the field "warranty" when the SKU equals a specific value and "warranty" = 1.
I have verified that this returns a single number in the query design window, so what am I doing wrong in this VBA code?
mafhobb
I am struggling with this query. The message box simply returns the sql text itself, not the count result. All I need is the count of the field "warranty" when the SKU equals a specific value and "warranty" = 1.
Code:
SQL = "SELECT Count(ReturnInfo.Warranty) AS CountOfWarranty FROM Calls INNER JOIN ReturnInfo ON Calls.CallID = ReturnInfo.CallID GROUP BY Calls.SKU, ReturnInfo.Warranty HAVING (((Calls.SKU)='" & SKUList!SKU & "') AND ((ReturnInfo.Warranty)=[1]))"
MsgBox SQL
I have verified that this returns a single number in the query design window, so what am I doing wrong in this VBA code?
mafhobb