• Programatically adjust printer settings (A97 sr2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Programatically adjust printer settings (A97 sr2)

    Author
    Topic
    #365999

    Hi all,

    We have a printer with two trays: tray1= letterhead, tray2= plain paper

    We create Delivery dockets by printing a form onto plain paper and Invoices by printing onto the letterhead. This is set in each form and works well.

    I have been asked, is it able to print 2 copies of each invoice, 1 on letterhead, 1 on plain.

    I have a button on the form that causes the “print current record” procedure. Is there code that can be added to the button to cause the printer to change paper tray and then print another copy?

    I assume that the next time the form is opened, the printer will default to the values saved in the form.

    Thinking about it, I should be able to address the current printer object and make the changes I want.
    If this is true, Can someone spell (type) out for me in short and simple words how exactly to do this please.

    Viewing 2 reply threads
    Author
    Replies
    • #566384

      I would create two printers in windows, one with default plain paper and one with default letterhead.
      Make two identical report, but with specific printer (in the page setup dialog) , one with the letterhead printer and one with the plain paper printer. This is saved with the report. Print the two reports one after they other with 2 Docmd.OpenReport.
      There is no way to control the printer until you buy Office XP, witch had a Printer Object, but I haven’t see it yet and I don’t know if you can manipulate trays with it.

      • #566480

        Francois, look at the PrtDevMode. One can perform all sorts of manipulation with that, however it is not very easy to use. I have used it with Access 97 and above.

    • #566388

      There is a way to programatically set the Printer settings, although I have never taken the time to make it work properly.

      It’s called PrtDevMode – you can search Access help for it or look at the MSKB Articles ">Q200546. The first article has a link to a great article by Ken Getz.

      Access 2002 (XP) has these seetings placed into nice easy properties, but it’s essentially doing the same thing that the PrtDevMode settings did in earlier versions.

      HTH thumbup

    • #566481

      Here is some code that I had “stashed” in my folder of things I might need one day. I have not actually tested it but maybe you can adapt it to your use.

      Option Compare Database
      Option Explicit

      Const R_UPPER_TRAY = 1
      Const R_LOWER_TRAY = 2

      Type R_DevModeStr

      • #567288

        Back from a few days away, thanks for the code snippet Ricky, I will attempt to try and make sense of it and see if I can make it work.

    Viewing 2 reply threads
    Reply To: Programatically adjust printer settings (A97 sr2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: