Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Nov 2002
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    hide sub-reports based on checkbox (2003)

    Hi All,

    I have a report with 4 sub-reports in the detail section. I would like to show or hide them based on checkbox selections which are on the form used to generate the report (this is an unbound form). I can't seem to make it work... How do I pass the checkbox(s) value(s) on to the report?

    Thanks,
    Van

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

    Re: hide sub-reports based on checkbox (2003)

    You can use code in the On Open event of the report:

    Private Sub Report_Open(Cancel As Integer)
    Me.SubReport1.Visible = Forms!frmSomething!CheckBox1
    Me.SubReport2.Visible = Forms!frmSomething!CheckBox2
    Me.SubReport3.Visible = Forms!frmSomething!CheckBox3
    Me.SubReport4.Visible = Forms!frmSomething!CheckBox4
    End Sub

    where:
    SubReport1, SubReport2 etc. are the names of the subreports as controls on the main report.
    frmSomething is the name of the form used to generate the report.
    CheckBox1, CheckBox2 etc. are the names of the check boxes on the form.

  3. #3
    Star Lounger
    Join Date
    Nov 2002
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: hide sub-reports based on checkbox (2003)

    thanks Hans. I used similar code in the OnFormat event of the report. Thanks again, Van

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

    Re: hide sub-reports based on checkbox (2003)

    I assume that you meant the On Format event of the Detail section of the main report. That should work well.

Posting Permissions

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