Results 1 to 5 of 5
  1. #1
    Tanz is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    3

    I need to check the language in a field through a query


    Hello, I need help with identifying language in a field. I have a table field which could have values in 2 languages - English and Arabic and I need to be able to find that out through a query. Thanks

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Please tell us more - show the table(s) design and a sample instance of the issue.
    Have you considered a language code in your design (1 English, 2 Arabic)?

  3. #3
    Tanz is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    3
    The purpose of this exercise is data cleansing of bulk data coming out of CRM system. I am attached the table design and sample data instance. As shown in the data instance snapshot, the first name could be either English or in Arabic and I should be able to identify that through a function in a query

    Click image for larger version. 

Name:	Table Design.jpg 
Views:	9 
Size:	166.6 KB 
ID:	41476Click image for larger version. 

Name:	Data Instance.jpg 
Views:	9 
Size:	30.1 KB 
ID:	41477

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Here's a function from a small mock up of your situation that may be helpful.
    it is based on assumption that preferredLang is represented by the language/alphabet
    used to record the FirstName.

    Sample data
    Code:
          
    id FirstName LastName PreferredLang
    1 David Fare
    2 Felix Genth
    3 A.F. Berth
    4 Bern Nelroy
    5 V.N. Halu
    6 Claude Van Dam
    7 Polly Dactyl
    8 Ura Payne
    9 Paige Turner
    10 يوحنا ابراهيم
    11 نال جابر
    Sample function
    Code:
    Function EorA(sName As String) As String
    'routine to see if first char of name is English or Arabic
    
        Dim alpha As String
        Dim i As Integer
        alpha = "abcdefghijklmnopqrstuvwxyz"
        If InStr(alpha, Left(sName, 1)) > 0 Then
            EorA = "english"
        Else
            EorA = "Arabic"
        End If
    End Function
    Sample test routine

    Code:
    Sub testEorA()
    Dim rs As Dao.Recordset
    Set rs = CurrentDb.OpenRecordset("Select id,firstName,lastname from tblNames")
    Do While Not rs.EOF
    '
    'demo to print the result but you could assign the value to PreferredLang and update the record
    '
    Debug.Print rs!id, EorA(rs!firstname)
    rs.MoveNext
    Loop
    rs.Close
    End Sub
    Result

    Code:
    1            english
     2            english
     3            english
     4            english
     5            english
     6            english
     7            english
     8            english
     9            english
     10           Arabic
     11           Arabic
    Last edited by orange; 04-06-2020 at 07:16 AM. Reason: spelling

  5. #5
    Tanz is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    3
    Thanks a lot. It worked. Cheers

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 11-27-2017, 08:26 AM
  2. Append Query video in Arabic language
    By kemas in forum Access
    Replies: 0
    Last Post: 07-26-2016, 08:28 AM
  3. Replies: 8
    Last Post: 01-09-2016, 04:51 PM
  4. Replies: 4
    Last Post: 02-03-2014, 12:16 PM
  5. Language Issue in Access Query
    By somnath in forum Queries
    Replies: 2
    Last Post: 09-07-2011, 10:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums