J
JEH
I am working on an MS Access database which takes names type and Arabic and
translates them into English but am stumped by an inexplicable failure to
solve what appears to be a relatively simple problem.
The database consists of two tables:
tblMAIN, which holds the Arabic names and other personnel data
ICS Naming Standards, which holds the Arabic names and their English
translations.
I am using a function called ICS LookUp(), to pass an arabic string
(strName_A) to an SQL Query which executes an SQL query on an ADODB recordset
from the ICS Naming Standards table to return the English translation. The
SQL query, which works fine as an MS Access query, fails to find the
corresponding record in the ICS table.
Public Function ICS_LookUp(strName_A As Variant) As Variant
On Error GoTo Err_ICS_LookUp
Dim adoRst As ADODB.Recordset ' Recordset for Arabic name
look up
Dim strSQL As String
strName_A = Trim(strName_A)
' Translate
strSQL = "SELECT [ICS Naming Standards].Arabic, [ICS Naming
Standards].ICS FROM [ICS Naming Standards] WHERE ((([ICS Naming
Standards].Arabic)= '" & strName_A & "' ))"
' Lookup Arabic Value (Arabic) in ICS table and return English translation
(ICS)
Set adoRst = New ADODB.Recordset
adoRst.ActiveConnection = CurrentProject.Connection
adoRst.Open strSQL, , adOpenDynamic, adLockOptimistic
ICS_LookUp = adoRst("ICS")
adoRst.Close
Set adoRst = Nothing
Exit_ICS_LookUp:
Exit Function
Err_ICS_LookUp:
ICS_LookUp = "[Not Found]"
MsgBox Err.Description
Resume Exit_ICS_LookUp
End Function
I suspect that the issue has something to do which the way in which SQL
handles foreign languages, specifically Arabic, versus how MS Access handles
the same. An MS Access query immediately returns the correct English value.
Any suggestions?
JEH
translates them into English but am stumped by an inexplicable failure to
solve what appears to be a relatively simple problem.
The database consists of two tables:
tblMAIN, which holds the Arabic names and other personnel data
ICS Naming Standards, which holds the Arabic names and their English
translations.
I am using a function called ICS LookUp(), to pass an arabic string
(strName_A) to an SQL Query which executes an SQL query on an ADODB recordset
from the ICS Naming Standards table to return the English translation. The
SQL query, which works fine as an MS Access query, fails to find the
corresponding record in the ICS table.
Public Function ICS_LookUp(strName_A As Variant) As Variant
On Error GoTo Err_ICS_LookUp
Dim adoRst As ADODB.Recordset ' Recordset for Arabic name
look up
Dim strSQL As String
strName_A = Trim(strName_A)
' Translate
strSQL = "SELECT [ICS Naming Standards].Arabic, [ICS Naming
Standards].ICS FROM [ICS Naming Standards] WHERE ((([ICS Naming
Standards].Arabic)= '" & strName_A & "' ))"
' Lookup Arabic Value (Arabic) in ICS table and return English translation
(ICS)
Set adoRst = New ADODB.Recordset
adoRst.ActiveConnection = CurrentProject.Connection
adoRst.Open strSQL, , adOpenDynamic, adLockOptimistic
ICS_LookUp = adoRst("ICS")
adoRst.Close
Set adoRst = Nothing
Exit_ICS_LookUp:
Exit Function
Err_ICS_LookUp:
ICS_LookUp = "[Not Found]"
MsgBox Err.Description
Resume Exit_ICS_LookUp
End Function
I suspect that the issue has something to do which the way in which SQL
handles foreign languages, specifically Arabic, versus how MS Access handles
the same. An MS Access query immediately returns the correct English value.
Any suggestions?
JEH