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
| Function GestionGroupe()
Dim mabase As DAO.Database
Dim rec As DAO.Recordset
Dim Check As CheckBox
Dim Listgr As ComboBox
Dim Bouton As CommandButton
Dim LabelBox As Label
Dim Ctrl As Access.Control
Dim x, y, l, w As Integer
Dim Alignement As Boolean
Set mabase = CurrentDb
Set rec = mabase.OpenRecordset("Formulaires", dbOpenTable, dbReadOnly)
DoCmd.OpenForm "Gestion Accès", acDesign
x = 570
y = 1700
l = 3000
w = 500
' Phase de suppression des contrôles
For Alpha = Forms![Gestion Accès].Controls.Count - 1 To 0 Step -1
DeleteControl "Gestion Accès", Forms![Gestion Accès].Controls(Alpha).Name
Next
' Fermeture et ouverture des formulaires concernés
DoCmd.RunCommand acCmdPaste
' Création des contrôles nécessaires par défaut
Set LabelBox = CreateControl("Gestion Accès", acLabel, , , "Liste des groupes", x, 1250, l, 250)
LabelBox.Name = "Liste"
LabelBox.ForeColor = vbBlack
LabelBox.BackColor = vbWhite
LabelBox.BorderStyle = 1
LabelBox.BorderColor = vbBlack
Set Listgr = CreateControl("Gestion Accès", acComboBox, , , , 3000, 1250, l, 250)
Listgr.Name = "ListeGroupe"
Listgr.ForeColor = vbBlack
Listgr.RowSourceType = "Value List"
Listgr.AfterUpdate = "[Procédure événementielle]"
Set Bouton = CreateControl("Gestion Accès", acCommandButton, , , , 7500, 300, 1500, 500)
Bouton.Name = "Save"
Bouton.Caption = "Sauvegarder"
Bouton.OnClick = "[Procédure événementielle]"
Set Bouton = CreateControl("Gestion Accès", acCommandButton, , , , 7500, 1000, 1500, 500)
Bouton.Name = "Fermer"
Bouton.Caption = "Fermer"
Bouton.OnClick = "[Procédure événementielle]"
rec.MoveFirst
' Création des contrôles liés à la table Formulaires
Alignement = False
While rec.EOF = False
If Alignement = False Then
y = y + 600
x = 500
Alignement = True
Else
x = 6000
Alignement = False
End If
Set LabelBox = CreateControl("Gestion Accès", acLabel, , , rec.Fields("NomFormulaire").Value, x + 200, y, l, w)
LabelBox.Name = rec.Fields("NomFormulaire").Value & 0
LabelBox.BackColor = vbWhite
LabelBox.BorderStyle = 0
LabelBox.BorderColor = vbBlack
LabelBox.ForeColor = vbBlack
Set Check = CreateControl("Gestion Accès", acCheckBox, , , , x - 75, y + 75, 200, 200)
Check.Name = rec.Fields("NomFormulaire").Value & 1
rec.MoveNext
Wend
DoCmd.Close acForm, "Gestion Accès", acSaveYes
DoCmd.OpenForm "Gestion Accès"
Set txtbox = Nothing
Set Check = Nothing
Set Label = Nothing
rec.Close
End Function |
Partager