|
djbomb95
Starting Member
9 Posts |
Posted - 09/08/2012 : 03:23:18
|
Ok, I have a perfectly fine SQL query, and it does exactly what I want it to do. This is it below.
SELECT Sum(Price) AS TotalPrice FROM PizzaOrder WHERE PizzaOrder.PizzaID In (SELECT PizzaID FROM PizzaOrder WHERE OrderID = 89);
My issue arises when I come accross to vba, trying to get the value that this query would return into a textbox. The way I've translated it goes as follows:
txtPrice = DSum("Price", "PizzaOrder", "PizzaID IN " & DLookup("PizzaID", "PizzaOrder", "OrderID = " & txtOrderID & "") & "")
txtPrice is the name of the textbox. I've used a dsum() to replace the Sum() in sql, and my main need is to find an alternative to the "Where... In (Subquery)" syntax. Dlookup only returns the first value, but I am sure I will require more than one value to be returned. Any help would be greaty appreciated. Thanks. |
|