Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update records to 06-xxxx where they are 05-xxxx 1

Status
Not open for further replies.

AccessGuruCarl

Programmer
Jul 3, 2004
471
US
Can I write an update query to change only the starting value of a field.

I have records with

05-1A
05-1B
...
...

I need to change the 05 to 06!

Thanks


AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
I forgot to mention.

Some records are like

C13
TEG13
WM13

These values remain the same.

So I where clause!

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
One option would be replace([thefield],'05-','06-')

Put the above in the 'update to' cell of [thefield] or whatever that field is named, in an update query.

Obviously, this is dependant on the data being in a similar format to what you gave, ie, if one value was "05-ceg05-6547", for example, both instnaces of 05- would be replaced.
--Jim
 
Code:
UPDATE myTable

SET myField = '05-' & Mid(myField,4)

Where Left(myField,3) = '06-'
 
Got it backwards
Code:
UPDATE myTable

SET myField = '06-' & Mid(myField,4)

Where Left(myField,3) = '05-'
 
Thanks for the posts....

jsteph - It worked fine in the update query.

Here's a star.....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top