How to do this?

P

Paul

How to determine the position of theLEFT nesrest numeric value in a string
in a query? For example Microsoft2xyz = 10 and Oracle3xyz5hjg = 7 etc
 
T

Tom Lake

Paul said:
How to determine the position of theLEFT nesrest numeric value in a string
in a query? For example Microsoft2xyz = 10 and Oracle3xyz5hjg = 7 etc

Put the function below in a module then put a call to it in your query.

Function FirstNum(strMyString As String) As Integer
Dim i As Long, strTemp As String
FirstNum = 0
For i = 1 To Len(strMyString)
strTemp = Mid(strMyString, i, 1)
If strTemp >= "0" And strTemp <= "9" Then
FirstNum = i
Exit For
End If
Next
End Function

Tom Lake
 
Top