Hide column through VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syntaktik
    New Member
    • Dec 2009
    • 6

    Hide column through VBA

    How do I hide columns in a split form through VBA? I tried this:
    Code:
    Me.Controls("field").ColumnHidden = True
    but i have to close the form and open it again to see the change. Nor does adding this help.
    Code:
    Me.Requery
    Me.Refresh
    Me.Repaint
    Any ideas?
    Thank you in advance.
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    The code you are looking for is ...

    Code:
    Me.Controls("field").Visible = False

    Comment

    • syntaktik
      New Member
      • Dec 2009
      • 6

      #3
      Not working for me. But i do know if i close the form, and then open it again, it wont show up, yet none of the refresh commands work.
      What I am trying to do is have a split form with an option group on top. There I can select what group of columns I want to see(or all of them). Is there maybe a better way to do that?

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Sorry about the double posting. We are having some technical problems at the moment that we are attempting to sort.

        Setting the visible property of a field to false will hide the field. Setting it to true will show it. You need to post the code you are using to trigger when this action is taking place. What event are you using and what conditions are you putting in to make the textbox visible and invisible?

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32656

          #5
          I think you need to be a little clearer trying to explain what happens. I can't follow exactly what you experience from your explanation. It makes it hard to know what to suggest.

          Comment

          • Allen Porter

            #6
            You have to reverse the code on open.

            Me.Controls("fi eld").ColumnHid den = False

            Comment

            Working...