The GROUP BY clause guarantees a read-only result.
First, try it without the GROUP BY, and see if the results are editable:
SELECT tblItemDetails. Item_Descriptio n_ID,
tblItemDetails. Active_Status,
tblSalesMaster. Company_Locatio n,
tblSalesMaster. Sale_Date
FROM tblSalesMaster
INNER JOIN (tblItemDetails
INNER JOIN tblSalesDetails
ON tblItemDetails. Item_Descriptio n_ID = tblSalesDetails .Menu_Descripti on_ID)
ON tblSalesMaster. Sales_ID = tblSalesDetails .Sales_ID
If that't not editable, there's no point going further.
It is is, try adding a subquery to the WHERE clause.
Something along these lines:
SELECT tblItemDetails. Item_Descriptio n_ID,
tblItemDetails. Active_Status,
tblSalesMaster. Company_Locatio n,
tblSalesMaster. Sale_Date
FROM tblSalesMaster
INNER JOIN (tblItemDetails
INNER JOIN tblSalesDetails
ON tblItemDetails. Item_Descriptio n_ID = tblSalesDetails .Menu_Descripti on_ID)
ON tblSalesMaster. Sales_ID = tblSalesDetails .Sales_ID
WHERE tblSalesMaster. Sale_Date =
(SELECT Max(Dupe.Sale_D ate) AS MaxOfSale_Date
FROM tblSalesMaster AS Dupe
WHERE Dupe.Sales_ID = tblSalseMaster. Sales_ID)
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Kelii" <ke****@yahoo.c omwrote in message
news:60******** *************** ***********@59g 2000hsb.googleg roups.com...
>
So I have a form which shows all items available for sale, when it was
last sold, where it was last sold, and whether it is active or
inactive.
I would like to be able to edit the active/inactive field (its a yes/
no or boolean type field); however, I am not able to make these edits
because of the max aggregate function used on the sale date.
My question is: does anyone have a work around to this issue?
Note: that I did look through help "When can I update data from a
query" and none of the scenarios seemed to match my situation.
So here's the full background:
tblItemDetails:
Item_Descriptio n_ID (key - 1:M to tblSalesDetails )
Active_Status (boolean)
tblSalesDetails :
Sales_ID (key - M:1 to tblSalesMaster)
Item_Descriptio n_ID (key - M:1 to tblItemDetails)
Count_Sold
tblSalesMaster:
Sales_ID (key - 1:M to tblSalesDetails )
Company_Locatio n
Sale_Date
Query:
SELECT tblItemDetails. Item_Descriptio n_ID,
tblItemDetails. Active_Status, tblSalesMaster. Company_Locatio n,
Max(tblSalesMas ter.Sale_Date) AS MaxOfSale_Date
FROM tblSalesMaster INNER JOIN (tblItemDetails INNER JOIN
tblSalesDetails ON tblItemDetails. Item_Descriptio n_ID =
tblSalesDetails .Menu_Descripti on_ID) ON tblSalesMaster. Sales_ID =
tblSalesDetails .Sales_ID
GROUP BY ... etc ...