1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Option Compare Database
Private Sub TransposerElement(lstSource As ListBox, lstDestination As ListBox, _
Optional LimiteSelection As Boolean = True)
Dim i As Integer
Dim Db As DAO.Database
Dim requete As String
Set Db = CurrentDb
With lstSource
' (la 2eme liste)
If LimiteSelection Then
For i = 0 To .ListCount - 1
'si l'élement est sélectionné dans la liste source,
If .Selected(i) Then
requete = "DELETE T_TECHNOLOGIE_PROJET.ID_TEC, T_TECHNOLOGIE_PROJET.ID_PRO FROM T_TECHNOLOGIE_PROJET WHERE (((T_TECHNOLOGIE_PROJET.ID_TEC)=" & Chr(34) & .Column(0, i) & Chr(34) & " AND ((T_TECHNOLOGIE_PROJET.ID_PRO)= " & Forms.NomFormulaire.NID & "));"
MsgBox (requete)
Db.Execute requete
End If
Next i
End If
'Rafraichit la zone de liste source
.Requery
End With
'Rafraichit la zone de liste destination
lstDestination.Requery
End Sub |
Partager