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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
Private Sub M_control(frm As Form, rstT_Tampon2 As DAO.Recordset)
Dim i, j As Long
Dim haut As Long
Dim ctr_affaire(1 To 100) As Control
Dim ctr_month(1 To 100) As Control
Dim ctr_year(1 To 100) As Control
Dim ctr_Scenario(1 To 100) As Control
Dim ctr_priority(1 To 100) As Control
Dim ctr_quantity(1 To 100) As Control
Dim ctr_valider As Control
Dim ctr_nb As Control
Dim ctr_nb2 As Control
Dim y, a, m As Long
Dim aff As String
Dim gauche, decallage As Long
i = 1
j = 1
haut = 1000
a = 0
y = 0
aff = ""
gauche = 1000
decallage = 0
rstT_Tampon2.MoveFirst
Do While Not rstT_Tampon2.EOF And (i < 100)
If i > 2 Then
If y <> Year(rstT_Tampon2.Fields(5).Value) Then
haut = haut + 300
End If
End If
If (i > 2) And (y = Year(rstT_Tampon2.Fields(5).Value)) And (aff = rstT_Tampon2.Fields(8).Value) And (m = Month(rstT_Tampon2.Fields(5).Value)) Then
ctr_quantity(i - 1).Caption = ctr_quantity(i - 1).Caption + 1
Else
'largeur, hauteur
Set ctr_affaire(i) = CreateControl(frm.Name, acLabel, , "", "", 500, 500, 1250, 250)
Set ctr_Scenario(i) = CreateControl(frm.Name, acLabel, , "", "", 500, 500, 600, 250)
Set ctr_quantity(i) = CreateControl(frm.Name, acLabel, , "", "", 500, 500, 150, 250)
Set ctr_month(i) = CreateControl(frm.Name, acTextBox, , "", "", 500, 500, 250, 250)
Set ctr_year(i) = CreateControl(frm.Name, acTextBox, , "", "", 500, 500, 500, 250)
Set ctr_priority(i) = CreateControl(frm.Name, acComboBox, , "", "", 500, 500, 1000, 250)
ctr_affaire(i).Name = "Affaire_" & i
ctr_month(i).Name = "Month_" & i
ctr_year(i).Name = "Year_" & i
ctr_priority(i).Name = "Priority_" & i
ctr_Scenario(i).Name = "Scenario_" & i
ctr_quantity(i).Name = "Quantity_" & i
ctr_affaire(i).Left = 100 + gauche + decallage
ctr_Scenario(i).Left = 1400 + gauche + decallage
ctr_quantity(i).Left = 2050 + gauche + decallage
ctr_month(i).Left = 2450 + gauche + decallage
ctr_year(i).Left = 2750 + gauche + decallage
ctr_priority(i).Left = 3300 + gauche + decallage
ctr_affaire(i).Top = haut + j * 300
ctr_Scenario(i).Top = haut + j * 300
ctr_quantity(i).Top = haut + j * 300
ctr_month(i).Top = haut + j * 300
ctr_year(i).Top = haut + j * 300
ctr_priority(i).Top = haut + j * 300
ctr_affaire(i).Caption = rstT_Tampon2.Fields(8).Value
ctr_Scenario(i).Caption = rstT_Tampon2.Fields(6).Value
ctr_quantity(i).Caption = "1"
ctr_month(i).DefaultValue = Month(rstT_Tampon2.Fields(5).Value)
ctr_year(i).DefaultValue = Year(rstT_Tampon2.Fields(5).Value)
ctr_priority(i).RowSourceType = "Liste valeurs"
ctr_priority(i).RowSource = Chr(34) & "Haute" & Chr(34) & ";" & Chr(34) & "Normale" & Chr(34) & ";" & Chr(34) & "Basse" & Chr(34)
ctr_priority(i).DefaultValue = Chr(34) & "Normale" & Chr(34)
j = j + 1
If i = 51 Then
j = 1
decallage = 5000
haut = 1000
End If
i = i + 1
End If
y = Year(rstT_Tampon2.Fields(5).Value)
aff = rstT_Tampon2.Fields(8).Value
m = Month(rstT_Tampon2.Fields(5).Value)
rstT_Tampon2.MoveNext
Loop
Set ctr_valider = CreateControl(frm.Name, acCommandButton, , "", "", 500, 500, 1000, 500)
ctr_valider.Left = gauche + 10000
ctr_valider.Top = haut / 2
ctr_valider.Name = "ctr_valider"
ctr_valider.Caption = "Valider"
ctr_valider.OnClick = "=Mise_a_jour_priorites()"
Set ctr_nb = CreateControl(frm.Name, acLabel, , "", "", 500, 500, 500, 250)
ctr_nb.Name = "ctr_nb"
ctr_nb.Caption = i
ctr_nb.Left = gauche
ctr_nb.Top = haut / 5 |
Partager