By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,825 Members | 2,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,825 IT Pros & Developers. It's quick & easy.

Search number in a string

P: n/a
How to check a number in a string. Some times i have values contains
numbers some times dont. I try split but it gives error when there is
no number in the string. What i need is to check the string if it not
contains numbers than ok otherwise i have to remove the number from the

Name Change Form
Name Change Form 23124

Thank You

Aug 26 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
nothing to it. Write a function

Public Function StripNumbers(ByVal strText As String) As String
Dim intCounter As Integer
For intCounter = 1 To Len(strText)
If Not IsNumeric(Mid$(strText, intCounter, 1)) Then
StripNumbers = StripNumbers & Mid$(strText, intCounter, 1)
End If
Next intCounter
End Function

use a query to call the function in an update query.

Update MyTable
SET MyField = StripNumbers([MyTable].[MyField])
FROM MyTable;

Aug 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.