Sir,
I tried your code, it produces #Error, if the reffered field is blank.
I used like below in query
GetJobNo: NumbersInString([PDIJobNo])
It fetch the number and perfect, if data is there in the PDIJobNo field, if
the field is blank, it show #Error.
Thanks and best regards
Irshad
"PieterLinden via AccessMonster.com" wrote:
How about...
Function NumbersInString(Optional WithNumbers As String) As String
Dim Temp As Variant
Dim T As Integer
If IsMissing(WithNumbers) Then
NumbersInString = Null
Else
For T = 1 To Len(WithNumbers)
If IsNumeric(Mid(WithNumbers, T, 1)) Then
Temp = Temp & Mid(WithNumbers, T, 1)
End If
Next
NumbersInString = Temp
End If
End Function
Unlike Ken, I'm far too lazy to rewrite the whole thing... so I modified it
a little and it *seems* to work fine.
?numbersinstring("ABC1234DEF567G89H")
123456789
?numbersinstring()
returns Null
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201004/1
.