Truncate the first 2 characters contained in all cells within 1 column of a table in access

  • Thread starter Thread starter jsun1973
  • Start date Start date
J

jsun1973

I hope the title is descriptive enough.

My problem is as follows:

I am trying to truncate the first two characters from all cells
contained in a specific row within a table in an Access DB. All
information within this column (from top down) contain information that
looks like: A-1002-G-0061. I am looking to truncate all the "A-"
parts. The first two characters within the cells range from "A-" to
"E-" (i.e. B-1002-G-0061, C-1002-G-0061, etc.)

I looked into the Replace function, but I can't figure out what they
mean by "Expression as string". I am thinking that I need to link this
to my table, but after a couple of hours of trying to figure out how
that is done, I am about crazy...

Any help on this will be appreciated.

Thanks in advance!
 
I would add a column, then use an update query
The Update query would update the new column{New} with the Truncated {Old}
value

the sql view would look like:

UPDATE Table1 SET Table1.new = Right([Old],Len([Old])-2);

Table1 = Table
Old = Original Column
New = New Column

If you didn't want to add a column, it will work the same:
UPDATE Table1 SET Table1.Old = Right([Old],Len([Old])-2);
 
MBSNewbie said:
I would add a column, then use an update query
The Update query would update the new column{New} with the Truncated {Old}
value

the sql view would look like:

UPDATE Table1 SET Table1.new = Right([Old],Len([Old])-2);

or perhaps faster:

UPDATE Table1 SET Table1.new = Mid([Old], 3);

Tom Lake
 
MBSNewbie said:
I would add a column, then use an update query
The Update query would update the new column{New} with the Truncated {Old}
value

the sql view would look like:

UPDATE Table1 SET Table1.new = Right([Old],Len([Old])-2);

Table1 = Table
Old = Original Column
New = New Column

If you didn't want to add a column, it will work the same:
UPDATE Table1 SET Table1.Old = Right([Old],Len([Old])-2);

Your second suggestion worked perfectly. Thanks so much for bringing
me back from the edge of insanity! :D
 
Back
Top