Selasa, 07 Agustus 2012

[MS_AccessPros] Re: Removing forweign language characters

 

Daryl

Use this function. It strips out everything except alpha-numeric and spaces. You can adjust the first Case to include punctuation or whatever. The ASCI values are listed in the help files under Character Set.

Public Function StripJunk(varIn As Variant)
'Purpose : Removes all but alpha-numeric characters and spaces.
'DateTime : 1/19/2007 10:25
'Author : Bill Mosca
Dim varOut As Variant
Dim x As Integer

'Leave if null input.
If IsNull(varIn) Then Exit Function

varOut = varIn
'loop through string and remove everything
'except alpha-numerics.
For x = Len(varIn) To 1 Step -1
Select Case Asc(Mid(varOut, x, 1))
Case 32, 48 To 57, 65 To 90, 97 To 122
'Do nothing. Ignore spaces.
Case Else
'Replace junk with pipe to keep len same as original.
varOut = Replace(varOut, Mid(varOut, x, 1), "|")
End Select
Next

varOut = Trim(varOut)

'Return cleaned up value after removing spaces.
StripJunk = Replace(varOut, "|", "")

End Function

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com

--- In MS_Access_Professionals@yahoogroups.com, Daryl Walke <darylwalke@...> wrote:
>
> Hello,
>  
> I am trying to remove foreign language characters from a string in Access.  Is there a way to do this? 
>  
> Thanks!
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar