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
| Sub clt_form()
Dim frm As Form
dim ctrl as controls
Dim frmName As String
Dim labelProperties As Label
Dim txtBox As TextBox
Dim Opt_button As optionbutton
Set frm = CreateForm
frm.PopUp = True
frm.Caption = "Client Input"
frmName = frm.Name
'standard size for label and textbox
Dim label_size_1 As Integer
Dim label_size_2 As Integer
Dim textbox_size_1 As Integer
Dim standard_space_leftAlign As Integer
Dim standard_space_topAlign As Integer
Dim align_left As Integer
Dim align_top As Integer
Dim default_height As Integer
align_left = 1000
label_size_1 = 3000
label_size_2 = 5000
label_size_3 = 1000 ' option button
textbox_size_1 = 5000 'text
textbox_size_2 = 1000 'numéros
standard_space_leftAlign = 500
default_height = 300
align_top = 2000
standard_space_topAlign = 500
Dim ctrl As Control
' les entrées sont toujour groupées par 3, label nom du champ, l'input (inputbox, radio button ... Et erreur sur le champ en label)
'Nom du formulaire
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left, 1000, 10000, 300)
labelProperties.Caption = "Formulaire - Enregistrement d'un nouvel employé"
labelProperties.FontBold = True
labelProperties.ForeColor = RGB(86, 118, 157)
' nom
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left, align_top, label_size_1, default_height)
labelProperties.Caption = "Nom :"
Set txtBox = CreateControl(frm.Name, acTextBox, , , , align_left + label_size_1 + standard_space_leftAlign, align_top, textbox_size_1, default_height)
txtBox.Name = "clt_nom"
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left + label_size_1 + standard_space_leftAlign + textbox_size_1 + standard_space_leftAlign, align_top, label_size_2, default_height)
labelProperties.Caption = ""
labelProperties.Name = "clt_label_nom"
labelProperties.ForeColor = RGB(237, 28, 36)
labelProperties.Visible = False
'on ajoute l'espacement pour la ligne suivante
align_top = align_top + standard_space_topAlign
'prénom
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left, align_top, label_size_1, default_height)
labelProperties.Caption = "Prénom :"
Set txtBox = CreateControl(frm.Name, acTextBox, , , , align_left + label_size_1 + standard_space_leftAlign, align_top, textbox_size_1, default_height)
txtBox.Name = "clt_prenom"
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left + label_size_1 + standard_space_leftAlign + textbox_size_1 + standard_space_leftAlign, align_top, label_size_2, default_height)
labelProperties.Caption = ""
labelProperties.Name = "clt_label_prenom"
labelProperties.ForeColor = RGB(237, 28, 36)
labelProperties.Visible = False
'on ajoute l'espacement pour la ligne suivante
align_top = align_top + standard_space_topAlign
' Option button adresse propre ou domicilié chez quelqu'un
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left, align_top, label_size_1, default_height)
labelProperties.Caption = "Domicilié chez quelqu'un ?"
Set controls = CreateControl(frm.Name, acOptionButton, , , , align_left + label_size_1 + standard_space_leftAlign, align_top, label_size_3, default_height)
controls.groupname = "OB_1"
controls.Name = "clt_domicilie_y"
Set controls = CreateControl(frm.Name, acOptionButton, , , , align_left + label_size_1 + label_size_3 + standard_space_leftAlign, align_top, label_size_3, default_height)
controls.groupname = "OB_1"
controls.Name = "clt_domicilie_y"
Set labelProperties = CreateControl(frm.Name, acLabel, , , , align_left + label_size_1 + standard_space_leftAlign + textbox_size_1 + standard_space_leftAlign, align_top, label_size_2, default_height)
labelProperties.Caption = ""
labelProperties.Name = "clt_label_domcilie"
labelProperties.ForeColor = RGB(237, 28, 36)
labelProperties.Visible = False
'on ajoute l'espacement pour la ligne suivante
align_top = align_top + standard_space_topAlign
DoCmd.RunCommand acCmdFormView
End Sub |
Partager