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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace only the first two (2) characters in a string?

Status
Not open for further replies.

gtroiano

Technical User
Nov 7, 2001
99
US
perhaps i am thick in the skull but i can't figure out how to do this. in a query, i want to take a number like 037012 and replace the first two characters (03) with two other characters. help!

jerry.
 
use an Update Query, and set the Update To row to
"NewValue" & mid([FieldName],3)
This will update ALL RECORDS with those characters you put in place of NewValue, and then everything in the field from position 3 on, unless you specify a Criteria to limit which records get updated
.
Paul F
 
thanks a lot. that set me straight.

jerry.
 
Or you can use this if the record is not the same size and you want change the first 2 characters.

"NewValue" & Right([FieldName], Len([FieldName]) - 2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top