• Report Header Problem (2000)

    Author
    Topic
    #367853

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #574856

      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? [indent]


      I’m looking for the code to make the header above this NOT PRINT


      [/indent]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. confused 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.

      • #574903

        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.

    Viewing 0 reply threads
    Reply To: Report Header Problem (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: