Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report Header Problem (2000)

    I have created a report with 3 groupings. The header just before the detail is groupheader2. The detail area has NO header (I tried to put the header info here, but it keeps repeating, even if I set the properties to HIDE DUPLICATES.)

    I have some code in detail ( on format) that hides all of the fields if there is no data in the "items" field. This works nicely. Size is set to 0, all fields can shrink, etc.

    PROBLEM: sometimes the groupheader2 prints for a detail with no records. This only happens at the top of a page. Most of the time the header does not print if there is no record under its detail, which is the desired behavior.

    Is there a way to reference controls or items between sections? Can I add some code that will hide or suppress the groupheader2 if there is no record in the detail?

    Here is the code in the ID Header (groupheader2)

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    Dim blnItemsPresent

    blnItemsPresent = Not IsNull (Items)

    [Quantity].Visible = blnItemsPresent
    [Price].Visible = blnItemsPresent
    [Notes].Visible = blnItemsPresent

    EndSub


    This part works fine. I'm looking for the code to make the header above this NOT PRINT. Maybe it's not possible? I was also playing with putting the header info in the DETAIL area, and setting this to HIDE DUPLICATES, but it leaves a bunch of space above each row of detail.

    THANK YOU ALL.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Report Header Problem (2000)

    First of all, you can't have a header for the detail. That section is where the lowest level of data occurs, and any labels you put in there will print for every record. The groupheaders occur for any groups you have set in Sorting and Grouping where you have turned on the header. The detail section is what comes after you've grouped and sorted.

    Without knowing what groupheader2 is for, it isn't really possible to figure out what's happening. What is the field or condition that defines that groupheader?
    <hr> I'm looking for the code to make the header above this NOT PRINT<hr>
    This is totally confusing. You showed code you said was for groupheader2 and said it was working OK, but that is also the groupheader you said had a problem. <img src=/S/confused.gif border=0 alt=confused width=15 height=20> Group headers print FIRST. You can't go to the detail section and say, "oh, by the way, if this is so, then don't print that group header you already printed." You can put code in the groupheader to cancel printing it if a condition is met.
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report Header Problem (2000)

    Yes, that code is not in the groupheader2 as I wrote, it's in the detail area, to suppress records that are not complete. Sorry for the confusion.

    I have found a solution, some code in the header (just above the detail area, in groupheader2), to suppress the header just above the detail, when the detail record's "items" field is null.

    Private Sub GroupHeader2_Format (Cancel As Integer, FormatCount AsInteger)
    If IsNull(Items) Then
    Me.PrintSection = False
    Me.MoveLayout = False
    End IF
    End Sub

    Apparently a header can refer to the first record in the section just below it, in this case the [items] field in the detail section.

Posting Permissions

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