update query with subqueries, not updateable

Domski74

Registered User.
Local time
Today, 00:29
Joined
Jan 29, 2009
Messages
18
Hi All

I'm trying to set a day count based on the number of days in the year and take account of possible leap years. The table only ever contains a years cumulative data and the day count needs to run from the first of April and be flexiable enough not to need maintenance to account for a new year. I've witten the below which works fine in a select query butI get a not updateable error in the update?

Code:
UPDATE Pharmacy SET Pharmacy.MRN = "UK" & (DateSerial((select year(min([RIODate])) from Pharmacy)+1,3,31)-DateSerial((select year(min([RIODate])) from Pharmacy),4,1))-(DateSerial((select year(min([RIODate])) from Pharmacy)+1,3,31)-[RIODate])+1;

Please can anyone advise how to correct this so it will work?

Many thanks

Dominic
 
Make a temporary table from selected data and then main table with data from that temporary table
 

Users who are viewing this thread

Back
Top Bottom