Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Posts
    27

    Unanswered: Creating controls via code

    Can anyone offer a suggestion for me to get started ?


    Dim intX As Integer, intY As Integer
    Dim ctlText As Control

    intX = 10
    intY = 10

    Set ctlText = CreateControl(Me, acTextBox, , "", "", intX, intY)

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Lookup CreateControl


    Example from the Acce$$ Help$
    PHP Code:

    Dim frm 
    As Form
        Dim ctlBezFeld 
    As ControlctlText As Control
        Dim intDatenX 
    As IntegerintDatenY As Integer
        Dim intBezFeldX 
    As IntegerintBezFeldY As Integer

        
    ' Das neue Formlar mit der Tabelle Bestellungen als 
        ' 
    Datenherkunft erstellen.
        
    Set frm CreateForm
        frm
    .RecordSource "Bestellungen"
        ' Die Positionswerte für die neuen Steuerelemente einstellen.
        intBezFeldX = 100
        intBezFeldY = 100
        intDatenX = 1000
        intDatenY = 100

    Ein ungebundenes Textfeld in Standardgröße im 
        
    ' Detailbereich erstellen.
        Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
        intDatenX, intDatenY)
        ' 
    Ein untergeordnetes Bezeichnungsfeld-Steuerelement 
        
    ' für das Textfeld erstellen.
        Set ctlBezFeld = CreateControl(frm.Name, acLabel, , ctlText.Name, _
        "NeueBezeichnung", intBezFeldX, intBezFeldY)
        ' 
    Die Anzeige des Formulars aktualisieren.
        
    DoCmd.Restore 

  3. #3
    Join Date
    Dec 2003
    Posts
    27
    Thank You hammbakka,
    but i am trying to create textbox on my form, not on a new one
    and i think my code is pretty much like that one, exsept as a form name i put 'me'. I shouldn't put 'me' ?

    Dim intX As Integer, intY As Integer
    Dim ctlText As Control

    intX = 10
    intY = 10

    Set ctlText = CreateControl(Me, acTextBox, , "", "", intX, intY)

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    To create a control on a Form it should be in the Desigen view, so I am not sure that you could create new control on your running one.

  5. #5
    Join Date
    Dec 2003
    Posts
    27
    that what i was asking. i know its possible in VB6, don't know if its possible in Access

  6. #6
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Why do you want to create a control? There may be another way to acomplish what you need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •