[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4620
  • Last Modified:

Limit Number of Records Per Page - Access Report

Hi,

I have a list of tutors,  each tutor has taught a number of hours.  Some teachers have 10 hours and some others have more than 50.  The Official form has a place for only 15 hours, "Date, Sign, remarks".

I designed (imitated) the form in Access,  it looks fine.

Now how can I limit each form to 15 records or less. If Dr. X has 10 hours,  they can fit in one form,  if Dr. M has 52 hours,  I want the hours to be printed on 4 forms. Also when the Teacher's name changes a new form should begin.

Thanks a lot
0
hhammash
Asked:
hhammash
  • 5
  • 3
  • 2
1 Solution
 
nico5038Commented:
The codeless solution would be to manipulate the header/footer and detail section so only 15 rows are printed.
For skipping per teacher select the teacherID (Name?) as a grouping when creating the report or by pressing the [= looking button. The indicate a Header is needed for the teacher and add the teacher field(s) to that section.
You can also indicate that the section needs to be repeated and that a pageskip is needed in the properties of the header section (click the header bar).

Nic;o)
0
 
harfangCommented:
Hello,

I think that Nico's advice is sound. If you have imitated a printed form, there should be room for exactly 15 rows, not more. If everything else is repeated on each page, you should be fine.

For reference, this is how to force a page break after 15 rows even if there is room for more. It uses a text box with control source: =1, and running sum: over group, called txtRowCount, which can be hidden:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If txtRowCount Mod 15 = 0 Then
        Detail.ForceNewPage = 2   ' after section
    Else
        Detail.ForceNewPage = 0   ' none
    End If
End Sub

Cheers!
(°v°)
0
 
hhammashAuthor Commented:
Thank you guys,

I'll try the suggestions.

Nico!
I used the header and footer to display the fixed parts of the form. The details section will have the data.  How to mainpulate the details section to print only 15 records without coding?

Thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
nico5038Commented:
Just make the height to fit 15 rows.
Optionally you can increase the header of footer by dragging the "bar" or the lowest border of the footer to limit the detailsection size.
Perhaps you can add a line to show the start and end of the detailsection to show the header and footer sections when "tuning" the report on paper.

Nic;o)
0
 
hhammashAuthor Commented:
Hi,

The details section will grow with the data,  if I have 50 records the details section will grow.  Can I make it fixed in design?
0
 
harfangCommented:
Hello,

Textboxes, some other controls, and sections have a .CanGrow property. If you choose No, their size is fixed. It is even possible to have growing textboxes on a non-growing section, at the risk of loosing some data if the text is too long. This is used for example on mailing labels.

Cheers!
(°v°)
0
 
hhammashAuthor Commented:
Hi harfang,

The CanGrow property in the details section is already No,  it is this way from the beginning.



0
 
hhammashAuthor Commented:
Hi harfang,

I tried your code,  the field with source =1 and running sum= over group is a great idea.  I did some adjustments to suite my application.

It is working perfectly.

Thanks a lot
0
 
harfangCommented:
I'm gald you it worked for you.
Good luck with your project!
(°v°)
0
 
hhammashAuthor Commented:
Thank you both
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now