• Change from text box to combo box

    Author
    Topic
    #461023

    I’m assuming that this can only be done in design view, but here goes….

    I would like to change an input from a text box to a combo box dependant on what is entered into another control box. I would also need to be able to change it back again later in the routine.

    I can see that there is vba code available to change the control type eg.

    inputbox.ControlType = acComboBox

    and that there are a number of other control values that can be changed, but I can’t do this when a form is open for input.

    Any thoughts / suggestions?

    John

    Viewing 1 reply thread
    Author
    Replies
    • #1167906

      You are correct that this can only be done in design view.

      As a workaround, place a text box and combo box on top of each other.
      Use code to show one and hide the other, depending on the conditions.

    • #1167907

      I would like to change an input from a text box to a combo box dependant on what is entered into another control box. I would also need to be able to change it back again later in the routine.

      The simplest way is to have 2 controls, one laying on top of the other, with one visible and the other not. Then just toggle the Visible property of each control as needed.

      • #1167908

        Great minds…

        • #1167911

          I can always rely on the “great minds” on here.

          I presumed that would be the only course of action – I know that doesn’t get me in the “great minds” category, but I’ll keep working at it!

          John

        • #1167933

          Great minds…

          Geez, we must have posted our responses almost simultaneously! Oh well, I guess it serves to re-enforce our approach!

      • #1167987

        The simplest way is to have 2 controls, one laying on top of the other, with one visible and the other not. Then just toggle the Visible property of each control as needed.

        Mark,
        That’s awesome. Thanks for showing us the technique.
        Armstrong

    Viewing 1 reply thread
    Reply To: Change from text box to combo box

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: