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

Adding character to existing field 1

Status
Not open for further replies.

CaptainBob007

Programmer
Dec 20, 2003
42
US
I have an existing database with a text field that is 5 characters long. In my forms I have it masked to appear as 00-000 where the 0's represent any number 0-9. Due to poor planning on my part, I'm going to need to add another digit so it appears as 00-0000. In other words I need to insert a character 3 from the right. Increasing the field size is the easy part, but inserting the character in that particular spot I'm not so sure about. How would I go about writing a script to do this? The field is not the primary key, so hopefully it will be easier to change. Any advice is greatly appreciated.

~Bob
 
Bob,
After changing the defined field size, just do an update query like this:

UPDATE <mytable> SET <mytable>.<myfield> = Left([<myfield>],4) & <thenewcharacter> & Right([<myfield>],2);


Tranman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top