show set number of records on report

V

Viral Varshney

I have a table with machines and the number of records change every month or
so. Currently it is, say, 30 and next month it could be 27. Under the
machine there is other information that needs to be displayed. I am trying
to create 3 report pages (since all machine info won't fit on one page) that
show the machine information. I would like to be able to pull the number of
records from the machine table and format the report pages so they all show
10 or 9 machines. Any suggestions????
 
F

fredg

I have a table with machines and the number of records change every month or
so. Currently it is, say, 30 and next month it could be 27. Under the
machine there is other information that needs to be displayed. I am trying
to create 3 report pages (since all machine info won't fit on one page) that
show the machine information. I would like to be able to pull the number of
records from the machine table and format the report pages so they all show
10 or 9 machines. Any suggestions????

Add an unbound control to the report.
Set it's control source to =1
Set it's Running Sum property to Over all.
Name this control "txtRecordNumber".

Add a page break control to the bottom of the report detail section.

Code the Report's Detail Format event:
Me.PageBreakName.Visible = Me.[txtRecordNumber] Mod 10 = 0
 
J

John Spencer

Since you want to print exactly three pages and have a varying number of
records, you need to calculate the number of records per page. So you can
modify Fred's suggestion a bit and

Add another control to your report header to get the count of records
Name: txtRecordCount
Source: = Count(*)

Me.PageBreakName.Visible = Me.[txtRecordNumber] Mod
(-Int(-Me.txtRecordCount/3)) = 0

With 28 records you should get 10 records on the first page, 10 records on the
second page, and 8 records on the third page.

#Recs - Records for page 1, 2, and 3
25 --> 9 9 7
26 --> 9 9 8
27 --> 9 9 9
28 --> 10 10 8
29 --> 10 10 9
30 --> 10 10 10


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
I have a table with machines and the number of records change every month or
so. Currently it is, say, 30 and next month it could be 27. Under the
machine there is other information that needs to be displayed. I am trying
to create 3 report pages (since all machine info won't fit on one page) that
show the machine information. I would like to be able to pull the number of
records from the machine table and format the report pages so they all show
10 or 9 machines. Any suggestions????

Add an unbound control to the report.
Set it's control source to =1
Set it's Running Sum property to Over all.
Name this control "txtRecordNumber".

Add a page break control to the bottom of the report detail section.

Code the Report's Detail Format event:
Me.PageBreakName.Visible = Me.[txtRecordNumber] Mod 10 = 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top