Hi Corey,
Fisrt a note on the VAL Function. Unfortunately, it stops reading a string at the first character it can't recognize as a number, so:
Val("NET 10 DAYS") would return 0, not 10.
On the finding of alphabetic substrings...
At the top of the UpdateFieldValue routine you'll see the line:
Dim varDate As Variant
Just delete it. The code doesn't use that variable.
If you want to evaluate for alphabetic instead of numeric expressions, find the following line in the SplitString routine:
Code:
blnNumeric = IsNumeric(avarStringArray(intIndex))
and add the NOT operator:
Code:
blnNumeric = Not IsNumeric(avarStringArray(intIndex))
Also, rename the variable blnNumeric to blnAlphabetic so the code more accurately reflects whats going on.
The Split function takes a string like "NET 10 DAYS" and stores the delimited portion of the string in a variant array like:
avarStringArray(0) = NET
avarStringArray(1) = 10
avarStringArray(2) = DAYS
The line blnAlphabetic = Not IsNumeric(avarStringArray(intIndex)) would evaluate each array element to see if it contains only alphabetic charaters. The code exits, however, after finding the fist element that contains alphabetic characters. So the code output (and the final state of your table with the values updated) would look like:
Original data: Net 10 Days
Changed data: Net
Original data: 100% 10
Changed data: 100%
Original data: Net 30
Changed data: Net
If you wanted the code to pick up both alphabetic expressions in a string like "Net 10 Days", the code would need some revision.
HTH,
Bob