Combobox problem

exaccess

Registered User.
Local time
Today, 08:30
Joined
Apr 21, 2013
Messages
287
Hello Experts,
I have a problem. Consider two tables.
Table1: name=TargetTbl, fields=operation (number),Libelle1 (Text)
Table2: name =TextArrayTbl, fields=Sequence (number), Sorter (number), Phrase(Text).
Table1 has around 1000 records, Table2 has around 36000. They are linked via the fields Operation=Sorter. One Operation may have many Sorters.
Query: the query linking them is
Code:
strSQL="SELECT TextArrayTbl.Sequence, TextArrayTbl.Sorter, TextArrayTbl.Phrase " & _
            "FROM TextArrayTbl LEFT JOIN TargetTbl ON TextArrayTbl.Sorter = TargetTbl.Operation " & _
            "WHERE (((TextArrayTbl.Sorter) = [Forms].[DisplayTargetFm].[Operation])) " & _
            "ORDER BY TextArrayTbl.Sequence;"
Form: A continuous form called DisplayTargetTblFm. Recordsource=TargetTbl table
Fields: Operation (text), LibelBx (Combobox 3 columns corrosponding to Sequence, Sorter, Phrase. Phrase is bound column RowSource = strSQL, Libelle1.
Now what I wish to do is to call up the form DisplayTargetTblFm, goto any line, hit small arrow of the combo, the list drops down, select any item of the list, Item is copied to the field Libelle1 and changes color, cycle completed. I tried the following code.
Code:
Private Sub LibelBx_AfterUpdate()
   LibelBXState
End Sub
Sub LibelBXState()
    Dim ICol As Long, Indx As Long, ForName As String
    ForName = "DisplayTargetFm"
    Indx = Me.LibelBx.ListIndex
    MsgBox "selected phrase=" & Me.LibelBx.ItemData(Indx + 1)
    Me.Libelle1 = Me.Libelle1 + Me.LibelBx.ItemData(Indx + 1)
    Me.LibelBx.ItemData(Indx + 1).BackColor = "*FFF200"
    Me.LibelBx.ItemData(Indx + 1).ForeColor = "*ED1C24"
    
End Sub
It does not work. The combo comes up but it does not do the rest and what is more when I go to the other lines the same combo data comes up whereas the operation number changes. I need help. Thanks in advance
 

Users who are viewing this thread

Back
Top Bottom