Combo box - 3 columns - Spanish/Vietnamese/English

manito2000

Registered User.
Local time
Today, 11:47
Joined
Apr 15, 2008
Messages
15
Hello everyone...

I have a database where I am using a combo box with 3 columns. It has a total of 3 rows. The reason for the 3 columns is I have a term that is translated in English, Vietnamese, Spanish.

For example:
English text in Column 1 = Yes
Spanish text in Column 2 = Si
Vietnamese text in Column 3 = Phải

...I am placing the combo box on my form.

In my main table I have fields for English, Vietnamese, Spanish.

Essentially - what I want it to do - is to populate the English, Vietnamese, Spanish fields based on my selection on the combobox.

Do I make sense...?

So...if I choose yes...I want it to populate Yes, Si and Phải in my main table.
 
OK lets assume your table is structure like;

TermID (auto number PK)
TermEnglish
TermSpanish
TermViet


I'll also assume that the bound column of your combo column(0) holds the PK and column(1) of your combo holds the English term so does not need to be displayed in it's own text box, in the control source for Spanish Text box put the following;
Code:
=Me.ComboName.Column(2)
and in your Vietnamese text box put the following;
Code:
=Me.ComboName.Column(3)
You might also want to want to set those two text boxes Locked = Yes so that your user can not inadvertently overwrite the data.
 
Depending on the circumstances there would be a few ways to go, here are two: -

Code:
Private Sub cboTranslations_AfterUpdate()
    Dim strSQL As String

    Me![English] = Me.cboTranslations.Column(1)
    Me![Vietnamese] = Me.cboTranslations.Column(2)
    Me![Spanish] = Me.cboTranslations.Column(3)
   
    ' XOR
   
    strSQL = " UPDATE tblMyTable" & _
             " SET [English] = " & Chr(34) & Me.cboTranslations.Column(1) & Chr(34) & "," & _
             "     [Vietnamese] = " & Chr(34) & Me.cboTranslations.Column(2) & Chr(34) & "," & _
             "     [Spanish] = " & Chr(34) & Me.cboTranslations.Column(3) & Chr(34) & _
             " WHERE ID = " & Me!ID

    CurrentDb.Execute strSQL, 128

End Sub

HTH.

Edit: Hello, John :D
Edit2: And I win by 59 minutes because you’re on daylight saving and I’m not. :D
Chris.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom