Results 1 to 7 of 7
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Code okay with preview but not when printed

    I have a 2-column report with space on 8-1/2" X 11" landscape layout for 4 detail sections in each of the 2 columns. (Half-page layout) OpenArgs specifies how many detail sections are to be printed on the 1st half-page of the report. The code essentially keeps count of the sections printed on the 1st half-page and then skips any sections that are to remain blank. The report preview is as desired, but the printed page IS NOT skipping those same sections. Any ideas why that happens?

    Thanks,


    Bill

    Code:
    Option Compare Database
    Option Explicit
    Dim PageOneRemaining As Integer       ' How many sections remain to be skipped on 1st Half-Page
    Dim PageOneCount As Integer           ' The number of sections to print on the 1st Half-Page.
    
    Private Sub Report_Open(Cancel As Integer)
    
    Me.Filter = "ClassID > 2"
    Me.FilterOn = True
    
    Me.OrderBy = "BkSortKey, LastName, FirstName"
    Me.OrderByOn = True
    
    PageOneCount = Me.OpenArgs            ' How many Detail sections to print on the "1st Half-Page"
    PageOneRemaining = 4 - PageOneCount   ' Counter of how many remaining Detail sections to skip on "1st Half-Page"
    
    End Sub
    
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        If Len(Me.ClassPicture & "") > 0 Then
            Me.Image.Picture = "c:\crs\images\" & Me.ClassPicture & ".jpg"
        Else
            Me.Image.Picture = "c:\crs\images\Default.jpg"
        End If
    End Sub
    
    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    
    If PageOneCount = 0 And PageOneRemaining > 0 Then               ' Potentially skipping sections 1st half-page only.
        Me.PrintSection = False
        Me.NextRecord = False
        PageOneRemaining = PageOneRemaining - 1                     ' Decrement sections skipped
    Else
        Me.PrintSection = True
        Me.NextRecord = True
        If PageOneCount > 0 Then PageOneCount = PageOneCount - 1    ' Decrement number of sections printed 1st half-page.
    End If
    
    End Sub

  2. #2
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Does the same thing on A2007 using commercial size duplex Copier/Printer.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    No idea, that is exactly the opposite of what I would expect. Does PrintPreview reflect same as the printout?
    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.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    NO, the print preview is exactly what I want but the PrintSection and NextRecord seem to be lost when I actually print.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I just printed document without first going through Print Preview and the printing is as desired. The printing only gets messed up if I go through Print Preview first.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Okay, that puts a different slant on my understanding. I ran into a similar issue. I just have to send the report direct to printer. If you want to allow a preview, then code will have to close the report and then run another OpenReport with direct to printer parameter.
    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.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Yes, that seems to be the only way around this issue. In the case of this app it's important to preview what has been compiled into a booklet, so I'll setup some easy to understand prompts so the user knows the opportunity to print will be given when they CLOSE the preview.

    Thanks,
    Bill

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

Similar Threads

  1. Replies: 3
    Last Post: 07-26-2012, 12:15 PM
  2. Replies: 2
    Last Post: 06-20-2012, 02:21 AM
  3. Info in header in Print Preview but now when Printed
    By 2012accessnoob in forum Reports
    Replies: 6
    Last Post: 02-16-2012, 02:46 PM
  4. Replies: 1
    Last Post: 08-16-2011, 10:24 AM
  5. Total records printed
    By LesleyA in forum Queries
    Replies: 3
    Last Post: 08-04-2008, 03:53 AM

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