Hi this thread is a interesting read, for I need to carry out the same procedure on circa 800k records, what I'm not to sure is how do you call the function, do you do it from within a query
Thanks
Mark
Ken Snell wrote:
Define "non-alphanumeric characters"?
05-Mar-10
Define "non-alphanumeric characters"? You mean any character that is not A-
or 0-9? If yes, this function will do what you seek
'*************************************
'*
'* Fxn StripAllNonLetterNumericChars
'*
'*************************************
' ** This function strips all nonletter and nonnumeric characters from
text string
Function StripAllNonLetterNumericChars(varOriginalString As Variant) A
Strin
Dim blnStrip As Boolea
Dim intLoop As Intege
Dim lngLoop As Lon
Dim strTemp As String, strChar As Strin
Dim strOriginalString As Strin
On Error Resume Nex
strTemp = "
strOriginalString = Nz(varOriginalString, ""
For lngLoop = Len(strOriginalString) To 1 Step -
blnStrip = Tru
strChar = Mid(strOriginalString, lngLoop, 1
If strChar Like "[a-z0-9]" Then blnStrip = Fals
If blnStrip = False Then strTemp = strChar & strTem
Next lngLoo
StripAllNonLetterNumericChars = strTem
Exit Functio
End Functio
-
Ken Snel
http://www.accessmvp.com/KDSnell/
Previous Posts In This Thread:
Removing non Alpha Numeric Characters
Okay, I have accountants driving me crazy. They are creating duplicat
entries in our accounting program and I would like our database to be able t
pull out blank spaces, commas, dashes, etc. They have a habit of entering a
invoice number as INV-123 or INV 123 and the accounting system is not catchin
it because of the non-alpha numeric characters
What would be the most efficient way of accomplishing this?
You could run an Update query using replace function
You could run an Update query using replace function -
Replace(Replace(Replace([YourField], "-", ""), " ", ""), ",", ""))
You can add on to it with other character
-
Build a little, test a little
:
Define "non-alphanumeric characters"?
Define "non-alphanumeric characters"? You mean any character that is not A-
or 0-9? If yes, this function will do what you seek
'*************************************
'*
'* Fxn StripAllNonLetterNumericChars
'*
'*************************************
' ** This function strips all nonletter and nonnumeric characters from
text string
Function StripAllNonLetterNumericChars(varOriginalString As Variant) A
Strin
Dim blnStrip As Boolea
Dim intLoop As Intege
Dim lngLoop As Lon
Dim strTemp As String, strChar As Strin
Dim strOriginalString As Strin
On Error Resume Nex
strTemp = "
strOriginalString = Nz(varOriginalString, ""
For lngLoop = Len(strOriginalString) To 1 Step -
blnStrip = Tru
strChar = Mid(strOriginalString, lngLoop, 1
If strChar Like "[a-z0-9]" Then blnStrip = Fals
If blnStrip = False Then strTemp = strChar & strTem
Next lngLoo
StripAllNonLetterNumericChars = strTem
Exit Functio
End Functio
-
Ken Snel
http://www.accessmvp.com/KDSnell/
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Binding Beyond the Limitation of Name Scopes
http://www.eggheadcafe.com/tutorial...f-49faac8854c8/wpf-binding-beyond-the-li.aspx