Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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.

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    [quote name='jaf90' post='783340' date='07-Jul-2009 09:44']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.[/quote]
    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 Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Great minds...

  5. #5
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    [quote name='HansV' post='783344' date='07-Jul-2009 09:50']Great minds... [/quote]
    Geez, we must have posted our responses almost simultaneously! Oh well, I guess it serves to re-enforce our approach!
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='MarkLiquorman' post='783343' date='07-Jul-2009 21:49']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.[/quote]
    Mark,
    That's awesome. Thanks for showing us the technique.
    Armstrong

Posting Permissions

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