Hi -
This may or may not be helpful, depending upon the structure possibilities of
your field.
Function GetNumer2(), shown below, will return the first numerical sequence
in a string, e.g.
? getNumer2("ABC123")
123
Problem being, real numbers don't begin with 0, so
? getNumer2("RA010R01")
returns 10, not 010
A workaround could be:
? "0" & getNumer2(("RA010R01")
which would return 010
...problem being, if your string could be something like "RA910RO1"
the previous would return 0910
As I say, it all depends on the possible string structures as to whether this
would be useful:
*******************************************************
Public Function GetNumer2(ByVal pStr As String) As Currency
'*******************************************
'Purpose: Returns the first numerical
' sequence in a string
'Coded by: raskew
'Inputs: ? getNumer2("ABC123")
'Output: 123
'*******************************************
Dim n As Integer
Dim strHold As String
Dim strKeep As String
strHold = Trim(pStr)
n = Len(strHold)
Do While n > 0
If val(strHold) > 0 Then
strKeep = val(strHold)
n = 0
Else
strHold = Mid(strHold, 2)
n = n - 1
End If
Loop
GetNumer2 = val(strKeep)
End Function
*******************************************************
HTH - Bob
Does anyone know how I could parse a string that either looks like
[quoted text clipped - 10 lines]