Remove preceeding characters

2

2Blessed4Stress

I have a text field that contains information that looks like this:
........ 7270
I want to be able to remove the preceeding ".....". All of the data does
not have the same amout of "....". Some of the data starts with alpha
characters. (don't know if this makes a difference)
 
A

Arvin Meyer [MVP]

Use the Replace function:

Replace([TextFieldName],".","")

in a query, like this:

Update MyTable Set MyField = Replace([MyField],".","");
 
D

Duane Hookom

From your sample data and specifications, the result is always "7270". Do you
actually need to return only the rightmost 4 characters?

You might want to open any module and search help on:
Instr()
Left()
Right()
Mid()
 
2

2Blessed4Stress

Thank you. This was helpful until I ran into a field that contained:
".......3.5"
Of course it removed the "." between the 3 & 5. Any idea on how to prevent
that?

Arvin Meyer said:
Use the Replace function:

Replace([TextFieldName],".","")

in a query, like this:

Update MyTable Set MyField = Replace([MyField],".","");
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

2Blessed4Stress said:
I have a text field that contains information that looks like this:
....... 7270
I want to be able to remove the preceeding ".....". All of the data does
not have the same amout of "....". Some of the data starts with alpha
characters. (don't know if this makes a difference)
 
A

Arvin Meyer [MVP]

Not with the Replace() function. A custom function that avoided single dots
could be written, or, more simply, if there are only a few you could just
remove them.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

2Blessed4Stress said:
Thank you. This was helpful until I ran into a field that contained:
".......3.5"
Of course it removed the "." between the 3 & 5. Any idea on how to
prevent
that?

Arvin Meyer said:
Use the Replace function:

Replace([TextFieldName],".","")

in a query, like this:

Update MyTable Set MyField = Replace([MyField],".","");
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

2Blessed4Stress said:
I have a text field that contains information that looks like this:
....... 7270
I want to be able to remove the preceeding ".....". All of the data
does
not have the same amout of "....". Some of the data starts with alpha
characters. (don't know if this makes a difference)
 
Top