return / extract just text from field

civileng

Registered User.
Local time
Today, 11:57
Joined
Apr 15, 2013
Messages
12
I have a field which contains "01501 PRIKLJ. VRHNIKA - LJ / Števno mesto" .
1.) I would like to extract just text part from that field, how? *number is always on begining but different 1-10000

2.) Optional, how could I delete in this new only text field part of text after / ...*some rows have some dont /
 
The Instr function will allow you to find the first space add 1 and you have the starting place for a Mid function to select the text. If you always have a / even if no text after it a second instr can find that and thus allow you to calculate the length for the mid to just extract the text you require, if there is no / then this instr will return 0 and this could be tested for and then you will know that you don't have to worry about it. Note that a mid without a length defaults to end of field.
You end up with something like

Iif(instrfor/=0,mid(field,instrforspace+1),mid(field,instrforspace+1,instrfor/-1))

Brian

Ps if you don't know instr and mid and can't find them in help google them
 
Last edited:

Users who are viewing this thread

Back
Top Bottom