This would require a custom function. Past the following function into a
vba and save the module (modNumONly)
Now you can use the function in an update query if you want to change the
data or in a select query if you want to keep the data as it is currently
stored, but see just the numbers
Field: fStripToNumbersOnly([YourField]
In an update query, the SQL might look like
UPDATE [YourTable]
SET [YourField] = fStripToNumbersOnly([YourField])
Public Function fStripToNumbersOnly(ByVal varText As Variant)
'Takes input and returns only the numbers in the input. Strips out
'all other characters. Handles nulls, dates, numbers, and strings.
Const strNumbers As String = "0123456789"
Dim strOut As String
Dim intCount As Integer
If Len(varText & "") = 0 Then
strOut = varText
Else
varText = varText & ""
For intCount = 1 To Len(varText)
If InStr(1, strNumbers, Mid(varText, intCount, 1)) > 0 Then
strOut = strOut & Mid(varText, intCount, 1)
End If
Next intCount
End If
if Len(strOut) = 0 then
fStripToNumbersOnly = Null
Else
fStripToNumbersOnly = strOut
end if
End Function
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..