Which Paper Bin?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ken OHanlon
    New Member
    • Apr 2008
    • 39

    Which Paper Bin?

    The easiest way for me to ask what I want is to show it by example. Once inside any .mdb select FILE -> PAGE SETUP. When the PAGE SETUP window comes up, select the PAGE tab. After you select “USE SPECIFIC PRINTER” the form automatically repopulates the SIZE and SOURCE combo boxes for that specific printer. I don’t care about the SIZE combo box, but how do you know what to put into the SOURCE combo box? This is AcPrintPaperBin , right? Finally, when you click on the OK command button, what are the VB commands that execute? Thanks -Ken.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32656

    #2
    I'm guessing from clues in your question that you're trying to control the settings in a report normally controlled by using Page-Setup.

    I did some looking but could only find the command to open the Page-Setup dialog-box.
    Code:
    Call DoCmd.RunCommand(acCmdPageSetup)

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32656

      #3
      I had a further look around for properties of a Report object that could match Paper-Size or Paper-Source and couldn't find anything at all. I'm sorry.

      Let's see if anyone else can come up with anything.

      Comment

      • Ken OHanlon
        New Member
        • Apr 2008
        • 39

        #4
        Originally posted by NeoPa
        I had a further look around for properties of a Report object that could match Paper-Size or Paper-Source and couldn't find anything at all. I'm sorry.

        Let's see if anyone else can come up with anything.
        I love the idea of just using MS's PageSetup routine instead of building a new wheel! I tried it but I can an error 2585, "This action can't be carried out while processing a form or report event" Thats great, where else would you call it from!!! Can we fix the error 2585? Hope we can get this to work, Thanks -Ken.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32656

          #5
          Fair question (although expecting software always to work logically is perhaps a little naiëve).

          I can only think of trying some timer based triggering. I'll let you know how my tests proceed.

          ** Edit **
          No joy I'm afraid. Might work in a form but Reports have no timer based events :(

          Comment

          • mshmyob
            Recognized Expert Contributor
            • Jan 2008
            • 903

            #6
            If you want to select your paper bin

            [code=vb]
            Me.Printer.Pape rbin = acPRBNAuto '(Default) Use paper from the current default bin
            Me.Printer.Pape rbin = acPRBNCassette 'Use paper from the attached cassette cartridge
            Me.Printer.Pape rbin = acPRBNEnvelope 'Use envelopes from the envelope feeder
            Me.Printer.Pape rbin = acPRBNEnvManual ' Use envelopes from the envelope feeder, but wait for manual insertion
            Me.Printer.Pape rbin = acPRBNFormSourc e ' Use paper from the forms bin
            Me.Printer.Pape rbin = acPRBNLargeCapa city ' Use paper from the large capacity feeder
            Me.Printer.Pape rbin = acPRBNLargeFmt ' Use paper from the large paper bin
            Me.Printer.Pape rbin = acPRBNLower ' Use paper from the lower bin
            Me.Printer.Pape rbin = acPRBNManual ' Wait for manual insertion of each sheet of paper
            Me.Printer.Pape rbin = acPRBNMiddle ' Use paper from the middle bin
            Me.Printer.Pape rbin = acPRBNSmallFmt ' Use paper from the small paper feeder
            Me.Printer.Pape rbin = acPRBNTractor ' Use paper from the tractor feeder
            Me.Printer.Pape rbin = acPRBNUpper ' Use paper from the upper bin
            [/code]

            I don't know if this is what you were looking for so if it isn't just ignore.

            I know it isn't for a report but if you set it before running the report the report will use the tray you set.

            Use the Me.Printer.Pape rsize property to set the papersizes.

            cheers,

            Comment

            • Ken OHanlon
              New Member
              • Apr 2008
              • 39

              #7
              I like that last reply, but how do you know which paperbin choices to limit user to depending on the printer? I guess I'm asking, how do you get the print driver to tell you its paperbin / papersize limitations. Thanks -Ken.

              Comment

              • mshmyob
                Recognized Expert Contributor
                • Jan 2008
                • 903

                #8
                Check out the following Microsoft link to get your printer capabilities including your paper bin sizes.

                If you have trouble implementing I will create a simplified code for you.

                Retrive Printer Capabilities


                cheers,

                Originally posted by Ken OHanlon
                I like that last reply, but how do you know which paperbin choices to limit user to depending on the printer? I guess I'm asking, how do you get the print driver to tell you its paperbin / papersize limitations. Thanks -Ken.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32656

                  #9
                  Originally posted by mshmyob
                  If you want to select your paper bin
                  [code=vb]
                  Me.Printer.Pape rbin = acPRBNAuto '(Default) Use paper from the current default bin
                  ...
                  Me.Printer.Pape rbin = acPRBNUpper ' Use paper from the upper bin
                  [/code]
                  ...
                  This looks good Mshmyob, but I couldn't find a .Printer property in either the Report or the Form objects. Can you say what Me. refers to in this context?

                  Comment

                  • mshmyob
                    Recognized Expert Contributor
                    • Jan 2008
                    • 903

                    #10
                    Hello Neo,

                    As you said there is nothing for the Reports. This has to be done in say a form that calls the report.

                    Assume you just want to print to the DEFAULT printer and want to print to the MANUAL feeder and change the print size to LEGAL.

                    [code=vb]
                    Dim rpt As Report
                    Dim prtr As Printer

                    Set Application.Pri nter = Nothing
                    Set prtr = Application.Pri nter

                    'Set the default printer's paper bin to manual and paper size to legal
                    prtr.PaperBin = acPRBNManual
                    prtr.PaperSize = acPRPSLegal

                    'open your report in hidden view to aplly print settings
                    DoCmd.OpenRepor t "rptName", acViewPreview, , , acHidden
                    Set rpt = Reports!rptName
                    'Set the Printer property of the report to the
                    'Application.Pr inter object
                    Set rpt.Printer = prtr
                    ' now open the report in normal view to print
                    DoCmd.OpenRepor t "rptName", acViewNormal
                    DoCmd.Close acReport, "rptName", acSaveNo
                    Set Application.Pri nter = Nothing
                    [/code]

                    Note I did not save these settings to the printer - the default printer settings stay in effect after I print.

                    cheers,

                    Originally posted by NeoPa
                    This looks good Mshmyob, but I couldn't find a .Printer property in either the Report or the Form objects. Can you say what Me. refers to in this context?
                    Last edited by mshmyob; Apr 22 '08, 12:18 PM. Reason: Added last paragraph.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32656

                      #11
                      Line #16, with reference back to lines #1 & #2, indicate that there should be a .Printer property of an Access.Report object. I could find no reference to this in the documentation (even hidden properties) and when I tried the following line (rptTrans was an open (previewed) report at the time) it complained of "An Application-defined or Object-defined error (#2465)".
                      Code:
                      ?Reports("rptTrans").Printer.PaperBin
                      I'm using Access 2000 at work on a Win2000 server PC.

                      Comment

                      • mshmyob
                        Recognized Expert Contributor
                        • Jan 2008
                        • 903

                        #12
                        If I recall correctly (keep in mind my memory is not what it used to be and it was never that good to begin with) I believe this became available in Acc2002. I will check and get back to you.

                        cheers,

                        Originally posted by NeoPa
                        Line #16, with reference back to lines #1 & #2, indicate that there should be a .Printer property of an Access.Report object. I could find no reference to this in the documentation (even hidden properties) and when I tried the following line (rptTrans was an open (previewed) report at the time) it complained of "An Application-defined or Object-defined error (#2465)".
                        Code:
                        ?Reports("rptTrans").Printer.PaperBin
                        I'm using Access 2000 at work on a Win2000 server PC.

                        Comment

                        • mshmyob
                          Recognized Expert Contributor
                          • Jan 2008
                          • 903

                          #13
                          OK I have scanned the NET and I cannot find any reference in Acc2000 - The first reference I find is for ACC2002. So maybe my memory is still working. Maybe someone else can confirm.

                          (I'll send you an UPGRADE coupon for Xmas - ;))

                          cheers,

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32656

                            #14
                            Ah :)

                            No worries on the coupon. I have 2003 at home and expect to get a new PC here soon (@work) with 2003 on that too (won't be touching 2007 any time soon ;)).

                            Comment

                            • mshmyob
                              Recognized Expert Contributor
                              • Jan 2008
                              • 903

                              #15
                              Actually I have been using 2007 for a year now and done some large apps on it and it seems to work very nicely.

                              cheers,

                              Originally posted by NeoPa
                              Ah :)

                              No worries on the coupon. I have 2003 at home and expect to get a new PC here soon (@work) with 2003 on that too (won't be touching 2007 any time soon ;)).

                              Comment

                              Working...