Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Posts
    72

    Unanswered: Printer settings

    I'm running access 2003 and on a particular computer I'm getting an error when trying to open reports because the default printer for that computer is a label printer and the size is too small so it comes up with a run time error.

    What I want to do is have it detect if the printer access is set to is too small for the report to run and change it to Microsoft Office Document Image Writer then bring up a message box to inform the user.

    I know how to change the printer, the problem is detecting if the currently selected printer is too small. I had a look at application.printer properties and none of them seem useful for doing this.

    Any suggestions?

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Have a look at PrtDevMode in Help. I think that's what you're looking for.
    Inspiration Through Fermentation

  3. #3
    Join Date
    Feb 2007
    Posts
    4
    As it's Access 2003, you can use the Application.Printer object - no need to mess with prtdevmode to change printers

  4. #4
    Join Date
    Jun 2006
    Posts
    72
    Well I've given up trying to check if the paper size is right but now I can't seem to even change the printer either.

    Code:
        DoCmd.Close acReport, Rpt
        DoCmd.OpenReport Rpt, acViewDesign, , , acHidden
        If i = Application.Printers.Count - 1 Then
            Set Reports(Rpt).Printer = Application.Printers(0)
        Else
            Set Reports(Rpt).Printer = Application.Printers(i + 1)
        End If
        MsgBox Reports(Rpt).Printer.DeviceName
        DoCmd.Close acReport, Rpt, acSaveYes
        DoCmd.OpenReport Rpt, acViewDesign, , , acHidden
        MsgBox Reports(Rpt).Printer.DeviceName
    I use this code to cycle between printers (there's more to it but the rest is irrelevant). The first message box shows that the report has changed printers and the second shows that it has changed back. For some reason it's not saving the setting as it should. I've tried it with and without set but it makes no difference.

    Perhaps I can use PrtDevMode to change the printer but the last time I tried to use that I couldn't get it to work at all. I'll try to get it to do what I want with PrtDevMode but in the mean time any suggestions would as always be much appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •