Jose C
asked on
Extract numbers only from a string
I have an access table with a field called Item PN with examples below
Item_PN
B32853
528034
87394E
I want to extract only the numbers from the string so that the result is:
32853
528034
87394
thanks!
Item_PN
B32853
528034
87394E
I want to extract only the numbers from the string so that the result is:
32853
528034
87394
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please test this function.
Function GetNumbers(parmValue)
Static oRE As Object
If oRE Is Nothing Then
Set oRE = CreateObject("vbscript.regexp")
oRE.Global = True
oRE.Pattern = "[A-Z]"
End If
If IsNull(parmValue) Then
GetNumbers = Null
End If
GetNumbers = oRE.Replace(parmValue, "")
End Function
Open in new window