Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Visible / Not Visible SubReport (A2K)

    Is it possible to make a Sub Report Not Visible based on the numeric content of a field on the Main Report.

    So, if [txtNeeded] > 0, subReport. Visible = False

    Thanks in advance for any help,

    Cheers
    Cheers,
    Andy

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Yes the subreport control has a visible property.
    Use the following to make it visible or not. Be sure to use the name of the subreport control. It can be different from the subreport.
    Me.SubreportControlName.Visisble = Me.[txtNeeded] <= 0
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Francois,

    Thanks kindly or merci bien, worked beautifully.

    Cheers,
    Cheers,
    Andy

  4. #4
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Francois,

    As I mentioned above, your solution worked perfectly based on:

    Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
    Me.subFuji.Visible = [txtNeeded] > 0
    End Sub

    Now just to add another layer of complexity to my life Iíd like to Ďnot printí the whole of the detail line that contains the [txtNeeded] field based on my code sample below.

    Iíve done the following which got rid of the specific field, txtProdNo. Being too lazy to repeat the same code for the other twelve fields, I thought there might be a way to hide the whole line in one swell foop.


    Private Sub GroupHeader1_Print(Cancel As Integer, PrintCount As Integer)
    Me.txtProdNo.Visible = [txtNeeded] > 0 and [S01] > 0
    End Sub

    Thanks in advance for looking at this and bearing with my laziness,

    Cheers,
    Cheers,
    Andy

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

    Re: Visible / Not Visible SubReport (A2K)

    Perhaps not suprisingly, the group footer also has a Visible property (as you'd have seen if you had taken a second to look)

    Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
    Me.GroupFooter0.Visible = [txtNeeded] > 0
    End Sub

    or you can cancel the footer:

    Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
    Cancel = [txtNeeded] <= 0
    End Sub

  6. #6
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Hans,

    Sorry for the delay in getting back to you. Also, my apologies if Iíve misconstrued something.
    Anyway here is the code that has come closest to what I want to do:


    Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
    Me.GroupHeader1.Visible = [txtNeeded] > 0 And [S01] > 0
    End Sub

    Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
    Me.subFuji.Visible = [txtNeeded] > 0 And [S01] > 0
    End Sub


    It however does not compress, if you wish, the detail line in the GroupHeader1 when there is no data, so that Iím left with obvious gaps where there is null data.

    Hopefully, there is a workaround without my having to apply too much egg to my face,

    Cheers,
    Cheers,
    Andy

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

    Re: Visible / Not Visible SubReport (A2K)

    If you want to hide a section if there are no data, you will have to check whether there are data or not. The current code checks whether some values are positive.

  8. #8
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Hans,

    There are data, but they do not meet the requirements, so I'm trying to hide them.

    Cheers,
    Cheers,
    Andy

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

    Re: Visible / Not Visible SubReport (A2K)

    I'm getting very confused by all these contradictory statements. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  10. #10
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Hans,

    It was easier than I thought.

    Open rpt 01 CN - FujiAssignments Ė 04

    The 2nd line down is the culprit.

    Hope this helps,

    Cheers,
    Attached Files Attached Files
    Cheers,
    Andy

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

    Re: Visible / Not Visible SubReport (A2K)

    1) You hadn't set the Can Shrink property of the subform control in the main report to Yes.
    2) The Detail_Format code in the subreport wasn't "connected" to the event - the corresponding box in the Event tab of the Properties window was empty. So the code wasn't executed.

    See attached version.
    Attached Files Attached Files

  12. #12
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Hans,

    Thanks for checking this out. The good news is that the "blank line" no longer shows, but the subline for CAN0800033 which was displayed in the original example, has gone missing. Unless something happened in the code coming back to me.

    Cheers,
    Cheers,
    Andy

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

    Re: Visible / Not Visible SubReport (A2K)

    Use the On Format event of the group footer instead of the On Print event to show/hide the subform.

  14. #14
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Visible / Not Visible SubReport (A2K)

    Hans,

    Sorry for the late reply, but I was forced to go to an Italian wine tasting this evening. Such pressure.
    But, as always, your final solution is bang on.

    I really appreciate your patience,

    Cheers,
    Cheers,
    Andy

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

    Re: Visible / Not Visible SubReport (A2K)

    > go to an Italian wine tasting

    Life is hard... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Page 1 of 2 12 LastLast

Posting Permissions

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