Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How can i make visible and invisible all the text boxes and labels in the detail section of the form ? But not in the form header?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could use code like this. It will toggle the visibility of text boxes and labels in the Detail section: the first time it is run, the controls will be hidden, the second time they will be made visible again, etc.

    In this example, it is the On Click code of a toggle button tglHide in the form header (or footer), but you can use the code in other ways of course.

    Code:
    Private Sub tglHide_Click()
      Dim ctl As Control
      For Each ctl In Me.Detail.Controls
    	Select Case ctl.ControlType
    	  Case acLabel, acTextBox
    		ctl.Visible = Not ctl.Visible
    	End Select
      Next ctl
      Set ctl = Nothing
    End Sub

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='799315' date='22-Oct-2009 08:47']You could use code like this. It will toggle the visibility of text boxes and labels in the Detail section: the first time it is run, the controls will be hidden, the second time they will be made visible again, etc.

    In this example, it is the On Click code of a toggle button tglHide in the form header (or footer), but you can use the code in other ways of course.

    Code:
    Private Sub tglHide_Click()
      Dim ctl As Control
      For Each ctl In Me.Detail.Controls
    	Select Case ctl.ControlType
    	  Case acLabel, acTextBox
    		ctl.Visible = Not ctl.Visible
    	End Select
      Next ctl
      Set ctl = Nothing
    End Sub
    [/quote]


    Thank you! it is excellent !

Posting Permissions

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