Bonjour,
Dans une application, je voudrais sélectionner la ligne d'un DataCombo qui contient un certain texte.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
 
    For k = 0 To frmMain.ADOTableSites.Recordset.Fields.Count - 1
         If frmMain.ADOTableSites.Recordset.Fields(k).Name = "AntennaReference" Then
             For i = 0 To frmSelectParts.ADOTable.Recordset.RecordCount - 1
                  For j = 0 To frmSelectParts.ADOTable.Recordset.Fields.Count - 1
                       If frmSelectParts.ADOTable.Recordset.Fields(j).Name = "Reference" Then
                           If frmSelectParts.ADOTable.Recordset.Fields(j).Value = frmMain.ADOTableSites.Recordset.Fields(k).Value Then
                               frmSelectParts.cbxSelectPart.Text = frmSelectParts.ADOTable.Recordset.Fields(j).Value
                               IndexSite = Index
                               frmSelectParts.Show
                               Exit Sub
                           Else
                               frmSelectParts.ADOTable.Recordset.MoveNext
                           End If
                       End If
                   Next j
               Next i
           End If
       Next k
Ce que j'ai essayé dans le code ci-dessus, c'est ceci:
frmSelectParts.cbxSelectPart.Text = frmSelectParts.ADOTable.Recordset.Fields(j).Value

Mais ça ne marche pas...

Pourriez vous m'aider?

Merci d'avance