Minty
AWF VIP
- Local time
- Today, 19:43
- Joined
- Jul 26, 2013
- Messages
- 10,640
I think I am going mad. I am trying to extract a word in a variable-length string after a specific string. The field is imaginatively called Description.
This really needs to work in a query and I'm a bit anti writing a function as it seems overkill.
There is a string I can identify and find that begins with = "FX" , this works;
At the moment this is returning 18 for all my current data, but I can't guarantee that it always be starting in this position.
I also don't want to rely on the FX text always being the same length - it won't be.
So I need to identify the end of the FX text - the position of the end of the word that begins with "FX" by using the above instr() function, this doesn't work ;
If I hard code the starting position of FX into the calculation it works;
What am I missing out on? I'm positive I have nested Instr() before without these issues.
This really needs to work in a query and I'm a bit anti writing a function as it seems overkill.
There is a string I can identify and find that begins with = "FX" , this works;
Code:
TheStartOfFX: InStr(1,[Description],"FX")
I also don't want to rely on the FX text always being the same length - it won't be.
So I need to identify the end of the FX text - the position of the end of the word that begins with "FX" by using the above instr() function, this doesn't work ;
Code:
TheStartOfTheFirstWordAfterFX : InStr(InStr(1,[Description],"FX"),[Description]," ")
If I hard code the starting position of FX into the calculation it works;
Code:
TheStartOfTheFirstWordAfterFX : InStr( 18 ,[Description]," ")
What am I missing out on? I'm positive I have nested Instr() before without these issues.