Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Report after every 5 records

Status
Not open for further replies.

jmc014

Technical User
Nov 24, 2007
80
ES
Hi,

I'm working on a "simple" report that forces a new page after every five records. Like many others, I'm using the following page break function:

I have added a text box in the detail section:
Name: txtRunCount
Control Source: =1

I have a page break control at the bottom of the detail section named pgbrk as well as "Me.pgbrk.Visible = Me.txtRunCount mod 5 = 0" In the On Format event.

This works perfect...

Problem 1:

I need to be able to add text below the Detail section just below my 5 records and not at the bottom of the page or at the end of my report.

I'm not too sure sure if the page break function is the best method for the limiting my five records per report page.

Problem 2:

How can I count the amount of records shown on each report? If if have 8 records, the first page should show 5 while the second page should show only 3.

I have to add that I have been through loads and loads of threads and while I have not found what I have been looking for, I have had great time reading all the questions, answers and suggestions. For sure a Top Noch A class technical site...

 
I'm not sure why you started a new thread based on the same question.

You can create a calculated column in your report's record source that groups by 5. This would use a subquery that ranks and uses integer division "\" rather than "/".

Or, you could probably add another report section immediately below the detail section and based on the primary key value of your report's record source. Then use code in the on Format event of the section like:
Code:
 Cancel = Me.txtRunCount mod 5 <> 0

Duane
Hook'D on Access
MS Access MVP
 
Thanks for your reply,

Sorry but I'm none the wiser.
:(
 
Hi there,

I did something a little different, a sloppy way around the problem but it works. I created 5 different subreports, each one bound to a query. A simple code on the OpenReport command shows the corresponding subreport each time the report opens.

I know its not a good way of doing things but I really needed to advance with what I was doing.

Thanks for your assistance.
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top