Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Aug 2005
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    make the rest invisible (Access 2000)

    I have an option box from where i make visible the selected control.It works in this way :
    Private Sub SortReport()
    Select Case Me!grpSort
    Case 1
    Reports!Rpt1.Visible = True
    Case 2
    Reports!Rpt1.Visible = True
    End Select

    However i can use it only one time.Otherwise it does not work.if for example i click on the firrst option, i make visible the first option.But how to make invisible the option previously chosen? Because i may choose option 5 and then option 1.How could Access make invisible the unnecessary options?

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

    Re: make the rest invisible (Access 2000)

    I don't understand. Your Select Case statement makes the same report Rpt1 visible in both options. It doesn't show or hide a control.

  3. #3
    2 Star Lounger
    Join Date
    Aug 2005
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: make the rest invisible (Access 2000)

    Please do apologize me. the report is called rpt1 and the controls are Segment1,Segment2,segment3,Segment4, etc

    Select Case Me!grpSort
    Case 1
    Reports!rpt1!Segment11.Visible = True
    Case 2
    Reports!rpt1!Segment2.Visible = True
    End Select

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

    Re: make the rest invisible (Access 2000)

    Say that you have controls Segment1 to Segment8. You could hide them all, then make one of them visible:
    <code>
    Dim i As Integer
    For i = 1 To 8 ' change if you have a different number of controls
    Reports!rpt1.Controls("Segment" & i).Visible = False
    Next i
    Reports!rpt1.Controls("Segment" & Me!grpSort).Visible = True
    </code>
    or even shorter:
    <code>
    Dim i As Integer
    For i = 1 To 8 ' change if you have a different number of controls
    Reports!rpt1.Controls("Segment" & i).Visible = (Me!grpSort = i)
    Next i</code>

Posting Permissions

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