G
graeme34 via AccessMonster.com
Hi I have a query which selects all the details from a product table, as well
as the account index and date ordered for any order placed for that product
from the purchase order table and finally selects the price paid for that
order from the purchase details table....what I am trying to do is select
only the product that is currently shown in a combo box (displaying Product
codes) then display the order details of the last placed order......I have
tried the following query but it is returning empty, obviously I'm doing
somehting wrong, does anybody know what???
SELECT P.[Product Code], P.ProductType, P.Description, P.[Quantity In Stock],
P.[Quantity Description], PO.DateOrdered, POD.Price,
PO.AccountIndex
FROM tblPurchaseOrder PO INNER JOIN (tblProduct P INNER JOIN
tblPurchaseOrderDetails POD ON P.[Product Code] = POD.ProductCode) ON
PO.PurchaseOrderNumber = POD.PurchaseOrderNumber
WHERE PO.DateOrdered = (SELECT MAX(T.DateOrdered) FROM tblPurchaseOrder T
WHERE P.[Product Code] = [Forms]![frmProductEnquiry]![cboMoveTo]);
Thanks
as the account index and date ordered for any order placed for that product
from the purchase order table and finally selects the price paid for that
order from the purchase details table....what I am trying to do is select
only the product that is currently shown in a combo box (displaying Product
codes) then display the order details of the last placed order......I have
tried the following query but it is returning empty, obviously I'm doing
somehting wrong, does anybody know what???
SELECT P.[Product Code], P.ProductType, P.Description, P.[Quantity In Stock],
P.[Quantity Description], PO.DateOrdered, POD.Price,
PO.AccountIndex
FROM tblPurchaseOrder PO INNER JOIN (tblProduct P INNER JOIN
tblPurchaseOrderDetails POD ON P.[Product Code] = POD.ProductCode) ON
PO.PurchaseOrderNumber = POD.PurchaseOrderNumber
WHERE PO.DateOrdered = (SELECT MAX(T.DateOrdered) FROM tblPurchaseOrder T
WHERE P.[Product Code] = [Forms]![frmProductEnquiry]![cboMoveTo]);
Thanks