Si, en VBA, j'arrive à utiliser CreateControl, je n'arrive pas à maîtriser
le nom du contrôle ou toute autre information l'identifiant pour mettre à
jour ses propriétés comme le nom, le masque, etc
Ci-dessous, le code utilisé actuellement, copie légèrement améliorée de
l'aide MS.
Meilleures salutations,
Blaise
-----------------------------------------------------------
Dim ctlLabel As Control, ctlText As Control
Dim intDataX As Integer, intDataY As Integer
Dim intLabelX As Integer, intLabelY As Integer
On Error Resume Next
DoCmd.DeleteObject acForm, "Frm_Ouvrage"
On Error GoTo 0
[Comment nommer un nouveau contrôle pendant sa création ?]
Bonsoir,
Je suis à moitié réveillé, mais je me lance quand même ...
Blaise Cacramp a écrit, le 30/01/2008 21:41 :
DoCmd.OpenForm "Frm_Ouvrage", acDesign
' Set positioning values for new controls. intLabelX = 100 intLabelY = 100 intDataX = 1000 intDataY = 100 ' Create unbound default-size text box in detail section. Set ctlText = CreateControl("Frm_Ouvrage", acTextBox, , "", "", _ intDataX, intDataY)
Que se passe-t-il si tu mets ici ctlText.Name = "txtNomMagique" ?
' Create child label control for text box. Set ctlLabel = CreateControl("Frm_Ouvrage", acLabel, , _ ctlText.Name, "NewLabel", intLabelX, intLabelY) ' Restore form. DoCmd.Restore DoCmd.Save acForm, "Frm_Ouvrage" DoCmd.OpenForm "Frm_Ouvrage", acNormal
Blaise Cacramp
Pour une fois, c'est simple !
merci beaucoup "Gloops" a écrit dans le message de news:OB$ [Comment nommer un nouveau contrôle pendant sa création ?]
Bonsoir,
Je suis à moitié réveillé, mais je me lance quand même ...
Blaise Cacramp a écrit, le 30/01/2008 21:41 :
DoCmd.OpenForm "Frm_Ouvrage", acDesign
' Set positioning values for new controls. intLabelX = 100 intLabelY = 100 intDataX = 1000 intDataY = 100 ' Create unbound default-size text box in detail section. Set ctlText = CreateControl("Frm_Ouvrage", acTextBox, , "", "", _ intDataX, intDataY)
Que se passe-t-il si tu mets ici ctlText.Name = "txtNomMagique" ?
' Create child label control for text box. Set ctlLabel = CreateControl("Frm_Ouvrage", acLabel, , _ ctlText.Name, "NewLabel", intLabelX, intLabelY) ' Restore form. DoCmd.Restore DoCmd.Save acForm, "Frm_Ouvrage" DoCmd.OpenForm "Frm_Ouvrage", acNormal
Pour une fois, c'est simple !
merci beaucoup
"Gloops" <gloops@niark.invalid> a écrit dans le message de
news:OB$pvQ4YIHA.4828@TK2MSFTNGP05.phx.gbl...
[Comment nommer un nouveau contrôle pendant sa création ?]
Bonsoir,
Je suis à moitié réveillé, mais je me lance quand même ...
Blaise Cacramp a écrit, le 30/01/2008 21:41 :
DoCmd.OpenForm "Frm_Ouvrage", acDesign
' Set positioning values for new controls.
intLabelX = 100
intLabelY = 100
intDataX = 1000
intDataY = 100
' Create unbound default-size text box in detail section.
Set ctlText = CreateControl("Frm_Ouvrage", acTextBox, , "", "", _
intDataX, intDataY)
Que se passe-t-il si tu mets ici ctlText.Name = "txtNomMagique" ?
' Create child label control for text box.
Set ctlLabel = CreateControl("Frm_Ouvrage", acLabel, , _
ctlText.Name, "NewLabel", intLabelX, intLabelY)
' Restore form.
DoCmd.Restore
DoCmd.Save acForm, "Frm_Ouvrage"
DoCmd.OpenForm "Frm_Ouvrage", acNormal