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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Private Sub lstNotes_Click()
Me.cmdValider.Enabled = False
Me.cmdModifier.Enabled = True
Me.cmdSupprimer.Enabled = True
Me.cmdCommentaire.Enabled = True
Me.cmdImprimer.Enabled = True
Dim tMotif As DAO.Recordset
Dim req As String, strSqlAvoir As String
strSqlAvoir = "SELECT NumNote, NumMotif FROM Avoir"
Set tMotif = CurrentDb.OpenRecordset(strSqlAvoir)
Dim intcompteur As Integer
'Désactive toutes les sélections
For intcompteur = 0 To lstMotif.ListCount - 1
lstMotif.Selected(intcompteur) = False
Next
With tMotif
Do While Not .EOF
If .Fields("NumNote") = CLng(lstNotes) Then
' Boucle sur le nombre d'item de la liste 2
For intcompteur = 0 To lstMotif.ListCount - 1
If lstMotif.ItemData(intcompteur) = CStr(.Fields("NumMotif")) Then
lstMotif.Selected(intcompteur) = True
End If
Next
End If
.MoveNext
Loop
End With
' Traitement du code auteur sélectionné
With tMotif
Do While Not .EOF
' Test le champ CodeAuteur lu par rapport au code auteur sélectionné
If .Fields(0) = CInt(Me.lstNotes) Then
' Sélectionne la ligne
Me.lstMotif.Selected(.Fields(0) - 1) = True
End If
' passe à l'enregistrement suivant
.MoveNext
Loop
End With
Me.txtNumNote = lstNotes.Column(0)
Me.txtDate = lstNotes.Column(1)
Me.lstNumContrat = lstNotes.Column(2)
Me.txtDateCrea = lstNotes.Column(3)
Me.lstNumCli = lstNotes.Column(4)
Me.lstNomCli = lstNotes.Column(5)
Me.txtDateEffet = lstNotes.Column(6)
Me.lstNature = lstNotes.Column(7)
Me.lstNomVendeur = lstNotes.Column(8)
Me.lstAssu = lstNotes.Column(9)
Me.txtNumAgence = lstNotes.Column(10)
Me.lstAgence = lstNotes.Column(11)
Me.txtNumVendeur = lstNotes.Column(12)
End Sub |