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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing text

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
GB
I am using CR 16

I sometimes have data with text at the end saying "- Group" eg "abcdefghijk - Group" or 12345 - Group" how do I remove the - Group and leave abcderghijk or 12345
 
Trim(Left({table.field},instr({table.field},”-“)-1)

Be sure to replace my quote marks with your own.

-LB
 
An alternate approach would be:

Code:
Replace({Table.Field}, '- Group', '')

This would also avoid the problem that would arise if the text had another "-" in it, in addition to the one before "Group"

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top