Remove preceeding characters

G

Guest

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],".","");
 
G

Guest

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()
 
G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top