Results 1 to 10 of 10
  1. #1
    badmem is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2016
    Posts
    24

    Printout does not match preview

    I have a report that uses a counter to print 20 rows or less per page. On Print preview the form shows 20 rows will be printed. When the report is printed only 19 rows are on each page. There is plenty of space to print the last row. I tried two different printers but get the same result. Any idea what is causing this?



    Thank you.

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Make your code print 21 and see if it prints out 20 on a page.

  3. #3
    badmem is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2016
    Posts
    24
    Thanks for your reply. If I change the code from 20 to 21 the screen shows rows 1 to 4 on the first page then rows 7 to 27 on page 2, 28 to 48 on page 3.
    The printout shows rows 1 to 3 on page 1, rows 4 to 24 on page 2, 25 to 45 on page 3.

    What is going on?

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Are you dealing with an actual Report or a Form you are trying to print?

  5. #5
    badmem is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2016
    Posts
    24
    Thanks for the reply. This is a report based on a query.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    What code are you using to limit it to 20 and where are you running the code? How are you using the counter?

  7. #7
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Saw this online:

    You have to create a textbox on the report "RowCounter" with control source of "=1"
    Running Sum of Over Group, then add this code:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If [RowCounter] Mod 20 = 0 Then
    Me.Detail.ForceNewPage = 2
    Else
    Me.Detail.ForceNewPage = 0
    End If
    End Sub

  8. #8
    badmem is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2016
    Posts
    24
    Quote Originally Posted by Bulzie View Post
    What code are you using to limit it to 20 and where are you running the code? How are you using the counter?
    This is the code I'm using on the form:

    Option Compare Database
    Option Explicit
    Dim vCounter As Integer
    Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
    vCounter = 1
    End Sub

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If vCounter = 20 Then
    Reports![YEARLY DOSE REPORT 2016 NEW].Section(acDetail).ForceNewPage = 1
    vCounter = 0
    Else
    Reports![YEARLY DOSE REPORT 2016 NEW].Section(acDetail).ForceNewPage = 0
    End If
    vCounter = vCounter + 1
    End Sub

  9. #9
    badmem is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2016
    Posts
    24
    Quote Originally Posted by Bulzie View Post
    Saw this online:

    You have to create a textbox on the report "RowCounter" with control source of "=1"
    Running Sum of Over Group, then add this code:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If [RowCounter] Mod 20 = 0 Then
    Me.Detail.ForceNewPage = 2
    Else
    Me.Detail.ForceNewPage = 0
    End If
    End Sub
    I edited my code to use a text box as you posted.

    It seems to be working correctly now.

    Thanks a lot.

    I have a lot to learn.

  10. #10
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    Quote Originally Posted by Bulzie View Post
    Saw this online:

    You have to create a textbox on the report "RowCounter" with control source of "=1"
    Running Sum of Over Group, then add this code:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If [RowCounter] Mod 20 = 0 Then
    Me.Detail.ForceNewPage = 2
    Else
    Me.Detail.ForceNewPage = 0
    End If
    End Sub
    That mod 20 though... very cool. I keep forgetting about the mod math function. Useful.

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

Similar Threads

  1. DoCMD Printout
    By trident in forum Programming
    Replies: 2
    Last Post: 11-16-2016, 08:33 AM
  2. Replies: 8
    Last Post: 08-25-2014, 04:30 PM
  3. Replies: 1
    Last Post: 09-21-2013, 10:06 PM
  4. PrintOut Macro Action
    By EHittner in forum Access
    Replies: 1
    Last Post: 09-22-2011, 01:27 AM
  5. PrintOut action
    By svcghost in forum Programming
    Replies: 11
    Last Post: 10-05-2010, 05:13 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