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
|
Private Sub Commande2_Click()
DoCmd.OpenForm "form1", acDesign
Dim Mescontrols() As String
Dim ctl As Control
Dim nom As String
Dim i As Integer, j As Integer
j = -1
'Etabli la liste des controles à supprimer
For Each ctl In Forms("Form1").Controls
If Mid(ctl.name, 1, 6) = "Tempo_" Then
j = j + 1
ReDim Preserve Mescontrols(j + 1)
Mescontrols(j) = ctl.name
End If
Next
'supprime les controles
For i = 0 To j
DeleteControl "Form1", Mescontrols(i)
Next i
'add the component to the Form
Set ctl = CreateControl("Form1", acComboBox, , , , 3.4583 * 567, 0.75 * 567, 3.2917 * 567, 0.1667 * 567)
ctl.name = "Tempo_C_SelecSource_" & "1"
ctl.Visible = True
Set ctl = CreateControl("Form1", acComboBox, , , , 3.4583 * 567, 3.4688 * 567, 3.2917 * 567, 0.1667 * 567)
ctl.name = "Tempo_C_SelecDest_" & "1"
ctl.Visible = True
Set ctl = CreateControl("Form1", acTextBox, , , , 0.5833 * 567, 0.9583 * 567, 8.7917 * 567, 2.0417 * 567)
ctl.name = "Tempo_Text_S_" & "1"
ctl.Visible = True
Set ctl = CreateControl("Form1", acTextBox, , , , 0.625 * 567, 3.7083 * 567, 8.7917 * 567, 2.0417 * 567)
ctl.name = "Tempo_Text_D_" & "1"
ctl.Visible = True
End Sub |
Partager