Results 1 to 11 of 11
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Hiding duplicate text (2000 (Win2000))

    My report is a catalog of courses, grouped according to their "criterion." Each criterion has a description--just a sentence or two, no more than four lines. For now, the report prints out on eight pages (four sheets of paper, printed both sides). It looks good, but I'd like to refine it a bit. I have two situations I'd like to change:

    1. Two of my criteria have a rather long list of courses, and they need more than one page to display them. When the criterion continues on the next page, the criterion number repeats (that's good), but so does the description. Repeating the description is not necessarily bad, but it's unnecessary and it requires more space. Is there a way to keep this "description" from repeating?

    2. I have no forced page breaks. One particularly long list (under Criterion 6) starts on page 3, fills page 4, and uses almost half of page 5. Thus, the four-line description for Criterion 6 appears three times! Of course, I could fix this problem in part by forcing each criterion to start on a new page. The problem with that easy solution is that my report will expand from eight pages to 11 (and from four sheets of paper to six). Furthermore, the really short lists (Criterion 8 has just four courses) will also get a separate and mostly empty page all to themselves. We used to maintain the information in this report in MS-Excel (and before that in MS-Word), both of which allow one to insert manual page breaks. I certainly don't want to go back to using Excel or Word, but is there a way to insert a "manual" page break in my Access report?

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

    Re: Hiding duplicate text (2000 (Win2000))

    Lucas,

    (1) Here is something to try. Since I don't know your report exactly, I don't know if it'll work for you.
    Put two invisible text boxes in the group header for Criterion. (You might leave them visible during development to see how they work)
    Name the first txtCount, set its ControlSource to =1 and itsRunningSum to Over All (or Over Groups, it doesn't really matter here).
    Name the second txtPrevCount, leave its ControlSource empty.
    Add the following code to the event procedure for the OnFormat event of the group header (create the event procedure if it doesn't exist yet); replace txtDescription by the name of the text box bound to the description field:

    If (txtPrevCount = txtCount) Then
    txtDescription.Visible = False
    Else
    txtDescription.Visible = True
    End If

    And add the following code to the event procedure for the OnFormat event of the page footer (create the event procedure if it doesn't exist yet):

    txtPrevCount = txtCount

    Explanation: say, you are in the first criterion; txtCount is 1. At the end of the first page, txtPrevCount is set to 1 too. If the first criterion continues on page 2, txtPrevCount and txtCount are both equal to 1, so txtDescription.Visible is set to False. If the next criterion starts on page 2, txtCount is 2, but txtPrevCount is still 1. so txtDescription.Visible is set to True.

    (2) Access doesn't really have manual page breaks, but it does have a page break control. You can place an invisible page break control on the report, and write code to make it visible (and thereby causing a physical page break) when you need it. The Report Samples database from Microsoft has an example of this.

    HTH,
    Hans

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Hiding duplicate text (2000 (Win2000))

    Thanks again, Hans! I'll try your suggestion--it looks like it ought to work!

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Hiding duplicate text (2000 (Win2000))

    If your description is a separate control, then just set the property "Hide Duplicates" (of the description control) to yes.
    HTH
    Pat

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

    Re: Hiding duplicate text (2000 (Win2000))

    Pat,

    Using Hide Duplicates = Yes was my first thought too. It would have been an easy solution, if it had worked... But Hide Duplicates hides a control in the detail section if the value is equal to that in the previous record. It doesn't hide a control in a group header if this is repeated at the top of a page.

    Regards,
    Hans

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Hiding duplicate text (2000 (Win2000))

    Hi Hans,
    Thanks for pointing that out, the fact it was a group header control.

    I must be getting senile, heaven knows I'm old enough. Older than Wendell I think (no offence Wendell).
    Pat

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Hiding duplicate text (2000 (Win2000))

    Hello, Hans! I'm trying your suggestion, and I think my lack of experience building code is causing me grief. I think I followed your directions to the letter, but I'm getting an error message: "...Access can't find the macro 'txtPrevCount = txtCount.' The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved. Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's macro group was last saved under." Huh...? <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

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

    Re: Hiding duplicate text (2000 (Win2000))

    Lucas,

    Without seeing your database, I can't telll you what causes this error message. I have attached a zipped Access 97 database with an example report (based on the Report Samples database from Microsoft). You'll have to unzip and convert it. Please look at the code behind the report, and at the two text boxes in one of the group headers. See if you can find out where it's different from your report.

    HTH,
    Hans
    Attached Files Attached Files

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Hiding duplicate text (2000 (Win2000))

    Thanks, Hans. I haven't opened the zipped file yet, but here's a related question. I went to Microsoft's web site and searched for the "Report Samples database" with no luck. Can you tell me where to find it?

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

    Re: Hiding duplicate text (2000 (Win2000))


  11. #11
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Hiding duplicate text (2000 (Win2000))

    Thanks a lot, Hans! I looked and looked for that item, but couldn't find it.

    Your advice on how to keep my criterion descriptions from repeating on subsequent pages worked like a champ! I'm still not sure I understand how it works, but it does work! I'm impressed! <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

Posting Permissions

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