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
| Private Sub combOp_Change()
Dim con As New ADODB.Connection
Dim command As New ADODB.command
Dim rst As New ADODB.Recordset
Dim i As Integer
Dim ctl(1 To 100) As Controls
Me.IdBat = Me.combOp
DoCmd.OpenForm Me.Name, acDesign, , , , acHidden
Set con = CurrentProject.Connection
Set command.ActiveConnection = con
command.CommandType = adCmdText
command.CommandText = "SELECT Requête3.IdBat, Requête3.Operation, Personne.Nom, Personne.Prenom, Personne.Entite, " & _
"Personne.RaisonSociale, Personne.IdPersonne, Personne.IdLot, Personne.Présent " & _
"FROM Requête3 LEFT JOIN Personne ON Requête3.IdPersonne = Personne.IdPersonne WHERE Requête3.IdBat = " & Me.IdBat
Set rst = command.Execute
i = 1
Do While Not rst.EOF
Set ctl(i) = CreateControl(Me.Name, acLabel, , , , 1, 10.5)
Set ctl(i).Item(0) = rst(2) & " " & rst(3)
i = i + 1
rst.MoveNext
Loop
rst.Close
con.Close |
Partager