ir26121973
Board Regular
- Joined
- Mar 7, 2006
- Messages
- 79
Hi,
Wonder if someone maybe able to help me please. This is fairly complicated to explain and I am really quite new to VB.
Some time ago I posted a query I had on how to pick specific error codes out of a whole string of text.
e.g. The error is Error 15.1 and it has occured.......
From the above I just wanted to pick out 'Error 15.1'
I was kindly given the code below to use which works a treat.
SELECT MyTable.MyField, Mid([MyField],InStr([MyField],"Error")+6,4) AS ErrorCode FROM MyTable;
However new errors have been added that are longer in length e.g. Error 153.1. Now I know that I can, and have changed the 6,4 element of the code to take these longer codes into account.
The problem I have now, is that because I have made these changes, for the shorter codes, it not only takes the Error Code but some of the text after it aswell.
Is there anyway please that the code can take into both the short and long codes.
The one common thing is that they all start with the word 'Error' followed by numerics, then text. I'm not sure whether the code could be designed to say to look for the word 'Error' and then take out what follows until it gets to the next letter, thus taking out the short and long error codes.
Many thanks
Chris
Wonder if someone maybe able to help me please. This is fairly complicated to explain and I am really quite new to VB.
Some time ago I posted a query I had on how to pick specific error codes out of a whole string of text.
e.g. The error is Error 15.1 and it has occured.......
From the above I just wanted to pick out 'Error 15.1'
I was kindly given the code below to use which works a treat.
SELECT MyTable.MyField, Mid([MyField],InStr([MyField],"Error")+6,4) AS ErrorCode FROM MyTable;
However new errors have been added that are longer in length e.g. Error 153.1. Now I know that I can, and have changed the 6,4 element of the code to take these longer codes into account.
The problem I have now, is that because I have made these changes, for the shorter codes, it not only takes the Error Code but some of the text after it aswell.
Is there anyway please that the code can take into both the short and long codes.
The one common thing is that they all start with the word 'Error' followed by numerics, then text. I'm not sure whether the code could be designed to say to look for the word 'Error' and then take out what follows until it gets to the next letter, thus taking out the short and long error codes.
Many thanks
Chris