Unanswered: detect string is japanese, not english
Suppose that on "A" form, I have 2 textboxes: "English" and "Japanese".
On "English" textbox will be inputted English string only, and "Japanese"
textbox will be inputted Japanese stirng only.
But in some case, my users input Japanese string into English textbox by mistake.
Could anyone give me some code to insert into before update event to check
wether user in input to correct textbox?
Pls help me. I need your help.
Probably the easiest solution would be to check if the string fits into the normal ASCII character set.
I've wrote a quick function for you:
Function IsASCIIString(strValue As String) As Boolean
' Written by Wayne Phillips, 21/01/2006
' Free to use
Dim i As Long
Dim lngLength As Long
Dim blnRetVal As Boolean
Dim intUnicodeValue As Integer
'Length in characters
lngLength = Len(strValue)
For i = 1 To lngLength
intUnicodeValue = AscW(Mid(strValue, i, 1))
If intUnicodeValue < 0 Or _
intUnicodeValue > 127 Then
IsASCIIString = False
'No non-ASCII characters were found.
IsASCIIString = True
Then, in your form code you can test like this:
If Len(TextBoxName) > 0 Then
If Not IsASCIIString(TextBoxName) Then
MsgBox "You entered non-ASCII characters!"