Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error "Operation must use an updatable query" when update query. 1

Status
Not open for further replies.

awinnn

MIS
Jul 21, 2003
166
MY
Hi,
I have an error, "Operation must use an updatable query" when trying to update the query. Any idea?
Is it possible to include sum() in the update query?
any idea? thanx in advance..;)
 
An updateable query MUST be displaying only data held in tables.
The presence of ANY summarising function means that is not the case so you can't update.

There are several other situations leading to non-updateable queries, but it sounds like you understand your own problem and just want confirmation.

 
You can never use something like SUM because if you edit that figure, SQL has no idea how to map your change back to the underlying records. If you've got 2 records with the values 7 and 20, giving a sum of 27, and you change the sum to 26, what does that mean for the two records?

 
You can use the Domain Aggregate function DSum to do what you require. For example:

Table1 with two fields: Key, Value
Table2 with two fields: Key, Value

Objective: Update the value fields in Table2 with the sum of the Value fields for matching Key in Table1.

On the premise that Key is a Text field and Value is a Number field, here is the query:

UPDATE Table2 SET Table2.Value=
DSum("[Value]","Table1","[Key]='" & Table2.Key & "'");
 
Hi all,
Sorry for late reply..;)
I've tested the DSum function and it works..;)
thanx again for the reply..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top