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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
Dim db As DAO.Database
Set db = DBEngine.OpenDatabase("C:\Documents and Settings\Pierre Wandel\Bureau\Stage pompier\LPFF.mdb")
Dim rst As DAO.Recordset
Dim SQL As String
SQL = "SELECT * From Groupe Where Date_MEP = '" & Date_generique.Value & "';"
Set rst = db.OpenRecordset(SQL, dbOpenForwardOnly, dbReadOnly)
rst.MoveFirst
Dim nbGroupe As Integer
nbGroupe = 0
While Not rst.EOF
nbGroupe = nbGroupe + 1
If nbGroupe = 1 Then
Dim ID_resultat As Variant
ID_resultat = DLookup("Groupe.[ID]", "Groupe", "[ID] = " & Forms!Groupe_Actuel!ID)
'MsgBox ID_resultat
Dim Nummat_resultat As Variant
Nummat_resultat = DLookup("Commande.[Num_matricule]", "Commande", "Commande.[ID]=" & Forms!Groupe_Actuel!ID)
'MsgBox Nummat_resultat
Dim Nom_resultat As Variant
Nom_resultat = DLookup("Chefs.[Nom_chef]", "Chefs", "Chefs.[Num_matricule]= " & Nummat_resultat)
'MsgBox Nom_resultat
Dim id_lieu_strat_resultat As Variant
id_lieu_strat_resultat = DLookup("Esta.[id_LS]", "EstA", "Esta.[ID]=" & Forms!Groupe_Actuel!ID)
'MsgBox id_lieu_strat_resultat
Dim lieu_strat_resultat As Variant
lieu_strat_resultat = DLookup("Lieux_strat.[Nom_lieux_Strat]", "Lieux_strat", "Lieux_strat.[id_LS]= " & id_lieu_strat_resultat)
'MsgBox lieu_strat_resultat
Nom_chef.Value = Nom_resultat
Nom_Lieux_Strat.Value = lieu_strat_resultat
Vehicule_tete.Value = resultat_vehicule & " " & resultat_vehicule2 & " " & resultat_vehicule3
Dim SQL2 As String
SQL2 = "SELECT EstDansGroupe.[Type], EstDansGroupe.[NSI] From EstDansGroupe Where EstDansGroupe.[ID] =" & Forms!Groupe_Actuel!ID
Set rst = db.OpenRecordset(SQL2, dbOpenForwardOnly, dbReadOnly)
Dim nbCCF As Integer
Dim Trig As Variant
nbCCF = 0
'.MoveFirst
While Not rst.EOF
' code
Trig = DLookup("Appartient.[Trigramme]", "Appartient", "Appartient.[Type]='" & Trim(rst(0)) & "' AND Appartient.[NSI]=" & rst(1))
If Trim(rst(0)) = "VLTT" Then
Vehicule_tete.Value = rst(0) & " " & rst(1) & " " & Trig
Else
nbCCF = nbCCF + 1
If nbCCF = 1 Then
Vehicule_1.Value = rst(0) & " " & rst(1) & " " & Trig
End If
If nbCCF = 2 Then
Vehicule_2.Value = rst(0) & " " & rst(1) & " " & Trig
End If
If nbCCF = 3 Then
Vehicule_3.Value = rst(0) & " " & rst(1) & " " & Trig
End If
If nbCCF = 4 Then
Vehicule_4.Value = rst(0) & " " & rst(1) & " " & Trig
End If
End If
Wend
End If
Wend
rst.Close
db.Close |
Partager