Programatically convert a textbox to combobox and back

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • salzan
    New Member
    • Feb 2008
    • 38

    Programatically convert a textbox to combobox and back

    is there anyway to programatically in VBA code convert a textbox to a combobox (set it's control source) and then later convert it back to a text box?

    Much appreciated.
    Salzan
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by salzan
    is there anyway to programatically in VBA code convert a textbox to a combobox (set it's control source) and then later convert it back to a text box?

    Much appreciated.
    Salzan
    I'm pretty sure the appropriate Commands to do the conversion would be:
    [CODE=vb]Application.Run Command acCmdChangeToCo mboBox
    Application.Run Command acCmdChangeToTe xtBox[/CODE]
    The problem as far as I understand it would be that the Form containing the Control must be in Design View, and you would need some Method that would shift focus to the Control before the Commands are applied. Just for curiosity, why would you want to do this? Wouldn't it be simpler to overlay the Controls, then manipulate them in this manner?

    Comment

    • salzan
      New Member
      • Feb 2008
      • 38

      #3
      Thank you very much. WHile I was waiting for a reply I got the idea to create two controls and overlay them and then make one or the other visible depending on which one I want to show. So in effect I took your advise. Thanks.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by salzan
        Thank you very much. WHile I was waiting for a reply I got the idea to create two controls and overlay them and then make one or the other visible depending on which one I want to show. So in effect I took your advise. Thanks.
        You are quite welcome, I really don't think that you would want to use the prior approach.

        Comment

        Working...