Solved

Fake printer

Posted on 2013-01-21
2
556 Views
Last Modified: 2013-01-22
Hi Experts,

I an issue that I hope someone can help me with. I have a MS Access database that uses Stephen Lebans ConvertReportToPDF. That works great but there is an issue. This database is used by many users that have different default printers installed. The reason why this is an issue is because ConvertReportToPDF uses the default printers settings when creating a PDF file. So if I create a PDF file i may look fine but when another person with another default printer installed are creating the same report, it may not fit 1 page and then two pages are created.

So i was thinking if it could be possible for my Access databse to add a "fake" default printer that it uses on all computer when creating PDF files?

I know this means that I also need some code to registrer the users default printer for when they are prtinting on paper, so I can switch between the real printer and the fake one.

Can some one help me with this issue?
0
Comment
Question by:DCRAPACCESS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 500 total points
ID: 38804531
Option Compare Database
Option Explicit

Public Declare Function SetDefaultPrinter Lib "winspool.drv" _
Alias "SetDefaultPrinterA" (ByVal pszPrinter As String) As Long

Public myPrinter As String

Private Sub Form_Load()
myPrinter = Application.Printer.DeviceName 'grab default printer so we can reset it on exit
End Sub

Sub PrintPDF_Click
Dim prtFake As Printer
Set Application.Printer = Application.Printers("\\ServerName\PrinterName\Fake")
Set prtFake = Application.Printer
SetDefaultPrinter prtFake 'set to Fake

' PrintPDF prtFake
 
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetDefaultPrinter myPrinter 'reset to default
End Sub
0
 

Author Closing Comment

by:DCRAPACCESS
ID: 38804967
This was perfect!!!! You are the best!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question