Update Query "Operation must use an updateable query"

I have 2 tables. In one tblOption I have 2 fields OptionID(PrimaryKey) and BasePrice. In another tblOptionsPricing I have 4 fields OptionID, PartNo, Qty, LastCalculatedPrice. The OptionID & PartNo together are the primary key. I have a query qryOptionPricingSummary with the following SQL:
SELECT DISTINCTROW tblOptionsPricing.OptionID, Sum([LastCalculatedPrice]*[Qty]) AS Cost
FROM tblOptionsPricing
GROUP BY tblOptionsPricing.OptionID;
This calculates the total cost of each option. I then want to write the answer back to tblOption. I am trying to do this with an update query as follows:
UPDATE DISTINCTROW tblOptions INNER JOIN qryOptionPricingSummary ON tblOptions.OptionID = qryOptionPricingSummary.OptionID SET tblOptions.BasePrice = [PriceTotal];
When I run the query I receive an alert saying "Operation must use an updateable query".
Why is this and how can I fix it?
awestropeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tbsgadiCommented:
Hi awestrope,
You cannot update an aggregate query.(one with groupby,sums etc)
You can use a dlookup/dsum function instead

Good Luck!

Gary
0
peter57rCommented:
Hi awestrope,
Remove the Distinctrow to start with.  It is meaningless in a Group by query.
What is PriceTotal?

Pete
0
awestropeAuthor Commented:
tbsgadi: are you saying you can't use an aggrgate query to update information in a table? What is the logical reason for this?
peter57r: PriceTotal should read Cost.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

peter57rCommented:
awestrope,
Try this instead: it avoids the aggregate query.

 UPDATE  tblOptions inner join tblOptionsPricing
on tbloptions.optionid = tbloptionspricing.optionid
 SET BasePrice = nz(BasePrice) + ([LastCalculatedPrice]*[Qty])


Pete
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awestropeAuthor Commented:
But I need to do the aggregation as there are multiple rows in tbloptionspricing
0
peter57rCommented:
That's OK.  The query does multiple updates per OptionID.

Pete
0
awestropeAuthor Commented:
Cunning - like it!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.