Results 1 to 6 of 6
  1. #1
    jrob38 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    4

    Constant Number of Lines in Multi-Page Report

    Hello all,
    I have searched far and wide for a solution to this problem but have yet to find one. So if it has been covered already, I apologize.

    I am trying to mimic a state form with a report. Each page of this form has a total of 10 lines. I want my report to print the records that would be on each line and if there are less than ten, print additional lines to fill the page and if there are more than ten, create a new page or pages with exactly ten lines on each.

    I have no problem with getting it to work when there are less than 10, using this example http://support.microsoft.com/kb/119073. However, when printing more than ten, it prints the exact number of records but no additional blank lines if the last page has less than 10 records on it. I realize that the example is not meant to accommodate this scenario, so I have tried various ways of tweaking the code.

    Rather than using:


    ElseIf TotCount > TotGrp And TotCount < 10 Then

    I've tried:
    ElseIf TotCount > TotGrp And (TotCount Mod 10) <> 0 Then

    And:
    ElseIf TotCount > TotGrp And (TotCount Mod 10) > 0 Then

    and different variations.

    However, these modifications do not change the result of how my report is printed. Again, if there are less than 10 lines, it will print additional lines to fill the page, but if there are more than 10, it will only print up to the last record. For example if, I have 12 records, it will print 10 on the first page and 2 on the next. That's it. In the case of this example, I want it to print the 10 on the first page then the 2 on the second page and print an additional 8 blank lines to fill the second page.

    Thanks in advance for any help with this.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I think this thread http://en.allexperts.com/q/Using-MS-...ows-report.htm suggests running a query to somehow add blank records to the report. It uses a constant for the number of rows to display (with or without data) and calculate how many blanks are needed. Your calc could possibly use the Mod expression from your example to determine how many blanks need to be appended. I don't really understand how the blanks rows are created but maybe this will give you enough of a clue to resolve. It is the closest I can find to your situation.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jrob38 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    4
    June7, thanks for the reply. I attempted the suggestion in the thread but was not able to get it to work. Like you, I'm not sure how it is supposed to work, but it has given me some other ideas to try. If I get it worked out I'll let you know.

  4. #4
    jrob38 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    4
    I think I may have figured out why it hasn't been working. I have my group header, where I have my TotGrp (counts the number of records), set to repeat on every page. So it's causing an issue if there are more than 10 records. If I tell it not to repeat it works, prints the correct number of lines using the Mod expression that I was trying before.

    I figured this out by using the original example from Microsoft's kb (in original post) and putting 20 on the ElseIf line rather than 10. I also created a text box control that shows what TotCount is for each line printed and when I had the header repeating, the TotCount would simply reset on each page, except for reports that had more than 10 records (TotCount doesn't seem to produce any value if records are more than 10). So, when I changed the number on the ElseIf line to anything more than 10, the reports that had less than 10 records would print an infinite number of pages, because TotCount would reset at each page, but it was trying to print 20 lines.

    So now I'm trying to work around that, because I need the header to be on each page.

    Sorry for the long explanation. I am excited that I'm making some progress, as I've been trying to work through this problem for quite a while now and I just thought I'd update on where I am.

  5. #5
    jrob38 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    4
    It seems to be working now. Here is what I did:

    Using the example from microsoft.com in the original post, I changed the ElseIf line to:

    ElseIf TotCount > TotGrp And TotCount Mod 10 <> 0 Then

    Because I needed my group header to repeat on each page, I created another group with a blank header that I put the TotGrp control inside of and set the header to not repeat. This is where I got my count.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Congratulations! Glad you worked it out. I probably couldn't have done more without examining the project directly.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 08-12-2011, 11:55 AM
  2. Replies: 4
    Last Post: 06-30-2011, 08:39 PM
  3. Replies: 1
    Last Post: 03-19-2010, 05:17 PM
  4. Replies: 1
    Last Post: 03-12-2009, 09:55 AM
  5. Multi Page Forms?
    By Simon Sweet in forum Forms
    Replies: 0
    Last Post: 03-05-2008, 04:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums