Kamis, 23 Juni 2016

[MS_AccessPros] Re: Print Dialogue Box not printing columns correctly

 

Bill,


I tried this. It works GREAT! Thanks for the post.


Doyce



---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :

Doyce

The best label printing code I've used is at Peterssoftware.com That might address your issue.

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.microsoft.com/en-us/PublicProfile/35852?fullName=Bill%20%20Mosca
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com



---In MS_Access_Professionals@yahoogroups.com, <winberry.doyce@...> wrote :

Hello Pros!


I have a report that has 2 columns that prints labels on letter size paper. I have some code in the report that lets you choose which row and column to start printing on from controls on the form to save paper if you don't use all the labels from a previous print. Here's the problem. I decided that I wanted a printer dialogue to open in case the printer needed is not the default printer so I changed the code behind the "print" button from:

DoCmd.OpenReport stDocName, acNormal

to:

DoCmd.OpenReport stDocName, acViewPreview
DoCmd.RunCommand acCmdPrint

which opens the print dialogue box but it always starts printing on row 1 column 1 instead of whatever I specified on the form. It then shows a preview of the report which appears correctly on the screen. Here is the code on the report that works correctly if I use DoCmd.OpenReport stDocName, acNormal which prints to the default printer:

Option Compare Database
Option Explicit
Private Const TotCols As Long = 2
Private StartRecord As Long, RecordCount As Long

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If Me.Detail.WillContinue = False Then
        RecordCount = RecordCount + 1
    End If

    If RecordCount < StartRecord Then
        Me.NextRecord = False
        Me.PrintSection = False
    Else
        Me.NextRecord = True
        Me.PrintSection = True
    End If

End Sub

Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As Integer)
    RecordCount = 0
End Sub

Private Sub Report_Open(Cancel As Integer)
    Dim StartRow As Long, StartCol As Long
    Dim FormName As String

    FormName = "frmPartMasterLabels3x4"


    StartRow = Forms(FormName)("TxtStartRow")
    StartCol = Forms(FormName)("TxtStartColumn")
    'For across then down use: StartRecord = StartCol + (StartRow - 1) * TotCols
    'For down then across use: StartRecord = (StartCol - 1) * 3 + StartRow
    StartRecord = StartCol + (StartRow - 1) * TotCols
    RecordCount = 0
End Sub


This code is from AD Tejpal. Any ideas how to tweak this to let me open the printer dialogue box and still get the correct output?


Doyce

__._,_.___

Posted by: winberry.doyce@con-way.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar