Hi Bob,
I was trying an update with a self join which works in transact sql (for
sql server), but Jet sql (for Access) does not support updates on self
joined tables. Here is what the query looks like (that works -- using
Transact syntax in sql server)
UPDATE tblDates AS t1 INNER JOIN [Select * FROM
(Select RowID, date1 As dateR FROM tblDates WHERE date1 date2
union all select RowID, date2 As dateR From tblDates where date2 >
date1) tA]. AS t2 ON t1.RowID=t2.Row ID SET t1.date3 = t2.dateR;
The error I got was that Jet needs an updatable query. So the
alternative would be to use 2 separate query operations where you update
your 3rd date column first by checking if the boughtDate is greater than
the soldDate. Then run a 2nd update query where the soldDate is
greatedr than the BoughtDate.
Update yourtbl set date3 = dateb
where dateb date2
Update yourtbl set date3 = dates
where dates dateb
Rich
*** Sent via Developersdex
http://www.developersdex.com ***