I believe that you can use
Update A set field1=field2, field2=field3, field3=field4
and it will work. In my experience it has worked in the past, but I have not
had the need to do something like this since Access 97. The need to do
something like this suggests to me that you have a table design problem or are
stuck with data from another source that you need to normalize.
I would test it after making a backup of the table and adding a where clause
to do one record. After all the database engine you are using may have been
updated and the behavior changed.
Update A
set field1=field2, field2=field3, field3=field4
WHERE PrimaryKey = somespecificValue
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Hans wrote:
> Hi!
>
> Say you have a table A with fields field1, field2, field3 and field4 and I
> want to shift values so field1 receives the value from field2, field2
> receives the value from field3 and field3 receives the value from field4
> (field4 should keep it's value) will a query like
>
> Update A set field1=field2, field2=field3, field3=field4
>
> do the job? Will the right hand side of the assignments always have the
> "old" value before the update? What I'm affraid of is that I set
> field1=field2 but in the same statement updates field2 will access use the
> updated value of field2 and put that into field1? When I test it seems to
> work as I want but I would like someone confirm this.
>
> The alternative would be to run three queries and just update one field at a
> time but if the right hand side of the assignment always have the "old"
> value then I can do the update in one query which will gain performance in
> my case.
>
> Regards
> /Hans
>
>
|