How to cancel print of a detail line if number lines exceeeded?

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

I have a case where after 20 detail lines have been printed for a particular
"group" (the group happens to be salesperson), I would like the detail
printing to stop for that group and to simply begin printing the next
group.
I tried coding into the detail line "Print" event, and saw an integer
'Cancel' is being passed in. I thought that by checking my public
intDetailPrint counter (initialized on print of each group) for >20 and if
so setting cancel = 0 or 1 would work but alas it does not...

What is the easiest way to suspending the print of detail lines after 20
have already been printed for a particular group? I want the report to
continue with the next group - -not stop the print altogether...


Thanks,

Brad
 
Add a text box to your detail section:
Name: txtCountDetails
Control Source: =1
Running Sum: Over Group
Add code to the On Format event of the detail section:
Cancel = Me.txtCountDetails >20
 
Thanks for that...

I did find something that seems to work... In the detail section "on print"
event I checked my public counter for = 20 (as it appears the 20th line
actually prints bu the time it is here) and then if it is at 20 I issue
"detail.visible = false" and that also did the trick!!

Brad
 
Back
Top