Thanks, Lynn - especially for not pointing the non-deliberate error (I
changed the name of the function at the last minute). Corrected version
below. But I've just checked: if it's passed a string with no digits it
returns an empty string, not a Null.
John
Public Function JustDigits(V As Variant) As Variant
Dim S As String, T As String
Dim j As Long
If IsNull(V) Then
JustDigits = Null
Exit Function
End If
S = CStr(V)
T = ""
For j = 1 To Len(S)
If Mid(S, j, 1) Like "#" Then T = T & Mid(S, j, 1)
Next
JustDigits = T
End Function
Excellent function, John. The only problem I see is that, if there are any
IDs that contain no numeric digits then it will return a Null for that
record. Easy enough to code for, however.
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.