Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove trailing characters from a string

Status
Not open for further replies.

gd

Programmer
Jan 27, 2000
9
CA
Does anyone know of a function or other solution to remove a set number of characters from the end (right) of a string.&nbsp;&nbsp;The string as a whole has no set length.&nbsp;&nbsp;the only thing that is consistent is the last 3 characters.&nbsp;&nbsp;I wish to remove the three characters and then be able to run a group by query based on the portion remaining.<br><br>Example:<br>String1&nbsp;&nbsp;CBE-05B-101A-AM<br>String2&nbsp;&nbsp;CBE-05B-101A-PM<br>or<br>String1&nbsp;&nbsp;BRK-076-AM<br>String2&nbsp;&nbsp;BRK-076-PM<br><br>If I can remove the last three characters then I can group the records according to the first part only and create totals.<br>
 
try this<br>test: Left([username],Len([username])-3)<br>
 
I guess you know you can group on the first so many characters. If you create a report in design view <br>Click &quot;View&quot; menu the &quot;Sorting and Grouping&quot;<br>Pick you field as shown above the in the lower part of the box click &quot;Group Header&quot; = &quot;Yes&quot;<br>Then Group Interval = 3 less than the number of characters<br>Or in your case 16 - 3 = 13<br><br>Or this function will work too.<br>RemoveChars = Left(String1, Len(String1) - 3) <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thanks to the both of you I new it had to be something really simple that I just wasn't thinking of.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top