Truncating data

A

Alylia

Hello,

Sometimes ago, I requested and got help on truncating the last three digits
from a field with data of the following format ????-????-???. I would
appreciate help on truncating the just the middle four digits.

I tried truncating the last eight and then based on the result obtained,
truncate the first four. It worked but the problem is that I cannot query on
the truncated data as I get an error.

Thanks for your support.
 
O

Ofer

To remove the four middle char, include the dash ("-")

=left(FieldName,4) & right(FieldName,3)
 
A

Alylia

Your support is much appreciated.

Thx

KARL DEWEY said:
If there dashes then use this --
Right(Left([YourTable].[YourField],9),4)

If there are no dashes then use this --
Right(Left([YourTable].[YourField],8),4)

To query on the truncated data use this --
Like "*" & Right(Left([YourTable].[YourField],8),4) & "*"

Alylia said:
Hello,

Sometimes ago, I requested and got help on truncating the last three digits
from a field with data of the following format ????-????-???. I would
appreciate help on truncating the just the middle four digits.

I tried truncating the last eight and then based on the result obtained,
truncate the first four. It worked but the problem is that I cannot query on
the truncated data as I get an error.

Thanks for your support.
 

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