Finding a string in a field padded with spaces

G

Guest

How would I find a 5 character substring at the end of a variable length
string that is in a field that appears to be padded with spaces to the Right
because nothing shows up when I use the Right Function?
 
J

John W. Vinson

How would I find a 5 character substring at the end of a variable length
string that is in a field that appears to be padded with spaces to the Right
because nothing shows up when I use the Right Function?

Please post your expression and an example of the data that's not showing up.
It sounds like you're saying it's at the end of the string but it's not
showing up because it's not at the end of the string!

If you want to trim trailing blanks before using Right(), you can use the
Trim() function:

Right(Trim([fieldname]), 5)

will return ABCDE for "123ABCDE", " 345ABCDE ", or any string ending in
ABCDE followed by nothing but blanks.

John W. Vinson [MVP]
 

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