Access Query

Asked By Ken Taylor
20-Nov-09 02:42 PM
I have a table with approx 270K records.  One colum contains an ID codes i.e. WATUA1, WAXUB0 etc.



I need to change the last to letters to AA, i.e. WATUAA, WAXUAA etc.



How would you write an update query to make the adjustment.



Thanks

Ken

STEP 1: BACKUP your data before attempting the following.

John Spencer replied to Ken Taylor
20-Nov-09 03:45 PM
STEP 1:  BACKUP your data before attempting the following.
STEP 2:  BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way you
expect.

UPDATE [YourTable]
SET [ID Codes] = Left([Id Codes],Len([Id Codes])-2) & "AA"
WHERE [Id Codes] is Not Null AND [Id Codes] <> ""


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Post Question To EggHeadCafe