I'm trying to capture a part of a text field depending on where the first alpha character appears in it.
i.e. Ref = "5923587MAN2",
Ref = "98062 006125879A02"
So I want the 7 numeric characters which appear before the first letter.
I've been trying things along these lines, but can't figure out (without using a looping sequence) an easy way to check for any alpha character;
NewRef = Mid(Ref,instr(1,Ref,"A"
-7,7)
but as you can see this wouldn't work if the first alpha character was "B"
My other alternative would be to check the string length and capture the numbers from fixed positions, but this isn't as flexible as it might need to be.
I would appreciate if anyone could let me know if there is a "proper" way to do this? Some function I haven't yet come accross?
Thanks in advance
Remy Hundreds of ways to do things with VB, and learning new ways every day.
i.e. Ref = "5923587MAN2",
Ref = "98062 006125879A02"
So I want the 7 numeric characters which appear before the first letter.
I've been trying things along these lines, but can't figure out (without using a looping sequence) an easy way to check for any alpha character;
NewRef = Mid(Ref,instr(1,Ref,"A"
but as you can see this wouldn't work if the first alpha character was "B"
My other alternative would be to check the string length and capture the numbers from fixed positions, but this isn't as flexible as it might need to be.
I would appreciate if anyone could let me know if there is a "proper" way to do this? Some function I haven't yet come accross?
Thanks in advance
Remy Hundreds of ways to do things with VB, and learning new ways every day.