S
Scott Millar
I am trying to perform an UPDATE query in MS Access 2000,
but I keep getting an error that the "Operation must be an
updateable query".
Here is a sample of my table (called sample)
SAMPLE
record_id totals totalpercent year
1 85.42 2003
2 45.24 2003
3 75.3 2002
What I want to do is calculate the percentage for each
record, of the totals for each year, and store it in the
totalpercent field. I'm trying to do this in one query.
Here is the query I am trying to use, and the result that
I should get.
UPDATE sample
SET totalpercent = (totals/(SELECT SUM(totals)
FROM sample sum_sample
WHERE sum_sample.year = sample.year))*100
SAMPLE
record_id totals totalpercent year
1 85.42 65.38 2003
2 45.24 34.62 2003
3 75.3 100 2002
I can perform this query in MS SQL Server, just not in
Access, so I'm assuming that it has an issue with using a
SELECT query in an UPDATE query.
Any suggestions??
Thanks,
- Scott
but I keep getting an error that the "Operation must be an
updateable query".
Here is a sample of my table (called sample)
SAMPLE
record_id totals totalpercent year
1 85.42 2003
2 45.24 2003
3 75.3 2002
What I want to do is calculate the percentage for each
record, of the totals for each year, and store it in the
totalpercent field. I'm trying to do this in one query.
Here is the query I am trying to use, and the result that
I should get.
UPDATE sample
SET totalpercent = (totals/(SELECT SUM(totals)
FROM sample sum_sample
WHERE sum_sample.year = sample.year))*100
SAMPLE
record_id totals totalpercent year
1 85.42 65.38 2003
2 45.24 34.62 2003
3 75.3 100 2002
I can perform this query in MS SQL Server, just not in
Access, so I'm assuming that it has an issue with using a
SELECT query in an UPDATE query.
Any suggestions??
Thanks,
- Scott