Results 1 to 4 of 4
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672

    Programmatically Add TextBox And Label To User Form

    I have a combobox on a user form that holds a number value from 1 - 10. On the selected index changed of the combo-box I need to add a label and a text box directly under the text box and combo box above. So for example, if the number 2 was selected 2 rows with a label and a text box should be added.



    How can this be achieved in Access 2013 (or if it's easier 2016 as I have that handy too) with VBA?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Add the items needed In Design mode,
    make them invisible.
    when you need them,turn them on,
    txtBox.visible=true

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Read the desired count from the combo-box and unhide that many text boxes?

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    Something like this.
    Code:
    Select Case combobox
        case 1
            txtbox1.visible = true
        case 2
            txtbox1.visible = true
            txtbox2.visible = true
        case 3
            txtbox1.visible = true
            txtbox2.visible = true
            txtbox3.visible = true
        ..... and so on       
    End Select

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-22-2015, 12:33 PM
  2. Replies: 2
    Last Post: 12-09-2014, 09:24 AM
  3. Replies: 4
    Last Post: 09-16-2014, 03:32 PM
  4. Replies: 10
    Last Post: 03-06-2012, 11:48 AM
  5. Textbox/label Visible
    By prawln in forum Programming
    Replies: 6
    Last Post: 05-20-2011, 01:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums